Re: [firstname.lastname@example.org: 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
> ----- Forwarded message from Matthias Klose <email@example.com> -----
> Envelope-to: firstname.lastname@example.org
> From: Matthias Klose <email@example.com>
> To: Paul Martin <firstname.lastname@example.org>, email@example.com
> 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:
> 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
> 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 <firstname.lastname@example.org> (work)
> <email@example.com> (home)
> <firstname.lastname@example.org> (Debian stuff)
see shy jo, retching