Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 186349 - sys-apps/coreutils-6.9-r1 sort --random-sort should ignore locale
Summary: sys-apps/coreutils-6.9-r1 sort --random-sort should ignore locale
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-23 17:34 UTC by michael@smith-li.com
Modified: 2008-04-26 17:05 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix for sort -R in multibyte environments. (sort-mb-random.patch,638 bytes, patch)
2008-02-04 16:16 UTC, Steffen Wolf
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description michael@smith-li.com 2007-07-23 17:34:18 UTC
I sent this bug to GNU originally, but after some back-and-forth it turns out it doesn't exist in the vanilla build, so it must be some patch we're applying. (Incidentally, Fedora 7 has the same problem.)

sort -R should randomize the order of lines given, but for some locales it doesn't.

$ 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

$ export -n LANG ${!LC*} # Unset all locale variables prior to testing
$ for locale in C POSIX en_US ja_JP zh_CN; do
> echo
> echo "Testing locale $locale"
> export LC_ALL="$locale"
> seq 1 5 | sort -R
> done

Testing locale C
4
3
1
2
5

Testing locale POSIX
1
4
2
3
5

Testing locale en_US
3
1
5
4
2

Testing locale ja_JP
1
2
3
4
5

Testing locale zh_CN
1
2
3
4
5

sort -R should ignore locales altogether.
Comment 1 Steffen Wolf 2008-02-04 16:16:00 UTC
Created attachment 142663 [details, diff]
Fix for sort -R in multibyte environments.

This patch repairs the random sorting in multibyte environments.
Created from the original sort.c sources.
Comment 2 Steffen Wolf 2008-02-04 16:18:00 UTC
The random sorting can be fixed without changing the multi-byte handling. See the patch above. This patch is only a suggestion, it should really be read carefully by whoever wrote the original i18n patches for sort.
Comment 3 SpanKY gentoo-dev 2008-04-12 19:20:59 UTC
coreutils-6.10-r2 in the tree with updated i18n patch.  please re-open if this doesnt address your issue.