bug-coreutils
[Top][All Lists]
Advanced

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

bug#9418: case sensitivity buggy in sort


From: Eric Blake
Subject: bug#9418: case sensitivity buggy in sort
Date: Thu, 01 Sep 2011 10:32:45 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.20) Gecko/20110817 Fedora/3.1.12-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.12

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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]