Created attachment 1479395 [details] test case Description of problem: The [[ STRING =~ regex ]] compound command gives sometimes false matches. It wrongly matches lower case letters. Version-Release number of selected component (if applicable): GNU bash, Version 4.4.23(1)-release (x86_64-redhat-linux-gnu) How reproducible: Use the attached bash script "mt" to check the following: Steps to Reproduce: 1. ./mt MOa ; 2. ./mt MOb Actual results: Output generated in step 1: no match match Output generated in step 2: match match Expected results: Output generated in both steps should be identical, i.e.: Output generated in step 1: no match match Output generated in step 2: no match match Additional info: In opensuse tumbleweed, which provides bash with the same version number (4.4.23(1)-release (x86_64-suse-linux-gnu), this bug does NOT exist.
Note: In the attached test case #!/bin/sh is called, but this is symlinked to bash here. So effectively bash is called.
Did you try it with POSIX locale? $ LC_ALL=C ./mt MOb no match match
Good catch. With LC_ALL=C it behaves correctly. After further investigation, the behavior depends on LANG, which is set to de_DE.utf8 here. I get buggy results with LANG=de_DE.utf8, LANG=de_DE, LANG=fr_FR, LANG=cs_CZ (others not checked) and correct results when LANG is unset, "C", or unknown (such as "xx_YY") The only other locale dependend environment variable that is set is: LC_CTYPE=de_DE.iso8859-15@euro. LC_CTYPE aparrently does not affect this behavior.
OK, after reading https://unix.stackexchange.com/questions/15980/does-should-lc-collate-affect-character-ranges and http://pubs.opengroup.org/onlinepubs/007908799/xbd/re.html at least there is some kind of explanation for the observed behavior (LC_COLLATE controlled, finally) and a workaround using [[:upper]]. Nevertheless, it's still questionable why 'a' is considered to be not in the range [A-Z] but 'b' (and other lower case letters) is.
This message is a reminder that Fedora 28 is nearing its end of life. On 2019-May-28 Fedora will stop maintaining and issuing updates for Fedora 28. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '28'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 28 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 28 changed to end-of-life (EOL) status on 2019-05-28. Fedora 28 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.