bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sort -R need not respect locales


From: Michael A. Smith
Subject: Re: sort -R need not respect locales
Date: Mon, 23 Jul 2007 09:00:49 -0400
User-agent: Thunderbird 2.0.0.4 (X11/20070617)

Bob Proulx wrote:
> Michael A. Smith wrote:
>> sort -R works well when LC_ALL=POSIX; however, sort -R sorts in exactly the
>> same way as sort with no options with my LANG=en_US.UTF-8 and
>> LC_CTYPE=ja_JP.UTF8 settings.
> 
> Thanks for the report.  But I cannot recreate your problem.
> 
>> Empirically, setting LANG or any LC* variable makes the -R option of
>> no effect.
> 
> Can you create a small test case that shows the problem such that you
> can share it with the mailing list?  Also what version are you
> running?  Here is what I see.
> 
>   $ sort --version
>   sort (GNU coreutils) 6.9+
> 
>   $ seq 1 5 | LC_ALL=en_US.UTF-8 sort -R
>   2
>   5
>   4
>   1
>   3
> 
> Bob

Gladly, Bob, and thanks for the quick response.

address@hidden ~ $ sort --version
sort (GNU coreutils) 6.9
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and Paul Eggert.

address@hidden ~ $ locale -a
C
en_US
en_US.utf8
ja_JP
ja_JP.eucjp
ja_JP.utf8
POSIX
zh_CN
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8

address@hidden ~ $ export | grep LANG; export | grep LC; seq 1 5 | sort -R
declare -x LANG="en_US.UTF-8"
declare -x LC_CTYPE="ja_JP.UTF8"
1
2
3
4
5

address@hidden ~ $ export -n LANG LC_CTYPE; seq 1 5 | sort -R
4
3
2
1
5

Finally, for completeness' sake, I ran the following loop:
address@hidden ~ $ for i in $(locale -a); do echo; echo $i; export LANG=$i; seq
1 5 | sort -R; done

C
3
2
4
1
5

en_US
1
2
4
3
5

en_US.utf8
1
2
3
4
5

ja_JP
1
2
3
4
5

ja_JP.eucjp
1
2
3
4
5

ja_JP.utf8
1
2
3
4
5

POSIX
2
4
1
5
3

zh_CN
1
2
3
4
5

zh_CN.gb2312
1
2
3
4
5

zh_CN.gbk
1
2
3
4
5

zh_CN.utf8
1
2
3
4
5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]