bug-coreutils
[Top][All Lists]
Advanced

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

bug#7216: [bug report] for sort.c in coreutils-5.93


From: Eric Blake
Subject: bug#7216: [bug report] for sort.c in coreutils-5.93
Date: Thu, 14 Oct 2010 09:49:20 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.4

On 10/14/2010 08:28 AM, jack alibaba wrote:
BTW: the email  address of the author 'mike' in
coreutils-5.93/src/sort.c  is invalid~~~.

Consider upgrading - the latest stable version is 8.5, with 8.6 due shortly, and there have been a LOT of bug fixes to sort in the meantime.

bash#>  (echo 1230 1;echo 123 1)|sort -k1
1230 1
123 1
bash#>  (echo 1230 1;echo 123 0)|sort -k1
123 0
1230 1

> I'm not sure if it is my mistake or a bug~~~

Using the new 'sort --debug' feature of coreutils 8.6 shows that the bug is in your usage, and not in sort:

$ (echo 1230 1; echo 123 1) | src/sort --debug -k1
src/sort: using `en_US.UTF-8' sorting rules
src/sort: leading blanks are significant in key 1; consider also specifying `b'
1230 1
______
______
123 1
_____
_____
$ (echo 1230 1; echo 123 1) | src/sort --debug -k1,1
src/sort: using `en_US.UTF-8' sorting rules
src/sort: leading blanks are significant in key 1; consider also specifying `b'
123 1
___
_____
1230 1
____
______
$ (echo 1230 1; echo 123 1) | LC_ALL=C src/sort --debug -k1
src/sort: using simple byte comparison
123 1
_____
_____
1230 1
______
______

Thus, you have two bugs - you probably weren't careful with your locale (and some locales, like en_US.UTF-8, ignore whitespace when collating), and you weren't sorting on JUST column 1, but on the entire string (-k1 vs. -k1,1).

--
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]