bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Incorrect behaviour in glob expansion in bash 2.05b.


From: Jakub Travnik
Subject: Incorrect behaviour in glob expansion in bash 2.05b.
Date: Tue, 06 Jan 2004 14:10:20 +0100 (CET)

Hello,

I have found a bug in shell glob pattern expansion.

Simple description: expansion of [a-z]* pattern includes some upper
case files and directories even when SHELLOPTS indicate that expansion
should be case sensitive.

I could replicate error in bash-2.05, bash-2.05b, but NOT in bash-2.04
as downloaded from http://ftp.gnu.org/pub/gnu/bash/


jakub@jtra:~$ bash -version
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.


steps to replicate:

1, create empty directory

2, cd into it

3, touch foo

4, touch Foo

5, try echo [a-z]* result should show files beginning with lowercase
letter only.

6, try echo [f-z]* bug is not triggered in this case so it is obvious
that case sensitivity flag in SHELLOPTS is not set.


example, BAD (bash-2.05b):
jakub@jtra:~/tmp$ mkdir bad
jakub@jtra:~/tmp$ cd bad
jakub@jtra:~/tmp/bad$ touch foo
jakub@jtra:~/tmp/bad$ touch Foo
jakub@jtra:~/tmp/bad$ echo [a-z]*
Foo foo
jakub@jtra:~/tmp/bad$ echo [f-z]*
foo

example, OK (bash-2.04):
jakub@jtra:~/tmp$ mkdir ok
jakub@jtra:~/tmp$ cd ok
jakub@jtra:~/tmp/ok$ touch foo
jakub@jtra:~/tmp/ok$ touch Foo
jakub@jtra:~/tmp/ok$ echo [a-z]*
foo
jakub@jtra:~/tmp/ok$ echo [f-z]*
foo


example session (bash-2.05b):

jakub@jtra:~$ cd tmp
jakub@jtra:~/tmp$ mkdir bashtest
jakub@jtra:~/tmp$ cd bashtest/
jakub@jtra:~/tmp/bashtest$ mkdir CVS
jakub@jtra:~/tmp/bashtest$ touch _foo
jakub@jtra:~/tmp/bashtest$ touch foo
jakub@jtra:~/tmp/bashtest$ echo [a-z_]*
CVS foo _foo
jakub@jtra:~/tmp/bashtest$ touch HMm
jakub@jtra:~/tmp/bashtest$ echo [a-z_]*
CVS foo _foo HMm
jakub@jtra:~/tmp/bashtest$ echo [a-z]*
CVS foo HMm
jakub@jtra:~/tmp/bashtest$ echo [c-z]*
foo HMm
jakub@jtra:~/tmp/bashtest$ touch Moo
jakub@jtra:~/tmp/bashtest$ echo [c-z]*
foo HMm Moo
jakub@jtra:~/tmp/bashtest$ touch Aoo
jakub@jtra:~/tmp/bashtest$ echo [a-z]*
CVS foo HMm Moo
jakub@jtra:~/tmp/bashtest$ echo $SHELL
/bin/bash
jakub@jtra:~/tmp/bashtest$ echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor


Behaviour is not dependant on current locale. Other shells do not show
this behaviour, for example pdksh (public domain Korn shell).


Note that I'm not subscribed in bug-bash, CC me if necessary.

Jakub Travnik
jabber://jtra@jabber.com
ICQ: 66770334




reply via email to

[Prev in Thread] Current Thread [Next in Thread]