Bug 430821

Summary: Sort does not sort in normal order
Product: [Fedora] Fedora Reporter: Antonio Gallardo <antonio>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 8CC: twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#Sort-does-not-sort-in-normal-order_0021
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-30 11:07:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Antonio Gallardo 2008-01-29 23:06:29 UTC
Description of problem:
sort command does not sort as expected. The following URL also describe the issue:

http://pankaj-k.net/weblog/2007/08/is_gnu_sort_broken.html

Version-Release number of selected component (if applicable):
$ rpm -q coreutils
coreutils-6.9-12.fc8

How reproducible:
If the environment variable is not set at all. LC_ALL

Steps to Reproduce:
1. Write a file called "a.txt" with the following 3 lines:
F-A
FB
F-C

2. run in shell this command:

sort a.txt

 
Actual results:
F-A
FB
F-C

Expected results:
F-A
F-C
FB

Additional info:
In the URL field there is an explanation of why this is happening. BAsically the
issue is fixed if we run it in this way:

export LC_ALL=POSIX
sort a.txt

also, it works in this way too:

export LC_ALL=C
sort a.txt

I found the issue getting the bad sort order postgresql, basically the hyphen
got ignored. I wonder if the issue is correctly reported here or if it should be
reported to another component.

Comment 1 Ondrej Vasik 2008-01-30 11:07:26 UTC
Thanks for report. As written on manpages/info pages of sort and on URL's you
have provided - GNU coreutils sort depends (and it is expected behaviour) on
locales. It is not only about LC_ALL(which will override all locales), but
mostly about LC_COLLATE and LC_NUMERIC (which you have set and probably as
en_US.UTF-8 ). Locales are part of glibc-common, so that's the only place where
the behaviour could be changed. Feel free to raise bugzilla ticket against that
behaviour (LC_COLLATE in en_US.UTF-8 and sort order) - in glibc-common. But I'm
not sure if glibc-common maintainer will be interested in changing that behaviour.
I already had several similar reports(e.g. #428679), so closing again NOTABUG.
Sorry, but I can't help in this case.