Red Hat Bugzilla – Bug 249315
sort -R is not random in a non-C locale
Last modified: 2013-03-13 16:40:47 EDT
Description of problem:
sort -R does not randomize its input in a non-C locale
Version-Release number of selected component (if applicable):
$ rpm -q coreutils
For example, the following should print differences, but does not:
It produces no output.
(export PATH=/bin:$PATH LC_ALL=fr_FR.utf8; \
diff <(seq 99|sort -R) <(seq 99|sort -R))
This example works fine with straight upstream code, so the problem is probably
in the multibyte patch for sort.c.
Steps to Reproduce:
Possible fix from Andreas Schwab...
If they use the same i18n patch, then this should work (will appear soon
in openSUSE Factory):
@@ -2341,7 +2341,10 @@ keycompare_mb (const struct line *a, con
size_t lenb = limb <= textb ? 0 : limb - textb;
/* Actually compare the fields. */
- if (key->numeric | key->general_numeric)
+ if (key->random)
+ diff = compare_random (texta, lena, textb, lenb);
+ else if (key->numeric | key->general_numeric)
char savea = *lima, saveb = *limb;
*** Bug 249421 has been marked as a duplicate of this bug. ***
Change for i18n patch applied. Seems to be working correctly. Built as
coreutils-6.9-10.fc9, closing RAWHIDE
3 months for an important bug with provided simple fix. Not great :(
I hope this fix will be in F8 at least.
Sorry, I got coreutils from Pete Graner 10 days ago, so I'm trying to get it
into shape asap, but it will take some time... It will get to F8, but I don't
know if it will happen before the official release - I want to have more
troubles finished in one F8 commit/build and I don't know if I will finish it
before release date.