GNU bug report logs - #6790
locale sort ordering confusion

Previous Next

Package: coreutils;

Reported by: "George Thomas Irimben (georgeti)" <georgeti <at> cisco.com>

Date: Tue, 3 Aug 2010 20:19:01 UTC

Severity: normal

Tags: moreinfo, notabug

Merged with 6791

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6790 in the body.
You can then email your comments to 6790 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6790; Package coreutils. (Tue, 03 Aug 2010 20:19:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "George Thomas Irimben (georgeti)" <georgeti <at> cisco.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 03 Aug 2010 20:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "George Thomas Irimben (georgeti)" <georgeti <at> cisco.com>
To: <bug-coreutils <at> gnu.org>
Subject: Problem(bug?) with basic sort command in Linux
Date: Wed, 4 Aug 2010 01:32:55 +0530
Hi,
I would like to report a problem(bug?) I am facing with sort command in
Linux.

Sorting of a simple text file using simple sort command is giving me
incorrect result.

Here is the problem:

Text file to sort has 3 lines
my-lnx7% cat y
abc/d,ABC
abc/,XYZ
abc/o,MNO

sort command from Linux is giving me below result(According to me, this
result is incorrect)

my-lnx7% sort y
abc/d,ABC
abc/o,MNO
abc/,XYZ

But, result expected is as below. Because "," is ahead of "d" in ASCII
table. 
Same found working on Unix using same input file, same command line.

abc/,XYZ
abc/d,ABC
abc/o,MNO


Pls let me know if this is a problem in Linux or I am missing something.


Thanks, George




Merged 6790 6791. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 03 Aug 2010 21:12:02 GMT) Full text and rfc822 format available.

Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 03 Aug 2010 21:12:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to "George Thomas Irimben (georgeti)" <georgeti <at> cisco.com> Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 03 Aug 2010 21:12:02 GMT) Full text and rfc822 format available.

Forcibly Merged 6790 6791. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Tue, 03 Aug 2010 21:39:02 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Tue, 03 Aug 2010 21:39:02 GMT) Full text and rfc822 format available.

Changed bug title to 'locale sort ordering confusion' from 'Problem(bug?) with basic sort command in Linux' Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Tue, 03 Aug 2010 21:39:02 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6790; Package coreutils. (Wed, 04 Aug 2010 11:12:01 GMT) Full text and rfc822 format available.

Message #20 received at 6790 <at> debbugs.gnu.org (full text, mbox):

From: Erik Auerswald <auerswal <at> unix-ag.uni-kl.de>
To: "George Thomas Irimben (georgeti)" <georgeti <at> cisco.com>
Cc: 6790 <at> debbugs.gnu.org
Subject: Re: bug#6790: Problem(bug?) with basic sort command in Linux
Date: Wed, 4 Aug 2010 13:12:05 +0200
Hi George,

On Wed, Aug 04, 2010 at 01:32:55AM +0530, George Thomas Irimben (georgeti) wrote:
> I would like to report a problem(bug?) I am facing with sort command in
> Linux.
> 
> Sorting of a simple text file using simple sort command is giving me
> incorrect result.
> 
> Here is the problem:
> 
> Text file to sort has 3 lines
> my-lnx7% cat y
> abc/d,ABC
> abc/,XYZ
> abc/o,MNO
> 
> sort command from Linux is giving me below result(According to me, this
> result is incorrect)
> 
> my-lnx7% sort y
> abc/d,ABC
> abc/o,MNO
> abc/,XYZ
> 
> But, result expected is as below. Because "," is ahead of "d" in ASCII
> table. 
> Same found working on Unix using same input file, same command line.
> 
> abc/,XYZ
> abc/d,ABC
> abc/o,MNO
> 
> 
> Pls let me know if this is a problem in Linux or I am missing something.

You missed the effects of locale settings (see
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Sort-does-not-sort-in-normal-order_0021).

$ printf "abc/d,ABC\nabc/,XYZ\nabc/o,MNO\n" | LC_COLLATE=en_US.UTF-8 sort
abc/d,ABC
abc/o,MNO
abc/,XYZ
$ printf "abc/d,ABC\nabc/,XYZ\nabc/o,MNO\n" | LC_COLLATE=C sort 
abc/,XYZ
abc/d,ABC
abc/o,MNO

Erik
-- 
If you're willing to restrict the flexibility of your approach,
you can almost always do something better.
                        -- John Carmack




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 01 Sep 2010 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.