[opensuse] Globbing broken in bash in 11.1 (really serious bug)
Hello, I just noticed a really serious bug in bash filename globbing: $ echo /B* $ echo /[A-C]* /bin /boot This is on an ext3 filesystem, which should clearly be case-sensitive! BTW: I found out about this bug by running $ rm -rf /some/dir/[A-Z]* :-/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday January 14 2009, Josef Wolf wrote:
Hello,
I just noticed a really serious bug in bash filename globbing:
$ echo /B* $ echo /[A-C]* /bin /boot
This is on an ext3 filesystem, which should clearly be case-sensitive!
BTW: I found out about this bug by running
$ rm -rf /some/dir/[A-Z]*
:-/
You're making unwarranted assertions. This is an option that you can control. Here is a brief excerpt from the BASH manual page: "If the shell option nocaseglob is enabled, the match is performed without regard to the case of alphabetic characters." Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wed, Jan 14, 2009 at 09:57:44AM -0800, Randall R Schulz wrote:
On Wednesday January 14 2009, Josef Wolf wrote:
$ echo /B* $ echo /[A-C]* /bin /boot
"If the shell option nocaseglob is enabled, the match is performed without regard to the case of alphabetic characters."
Thanks to all who replied to this mail so far. But this is also with nocaseglob=off and LC_COLLATE=C: $ shopt|grep case nocaseglob off nocasematch off $ LANG=C echo /[A-C]* /bin /boot $ LANG=C locale | grep COLLATE LC_COLLATE="C" $ So I still don't see a justification for such a behavior. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday 2009 January 14 12:54:20 Josef Wolf wrote:
$ LANG=C echo /[A-C]*
This changes the environment for running the echo command, it does not affect the globing which occurs before the command is run. You want: LANG=C; echo /[A-C]* On my system: $ mkdir test $ cd test $ touch b B $ echo [A-C]* b B $ ( LANG=C; echo [A-C]* ) B $ echo [A-C]* b B $ env | grep -e ^LANG -e ^LC LANG=en_US.utf8 LANGUAGE=en_US $ -- Boyd Stephen Smith Jr. ,= ,-_-. =. bss@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/
On Wed, Jan 14, 2009 at 01:36:54PM -0600, Boyd Stephen Smith Jr. wrote:
On Wednesday 2009 January 14 12:54:20 Josef Wolf wrote:
$ LANG=C echo /[A-C]*
This changes the environment for running the echo command, it does not affect the globing which occurs before the command is run. You want: LANG=C; echo /[A-C]*
Arghs! Of course, you're right! Thanks! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Josef Wolf (jw@raven.inka.de) [20090114 20:00]:
Thanks to all who replied to this mail so far. But this is also with nocaseglob=off and LC_COLLATE=C:
Hmm, maybe you should open a bug report. Philipp -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Wednesday 2009 January 14 11:43:37 Josef Wolf wrote:
I just noticed a really serious bug in bash filename globbing:
$ echo /B* $ echo /[A-C]* /bin /boot
This is on an ext3 filesystem, which should clearly be case-sensitive!
What's your locale settings? [A-C] means different things depending on your LC_COLLATE setting. It might mean [ABC], [AaBbC], [AbBcC], or even larger sets of characters (e.g., involving accents) If you want [A-C] to mean [ABC] you should set LC_COLLATE to "C" or "POSIX".
BTW: I found out about this bug by running
$ rm -rf /some/dir/[A-Z]*
That's unfortunate, but it's not a bug. -- Boyd Stephen Smith Jr. ,= ,-_-. =. bss@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/
* Josef Wolf (jw@raven.inka.de) [20090114 18:50]:
I just noticed a really serious bug in bash filename globbing:
$ echo /B* $ echo /[A-C]* /bin /boot
Very possibly a feature not a bug. What is the output of running locale? If LC_COLLATE is set to something else than C or POSIX bash is behaving like it's intended as (See »info '(bash.info.gz)Pattern Matching'« on '[...]'). That info page also tells you a way how to fix it. An alternative is to set LC_COLLATE=C before running these commands. Philipp -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Josef Wolf escribió:
BTW: I found out about this bug by running
$ rm -rf /some/dir/[A-Z]*
Not a bug, RTFM ;) -- "We have art in order not to die of the truth" - Friedrich Nietzsche Cristian Rodríguez R. Software Developer Platform/OpenSUSE - Core Services SUSE LINUX Products GmbH Research & Development http://www.opensuse.org/
participants (5)
-
Boyd Stephen Smith Jr.
-
Cristian Rodríguez
-
Josef Wolf
-
Philipp Thomas
-
Randall R Schulz