Bug 77349 - case sensitive filename globbing
case sensitive filename globbing
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
:
: 182497 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-11-05 12:24 EST by Fabrice Bellet
Modified: 2007-04-18 12:48 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-11-05 12:31:21 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Fabrice Bellet 2002-11-05 12:24:27 EST
Filename globbing has a strange behaviour, according to the nocaseglob shell
variable (bash-2.05a-13) :


bash-2.05a$ mkdir /tmp/test
bash-2.05a$ cd /tmp/test
bash-2.05a$ touch xx yy ZZ YY
bash-2.05a$ shopt -u nocaseglob
bash-2.05a$ echo [a-z]*
xx yy YY
bash-2.05a$ shopt -s nocaseglob
bash-2.05a$ echo [a-z]*
xx yy YY ZZ

--> I'd expect [a-z]* to glob to xx yy only when nocaseglob in unset.
Note : According to the Pattern Matching section of the bash manual, 
I checked that my LC_COLLATE has not an exotic value : it's unset.
Comment 1 Tim Waugh 2002-11-05 12:26:09 EST
And 'locale' says?
Comment 2 Fabrice Bellet 2002-11-05 12:31:14 EST
bash-2.05a$ locale
LANG=en_US
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=
Comment 3 Tim Waugh 2002-11-05 12:35:10 EST
It is collating according to en_US rules.  You forgot to use 'LANG=C' if you
wanted C-locale collation.
Comment 4 Fabrice Bellet 2002-11-05 13:01:04 EST
Setting C-locale didn't change the behaviour :

bash-2.05a$ export LANG=C
bash-2.05a$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
bash-2.05a$ touch xx yy ZZ YY
bash-2.05a$ shopt -u nocaseglob
bash-2.05a$ echo [a-z]*
xx yy YY
bash-2.05a$ shopt -s nocaseglob
bash-2.05a$ echo [a-z]*
xx yy YY ZZ
bash-2.05a$ ls
YY  ZZ  xx  yy

I'd say it looks like a boundary problem when globbing [a-z], because if I
substitute the filename ZZ with another one in uppercase, strictly
included in the a-z range, this filename is globbed, independantly of
the value of the 'nocaseglob' option :

 bash-2.05a$ rm ZZ
bash-2.05a$ touch XX
bash-2.05a$ shopt -u nocaseglob
bash-2.05a$ echo [a-z]*
xx XX yy YY
bash-2.05a$ shopt -s nocaseglob
bash-2.05a$ echo [a-z]*
xx XX yy YY
bash-2.05a$ ls
XX  YY  xx  yy

Did I forget something else ? It looks strange and unexpected to me.
Comment 5 Fabrice Bellet 2002-11-05 13:06:31 EST
By the way, [[:upper:]] and [[:lower:]] show me an expected behaviour with the C
locale :

bash-2.05a$ ls -l
total 0
-rw-r--r--    1 bellet   users           0 Nov  5 18:49 XX
-rw-r--r--    1 bellet   users           0 Nov  5 18:47 YY
-rw-r--r--    1 bellet   users           0 Nov  5 18:47 xx
-rw-r--r--    1 bellet   users           0 Nov  5 18:47 yy
bash-2.05a$ shopt -s nocaseglob
bash-2.05a$ echo [[:lower:]]*
xx XX yy YY
bash-2.05a$ echo [[:upper:]]*
[[:upper:]]*
bash-2.05a$ shopt -u nocaseglob
bash-2.05a$ echo [[:lower:]]*
xx yy
bash-2.05a$ echo [[:upper:]]*
XX YY
Comment 6 Tim Waugh 2002-11-05 13:30:53 EST
Then perhaps you are seeing bug #74701, where changing the LANG shell variable
doesn't call setlocale?  Try 'LANG=C bash'.
Comment 7 Fabrice Bellet 2002-11-05 13:43:57 EST
Yes, it works in this case. Thanks and sorry for the false alarm :-)
Comment 8 Tim Waugh 2006-02-22 18:01:33 EST
*** Bug 182497 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.