Bug 148892 - sort command does not work correctly
Summary: sort command does not work correctly
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: textutils
Version: 2.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-02-16 18:36 UTC by Ben Russo
Modified: 2007-11-30 22:06 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-02-16 20:01:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ben Russo 2005-02-16 18:36:14 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

Description of problem:
file with 4 lines of content:
T.0402A.P
T.0402A.Z
T.0402.P
T.0402A.A 

run "cat testfile | sort" results:
T.0402A.A
T.0402A.P
T.0402A.Z
T.0402.P

The last line "T.0402.P" should be first.
Also tried this with "sort -d" which gives same results.
Test on RHAS3 with "coreutils" gives correct output.

Version-Release number of selected component (if applicable):
textutils

How reproducible:
Always

Steps to Reproduce:
create a file with the contents:
T.0402A.P
T.0402A.Z
T.0402.P
T.0402A.A
run "sort <filename>" or "sort -d <filename>"
incorrect output results.

Try the same steps on an RHAS3 box with coreutils and it works as expected and documented.

Actual Results:  Incorrect output was given.

Expected Results:  The last line of output should have been the first line (according to the sort documentation).  It works fine on RHAS3, but not on RHAS2.1

Additional info:

This is a problem when we have systems with scripts that we are migrating from HP or SUN systems, or when we try to upgrade from broken systems (RH7.2 and RHAS2.1) to a non-broken system and the results are inconsistent.

We have billing and accounting systems that are being affected!

Comment 1 Tim Waugh 2005-02-16 20:01:14 UTC
This is the correct sorting order for the locale you are using.  To use C locale
sorting order, use 'LC_COLLATE=C sort' or export LC_COLLATE=C in the environment.

Comment 2 Ben Russo 2005-02-16 21:49:16 UTC
Thanks Mr. Waugh, sorry for the disturbance.  I thought for sure this was
impossible that we hadn't noticed this before.

-Ben.


Note You need to log in before you can comment on or make changes to this bug.