tag 9418 notabug
thanks

On 09/01/2011 02:58 AM, Michał Janke wrote:
sort (GNU coreutils) 8.12

The case-sensitivity looks buggy in sort. Have a look at these examples:

Thanks for the report. However, this is most likely due to your choice of locale, and not a bug in sort; this is a FAQ:
https://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021

Using 'sort --debug' will help expose the issue.

$ sort -k1,2 bbb
a B b 0
A b b 1
A B b 0

$ sort --debug bbb -k1,2
sort: using `en_US.UTF-8' sorting rules
sort: leading blanks are significant in key 1; consider also specifying `b'
a B b 0
___
_______
A b b 1
___
_______
A B b 0
___
_______
$ LC_ALL=C ../coreutils/src/sort --debug bbb -k1,2
../coreutils/src/sort: using simple byte comparison
A B b 0
___
_______
A b b 1
___
_______
a B b 0
___
_______

See the difference? In the C locale, you get ascii sorting (A comes before B comes before a comes before b), in the en_US.UTF-8 locale, you get dictionary collation sorting (a comes before A comes before b comes before B).

--
Eric Blake   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



Reply via email to