GNU bug report logs - #9281
Is this expected behavior?

Previous Next

Package: coreutils;

Reported by: Ajesh Shaj <ajesh <at> yahoo-inc.com>

Date: Thu, 11 Aug 2011 06:40:04 UTC

Severity: normal

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 9281 in the body.
You can then email your comments to 9281 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#9281; Package coreutils. (Thu, 11 Aug 2011 06:40:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ajesh Shaj <ajesh <at> yahoo-inc.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 11 Aug 2011 06:40:06 GMT) Full text and rfc822 format available.

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

From: Ajesh Shaj <ajesh <at> yahoo-inc.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: Is this expected behavior?
Date: Thu, 11 Aug 2011 12:01:38 +0530
[Message part 1 (text/plain, inline)]
Hi,

    I got a strange ordering when I applied the linux sort command. Please see below for the details:

[ajesh <at> gwta3004 tmp]$ cat a
.a
ba
.b
bb
.c
bc
[ajesh <at> gwta3004 tmp]$ sort a
.a
.b
ba
bb
bc
.c


NOTE: .a and .b appears before ba and bb, where as .c appears after bc.

In general

if the file has strings of the type .<x> and <y><x>,

then for all x <= y, .x appear before yx and
          for all x>y, .x appear after yx

Is this expected behavior?

Regards
Ajesh

--

[Message part 2 (text/html, inline)]

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Thu, 11 Aug 2011 12:07:02 GMT) Full text and rfc822 format available.

Notification sent to Ajesh Shaj <ajesh <at> yahoo-inc.com>:
bug acknowledged by developer. (Thu, 11 Aug 2011 12:07:02 GMT) Full text and rfc822 format available.

Message #10 received at 9281-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Ajesh Shaj <ajesh <at> yahoo-inc.com>
Cc: 9281-done <at> debbugs.gnu.org
Subject: Re: bug#9281: Is this expected behavior?
Date: Thu, 11 Aug 2011 06:04:48 -0600
tag 9281 notabug
thanks

On 08/11/2011 12:31 AM, Ajesh Shaj wrote:
> Hi,
>
>      I got a strange ordering when I applied the linux sort command. Please see below for the details:
>
> [ajesh <at> gwta3004 tmp]$ sort a
> .a
> .b
> ba
> bb
> bc
> .c
>
>
> NOTE: .a and .b appears before ba and bb, where as .c appears after bc.

> Is this expected behavior?

Yep.  And this is a FAQ, caused by you using a locale that ignores 
punctuation when determining sort order.

https://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021

If you are using new enough coreutils, try:

sort --debug a

for better understanding what is happening, then compare to:

LC_ALL=C sort --debug a

(if your sort doesn't understand --debug, then it is still useful to try 
LC_ALL=C sort a).

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 09 Sep 2011 11:24:04 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, 20 Sep 2011 18:01:02 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 360 days ago.

Previous Next


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