--- Begin Message ---
Subject: |
Re: sort (coreutils) 4.5.3 |
Date: |
Thu, 26 Jun 2003 19:57:29 -0400 |
On my Red Hat Linux 9 system the LANG variable is set to
"en_US.iso885915". When using the Perl sort function I get
the correct results but when using the sort command I have to
change the LANG setting to get correct results. To get the sort
command to work I entered the following:
LANG=C sort inputfile.txt
Since the Perl sort function works correctly, is it possible that
the problem could be in the way the sort command interacts
with the LANG environment instead of the LANG environment
itself ? With Perl I did not have to change LANG; I used the
following Perl command to determine what LANG Perl was using:
print $ENV{LANG};
I am including two small files ( 10 lines each);
1. inputfile.txt - the unsorted input file
2. rhlinux_sort.txt - the output file from the Red Hat sort command
Bobby Morris
Bob Proulx wrote:
> Bobby L Morris wrote:
> > When I sorted a file with the sort command that is distributed with
> > Red Hat Linux 9, ( /bin/sort from package coreutils 4.5.3) the output
> > file was not consistent with the result obtained by using the sort
> > command
> > from another Unix system (AIX 5L). Also when I used the perl sort
> > function I got the same results as when I used AIX 5L.
>
> Thank you for your report. Thanks especially for taking the time to
> include test cases so that we had the ability to recreate the problem.
>
> However at 2.3 MB the attached files were quite a bit larger than
> should be sent without preamble. Many people read the bug list
> through slower connections and large messages such as that can cause
> quite a bit of constipation of the mail connection. In the future if
> you could reduce the size of your test case to a smaller size it would
> be most appreciated. Usually problems such as that can be illustrated
> in less than a page of text.
>
> Meanwhile, I can't recreate the trouble you describe with those files.
> Therefore I suspect this may have something to do with LANG in your
> environment. (LANG is almost always the problem with sort on RH and
> so I always suspect it.) What is your locale setting? Does changing
> it to "C" or "POSIX" correct your problem?
>
> Please read this faq, look for "Sort does not sort" for the entry in
> question.
>
> http://www.gnu.org/software/fileutils/doc/faq/
>
> See the standards documentation for more information on the locale
> variables with regards to sort.
>
> http://www.unix-systems.org/single_unix_specification_v2/xcu/sort.html
>
> You can see which locale you are configured to use with the 'locale'
> command.
>
> locale
>
> Typically this is set with the LANG variable. RH does not give you
> the option not to set this variable and therefore it surprises people
> when RH systems sort with a non-standard sort order. It is probably
> the number one reported bug in RH systems. You can unset lang to
> return to the standard default and I believe all sorting operations
> will return to what you expect.
>
> unset LANG
> locale
>
> If that is not your problem then please send another followup to the
> list. But I am pretty sure this is your problem.
>
> Bob
aeprs pares
aeprs parse
aeprss parses
aeprss passer
aeprsss passers
aeprs spare
aeprss spares
aeprss sparse
aeprs spear
aeprss spears
aeprs pares
aeprs parse
aeprs spare
aeprss parses
aeprss passer
aeprs spear
aeprss spares
aeprss sparse
aeprsss passers
aeprss spears
--- End Message ---