This problem was pointed out by Victor Zandy <[EMAIL PROTECTED]>
in a recent post to gnu.misc.discuss.

The sorting behavior of the ls command has changed between
fileutils-4.0 and fileutils-4.1 (and between Redhat 7.0 and 7.1).
In my opinion, the new behavior is incorrect.  The change is not
mentioned in the documentation as far as I can tell.

A workaround is to set the environment variable $LC_ALL to "C",
but a user shouldn't have to do this.

System: i686-pc-linux-gnu

Script:
========================================================================
#!/bin/sh

#
# Obviously these pathnames won't be valid elsewhere.
#
ls4_0=/home/kst/apps/i686-pc-linux-gnu/fileutils-4.0/bin/ls
ls4_1=/home/kst/apps/i686-pc-linux-gnu/fileutils-4.1/bin/ls

mkdir /tmp/$$
cd /tmp/$$
touch .a .b .c A B C a b c

for lc_all in none C ; do
    if [ $lc_all == 'none' ] ; then
        echo 'Not setting $LC_ALL'
        unset LC_ALL
    else
        echo 'setting LC_ALL=C'
        LC_ALL=C
        export LC_ALL
    fi
    echo "using fileutils-4.0:"
    $ls4_0 -A
    echo "using fileutils-4.1:"
    $ls4_1 -A

    echo ''

done

cd /tmp
rm -rf $$
========================================================================

Output:
========================================================================
Not setting $LC_ALL
using fileutils-4.0:
.a  .b  .c  A  B  C  a  b  c
using fileutils-4.1:
a  .a  A  b  .b  B  c  .c  C

setting LC_ALL=C
using fileutils-4.0:
.a  .b  .c  A  B  C  a  b  c
using fileutils-4.1:
.a  .b  .c  A  B  C  a  b  c

========================================================================

-- 
Keith Thompson, San Diego Supercomputer Center  [EMAIL PROTECTED]
<http://www.sdsc.edu/~kst/>  Office: 858-822-0853  Fax: 858-534-5077
Cxiuj via bazo apartenas ni.

_______________________________________________
Bug-fileutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-fileutils

Reply via email to