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

Re: Bug#160932: bash: fileglobbing broken with LANG=sv_SE



Tobias writes:
> Attached is a small script that shows the difference between the too. 
> Personally I think the tcsh is better sorted because of the difference 
> between "A" and "a".

bash's behaviour is different than tcsh, dash, zsh, ksh.

bash --norc
LANG=sv_SE
power-post-setup.bmp
ls: [A-Z][A-Z]*: No such file or directory
ls: [A-Z][A-Z]*: No such file or directory

all other shells don't show the file with the lowercase letter.
reading bash(1)'s Environment section, one might think, that
explicitely setting LC_CTYPE would help, but it does not:

bash --norc
LC_CTYPE=C
LANG=sv_SE
power-post-setup.bmp
ls: [A-Z][A-Z]*: No such file or directory
ls: [A-Z][A-Z]*: No such file or directory


using de_DE as the locale, bash's behaviour is the same as for the
other shells.

same behaviour with bash-2.05b and bash3 alpha.

--------------------
#! /bin/sh

locale=sv_SE
[ $# -gt 0 ] && locale=$1

mkdir test || exit 0
cd test
touch power-post-setup.bmp

lang_tester() {
  export LANG=$locale
  #export LC_CTYPE=C
  unset LC_CTYPE;
  env | egrep 'LANG|LC_'
  $1 <<EOF
    ls -d [A-Z][A-Z]*
EOF

  export LANG=C;
  $1 <<EOF
    ls -d [A-Z][A-Z]*
EOF

  unset LANG;
  $1 <<EOF
    ls -d [A-Z][A-Z]*
EOF
}

for sh in                       \
        "tcsh -f"               \
        "dash"                  \
        "zsh"                   \
        "ksh"                   \
        "bash --norc"           \
        "bash3 --norc"
do
        echo "$sh"
        lang_tester "$sh"
done

cd ..
rm -rf test
--------------------



Reply to: