GNU bug report logs - #6007
locale sort ordering confusion

Previous Next

Package: coreutils;

Reported by: "Vito Di Blas" <vito.diblas <at> libero.it>

Date: Thu, 22 Apr 2010 21:45:03 UTC

Severity: normal

Tags: moreinfo

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eric Blake <eblake <at> redhat.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#6007: closed (sort command in Fedora10)
Date: Thu, 22 Apr 2010 22:29:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 22 Apr 2010 16:28:08 -0600
with message-id <4BD0CD78.2050304 <at> redhat.com>
and subject line Re: bug#6007: sort command in Fedora10
has caused the GNU bug report #6007,
regarding sort command in Fedora10
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
6007: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6007
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: "Vito Di Blas" <vito.diblas <at> libero.it>
To: <bug-coreutils <at> gnu.org>
Subject: sort command in Fedora10
Date: Thu, 22 Apr 2010 23:34:07 +0200
[Message part 3 (text/plain, inline)]
Dear  Friends, in Linux Fedora10,  I sort the file aaa.txt :

Cari figliozzi
Cari figlipucci
Cari figli, oggi
Cari figli, ieri
Cari figli, domani
Cari figli, pregate
Cari figlioli

with the command:

<...>    sort  < aaa.txt  >  bbb.txt

and I obtain the  file bbb.txt

Cari figli, domani
Cari figli, ieri
Cari figli, oggi
Cari figlioli
Cari figliozzi
Cari figli, pregate
Cari figlipucci


which doesn't look sorted according to my expectation.
Then, in WindowsXP, I sort again the file aaa.txt with the command:

<...>    sort  aaa.txt  > ccc.txt

and I get the file ccc.txt :

Cari figli, domani
Cari figli, ieri
Cari figli, oggi
Cari figli, pregate
Cari figlioli
Cari figliozzi
Cari figlipucci

which looks sorted as expected.
Should  I  use in Fedora some sort option or I met a bug?
Thanks for your attention and best regards

Vito Di Blas   Ivrea  Italy
vito.diblas <at> libero.it



[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Eric Blake <eblake <at> redhat.com>
To: Vito Di Blas <vito.diblas <at> libero.it>
Cc: 6007-done <at> debbugs.gnu.org
Subject: Re: bug#6007: sort command in Fedora10
Date: Thu, 22 Apr 2010 16:28:08 -0600
[Message part 6 (text/plain, inline)]
On 04/22/2010 03:34 PM, Vito Di Blas wrote:
> and I obtain the  file bbb.txt
> 
> Cari figli, domani
> Cari figli, ieri
> Cari figli, oggi
> Cari figlioli
> Cari figliozzi
> Cari figli, pregate
> Cari figlipucci
> 
> 
> which doesn't look sorted according to my expectation.

Not a bug, if you are in a locale where the collating order discards
punctuation and whitespace as insignificant.

> Then, in WindowsXP, I sort again the file aaa.txt with the command:
> 
> <...>    sort  aaa.txt  > ccc.txt
> 
> and I get the file ccc.txt :
> 
> Cari figli, domani
> Cari figli, ieri
> Cari figli, oggi
> Cari figli, pregate
> Cari figlioli
> Cari figliozzi
> Cari figlipucci

This is due to a difference in the default locales of your two systems.
http://www.gnu.org/software/coreutils/faq/#Sort-does-not-sort-in-normal-order_0021

Try again with 'LC_ALL=C sort aaa.txt' to see the difference.
Personally, I have 'export LC_COLLATE=C' in my ~/.bashrc in order to
guarantee traditional sorting, while everything else continues to follow
my default locale.

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

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

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

Previous Next


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