Red Hat Bugzilla – Bug 19942
LANG=en_US (the default) appears to fold lowercase to uppercase before sorting
Last modified: 2016-11-24 10:23:02 EST
$ LANG= bash -c 'echo -e "a\nB" | sort'
$ LANG=en bash -c 'echo -e "a\nB" | sort'
$ LANG=en_US bash -c 'echo -e "a\nB" | sort'
!!!oops, that can't be right!!! The same commands run on AIX and HPUX all
identical output (as I would expect no difference between "en" and "en_US"
in this regard).
The GNU C Library Reference Manual says that "[d]efining and installing
[other than "C" or "POSIX" is normally a responsibility of ... the person
who installed the
GNU C library". I guess that that would fall on Red Hat for installing a
broken locale and
making it the default.
Actually, it is right. Open any printed vocabulary (be it English,
German, Norwegian or Czech) and see how entries are sorted.
The fact that sorting has been broken on most of the OSes
does not change anything on that. There is no such locale as en, so
it defaults to C, that's why the output of the first two is identical.
If you rely on ASCII sorting, use C locale, if you want native language
collation, use your own locale.
If AIX and HPUX don't fold cases, they are broken.
E.g. Solaris with en_US locale sorts the same way as RHL 7.0.
Well, then the bug is RedHat defaulting to LANG=en_US. It should probably
default to either "C" or "POSIX" and the user should change it to "en_US" if
that's what they want. According the the GNU C Library Reference Manual, "C"
and "POSIX" are the only ones that can be considered "portable" as all others
are obviously vendor supplied and therefore, extensions.
I have entered bug #19973 against package "initscripts".