GNU bug report logs - #8214
red hat lynx 'sort' bug?

Previous Next

Package: coreutils;

Reported by: "Niergarth, Jeffrey" <jniergar <at> ciena.com>

Date: Wed, 9 Mar 2011 21:05:02 UTC

Severity: normal

Tags: moreinfo, notabug, unreproducible

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 8214 in the body.
You can then email your comments to 8214 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#8214; Package coreutils. (Wed, 09 Mar 2011 21:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Niergarth, Jeffrey" <jniergar <at> ciena.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 09 Mar 2011 21:05:02 GMT) Full text and rfc822 format available.

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

From: "Niergarth, Jeffrey" <jniergar <at> ciena.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: red hat lynx 'sort' bug?
Date: Wed, 9 Mar 2011 15:47:09 -0500
[Message part 1 (text/plain, inline)]
The 'sort' utility (no options) doesn't behave as expected:

Here are the pertinent results:

/fpga/OAF/HD/rtl/vhdl_wrapper/clock_monitor_synthesis.v
/fpga/OAF/HD/rtl/vhdl_wrapper/clockmonitor_synthesis.v
/fpga/OAF/HD/rtl/vhdl_wrapper/clock_monitor_synthesis.v IN
/fpga/OAF/HD/rtl/vhdl_wrapper/clockmonitor_synthesis.v IN

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

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Wed, 09 Mar 2011 21:14:02 GMT) Full text and rfc822 format available.

Notification sent to "Niergarth, Jeffrey" <jniergar <at> ciena.com>:
bug acknowledged by developer. (Wed, 09 Mar 2011 21:14:02 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: "Niergarth, Jeffrey" <jniergar <at> ciena.com>
Cc: 8214-done <at> debbugs.gnu.org
Subject: Re: bug#8214: red hat lynx 'sort' bug?
Date: Wed, 09 Mar 2011 14:12:51 -0700
[Message part 1 (text/plain, inline)]
On 03/09/2011 01:47 PM, Niergarth, Jeffrey wrote:
> The 'sort' utility (no options) doesn't behave as expected:

Thanks for the report.  However, I fail to see that this is a bug.

> 
> Here are the pertinent results:
> 
> /fpga/OAF/HD/rtl/vhdl_wrapper/clock_monitor_synthesis.v
> /fpga/OAF/HD/rtl/vhdl_wrapper/clockmonitor_synthesis.v
> /fpga/OAF/HD/rtl/vhdl_wrapper/clock_monitor_synthesis.v IN
> /fpga/OAF/HD/rtl/vhdl_wrapper/clockmonitor_synthesis.v IN

This looks reasonable if you are using a locale that discards
punctuation from collation sorting (such as many implementations of
en_US.UTF-8).  This is a FAQ:
http://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021

Try 'LC_ALL=C sort' on the same data, to force all bytes to behave in
ASCII ordering.  I'm marking this bug as closed for now, but if you can
provide compelling evidence that there really is a bug in sort after you
sort out your locale, then we can re-open it.  You may also want to try
the 'sort --debug' option in the latest coreutils 8.10 to help diagnose
what sort is really doing, and why it is correct (even if it is not what
you were wanting, because you didn't use the right command line options
and locale environment variables).

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

[signature.asc (application/pgp-signature, attachment)]

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Niergarth, Jeffrey" <jniergar <at> ciena.com>
Cc: 8214-done <at> debbugs.gnu.org
Subject: Re: bug#8214: red hat lynx 'sort' bug?
Date: Wed, 09 Mar 2011 13:31:51 -0800
On 03/09/2011 12:47 PM, Niergarth, Jeffrey wrote:
> The 'sort' utility (no options) doesn't behave as expected:
>
> Here are the pertinent results:
>
> /fpga/OAF/HD/rtl/vhdl_wrapper/clock_monitor_synthesis.v
> /fpga/OAF/HD/rtl/vhdl_wrapper/clockmonitor_synthesis.v
> /fpga/OAF/HD/rtl/vhdl_wrapper/clock_monitor_synthesis.v IN
> /fpga/OAF/HD/rtl/vhdl_wrapper/clockmonitor_synthesis.v IN

Sounds like a locale issue.  "sort --help" says this:

*** WARNING ***
The locale specified by the environment affects sort order.
Set LC_ALL=C to get the traditional sort order that uses
native byte values.




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8214; Package coreutils. (Wed, 09 Mar 2011 21:41:02 GMT) Full text and rfc822 format available.

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

From: Bob Proulx <bob <at> proulx.com>
To: "Niergarth, Jeffrey" <jniergar <at> ciena.com>
Cc: 8214 <at> debbugs.gnu.org
Subject: Re: bug#8214: red hat lynx 'sort' bug?
Date: Wed, 9 Mar 2011 14:40:19 -0700
tags 8214 + unreproducible moreinfo notabug
thanks

Niergarth, Jeffrey wrote:
> The 'sort' utility (no options) doesn't behave as expected:

Thank you for your bug report.  However this doesn't read like a bug
in sort but a misunderstanding of how locales affect it.

> Here are the pertinent results:
> 
> /fpga/OAF/HD/rtl/vhdl_wrapper/clock_monitor_synthesis.v
> /fpga/OAF/HD/rtl/vhdl_wrapper/clockmonitor_synthesis.v
> /fpga/OAF/HD/rtl/vhdl_wrapper/clock_monitor_synthesis.v IN
> /fpga/OAF/HD/rtl/vhdl_wrapper/clockmonitor_synthesis.v IN

That is sorted in the en_US.UTF-8 locale.  In order to sort in ASCII
order you would want to set your locale to C.

The man page says:

       ***  WARNING  ***  The locale specified by the environment affects sort
       order.  Set LC_ALL=C to get the traditional sort order that uses native
       byte values.

The info documentation says:

     Unless otherwise specified, all comparisons use the character
  collating sequence specified by the `LC_COLLATE' locale.(1)

     (1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to
  `en_US'), then `sort' may produce output that is sorted differently
  than you're accustomed to.  In that case, set the `LC_ALL' environment
  variable to `C'.  Note that setting only `LC_COLLATE' has two problems.
  First, it is ineffective if `LC_ALL' is also set.  Second, it has
  undefined behavior if `LC_CTYPE' (or `LANG', if `LC_CTYPE' is unset) is
  set to an incompatible value.  For example, you get undefined behavior
  if `LC_CTYPE' is `ja_JP.PCK' but `LC_COLLATE' is `en_US.UTF-8'.

This topic comes up often over the years.

Please see this faq for more information:

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

Personally I set the following in my ~/.bashrc file.

  export LANG=en_US.UTF-8
  export LC_COLLATE=C

Bob




Added tag(s) notabug, unreproducible, and moreinfo. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Wed, 09 Mar 2011 21:41:02 GMT) Full text and rfc822 format available.

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

This bug report was last modified 14 years and 136 days ago.

Previous Next


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