This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 249315 - sort -R is not random in a non-C locale
sort -R is not random in a non-C locale
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
:
: 249421 (view as bug list)
Depends On:
Blocks: F8Target
  Show dependency treegraph
 
Reported: 2007-07-23 13:39 EDT by Jim Meyering
Modified: 2013-03-13 16:40 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-10-29 13:34:34 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jim Meyering 2007-07-23 13:39:33 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                                                           
      
  coreutils-6.9-4.fc8

How reproducible:
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:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Pádraig Brady 2007-07-25 04:41:44 EDT
Possible fix from Andreas Schwab...

If they use the same i18n patch, then this should work (will appear soon
in openSUSE Factory):

--- src/sort.c
+++ src/sort.c
@@ -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;
Comment 2 Tim Waugh 2007-07-25 18:36:35 EDT
*** Bug 249421 has been marked as a duplicate of this bug. ***
Comment 3 Ondrej Vasik 2007-10-29 13:34:34 EDT
Change for i18n patch applied. Seems to be working correctly. Built as  
coreutils-6.9-10.fc9, closing RAWHIDE
Comment 4 Pádraig Brady 2007-10-29 14:30:49 EDT
3 months for an important bug with provided simple fix. Not great :(
I hope this fix will be in F8 at least.
Comment 5 Ondrej Vasik 2007-10-30 05:44:27 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.