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

Re: [doko@cs.tu-berlin.de: Bug#95285: Incorrect globbing under locales]

Paul Martin wrote:
> Seems like it's documented behaviour for bash. Pity I had to file a bug
> to find this out.


I'm cc-ing -devel to let others read about this ugly ugly thing. And
going to fix rpm's debian/rules file to use [:lower:] instead of [a-z].

> Looks like it would be a good idea to add "export LC_ALL=POSIX" to the
> default dh_make "rules" file.

Well, we _could_ do that. It would probably have nasty effects if you
expected to be able to build a package and see errors in your native
language though.

> ----- Forwarded message from Matthias Klose <doko@cs.tu-berlin.de> -----
> Envelope-to: pm@nowster.zetnet.co.uk
> From: Matthias Klose <doko@cs.tu-berlin.de>
> To: Paul Martin <pm@debian.org>, 95285-done@bugs.debian.org
> Subject: Bug#95285: Incorrect globbing under locales
> Paul Martin writes:
>  > Package: bash
>  > Version: 2.05-2
>  > Severity: important
>  > 
>  > This behaviour exists on my machine. However I ran these tests on one of
>  > the Debian machines, just to prove it wasn't any configuration fault of
>  > mine.
> See the COMPAT file, 14:
> 14. The behavior of range specificiers within bracket matching expressions
>     in the pattern matcher (e.g., [A-Z]) depends on the current locale,
>     specifically the value of the LC_COLLATE environment variable.  Setting
>     this variable to C or POSIX will result in the traditional ASCII behavior
>     for range comparisons.  If the locale is set to something else, e.g.,
>     en_US (specified by the LANG or LC_ALL variables), collation order is
>     locale-dependent.  For example, the en_US locale sorts the upper and
>     lower case letters like this:
>         AaBb...Zz
>     so a range specification like [A-Z] will match every letter except `z'.
>     The portable way to specify upper case letters is [:upper:] instead of
>     A-Z; lower case may be specified as [:lower:] instead of a-z.
>     Look at the manual pages for setlocale(3), strcoll(3), and, if it is
>     present, locale(1).
>     You can find your current locale information by running locale(1):
>         caleb.ins.cwru.edu(2)$ 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_ALL=en_US
>     My advice is to put
>         export LC_COLLATE=C
>     into /etc/profile and inspect any shell scripts run from cron for
>     constructs like [A-Z].  This will prevent things like
>         rm [A-Z]*
>     from removing every file in the current directory except those beginning
>     with `z' and still allow individual users to change the collation order.
>     Users may put the above command into their own profiles as well, of course.
> ----- End forwarded message -----
> -- 
> Paul Martin <pm@zetnet.net> (work)
>   <pm@nowster.zetnet.co.uk> (home)
>     <pm@debian.org> (Debian stuff)

see shy jo, retching

Reply to: