This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 821264

Summary: Sort multi-byte patch incompatibilities
Product: [Fedora] Fedora Reporter: Andrej Antas <cheaterblue>
Component: coreutilsAssignee: Ondrej Oprala <ooprala>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: kdudka, mail, maxamillion, ooprala, ovasik, p, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-14 21:13:39 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
patch adding multi-byte functionality tests
none
Patch to fix sort mb issues none

Description Andrej Antas 2012-05-13 12:41:54 EDT
Description of problem:
As multibyte patch contains different paths from upstream and it is hard to
track the changes in behaviour, this bugzilla will be to track found
incompatibilites && fixes in coreutils-i18n patch for sort utility.


Version-Release number of selected component (if applicable):
coreutils-8.15-8.fc18


Steps to Reproduce:
1. Call following commands with LC_ALL=C and LC_ALL=fr_FR.UTF-8 locales

a) echo -n -e "1.E\n2.M\n" | sort -h

b) echo -n -e "ABC\nABc\nAbC\nAbc\naBC\naBc\nabC\nabc\n" | sort -c -k 1,1fR

c) echo -n -e ".ABC\n.ABc.\nA.bC\nA.bc.\naB.C\naB.c.\nabC.\nabc..\n" | sort -c -k 1,1dfR

d) echo -n -e "a 2\nb 1\n" | sort -n -k1.3,1.1

e) echo -n -e "aa 2\nbb 1\n" | sort -n -k2.2,1.2

f) echo -n -e "  a 2\n  b 1\n" | sort -k1.3nb,1.3

g) echo -n -e "a c\na b\n" | sort -s +0 -1.1b

h) echo -n -e "a\t:a\na :b\n" | sort -t: -k1,1b -k2,2

i) echo -n -e "a :b\na\t:a\n" | sort -t: -k1,1b -k2,2

j) echo -n -e "a:1\nb:-\n" | sort -n -t: +1 

k) echo -n -e "b:-\na:1\n" | sort -n -t: +1

l) echo -n -e "a:1\nb:X\n" | sort -n -t: +1

m) echo -n -e "b:X\na:1\n" | sort -n -t: +1 

n) echo -n -e "axx\nb-1\n" | sort +0.1n

o) echo -n -e "b-1\naxx\n" | sort +0.1n

p) -echo -n -e "éminence\nüberhaupt\n's-Gravenhage\naëroclub\nAag\naagtappels\n" | sort -f

q) echo -n -e " 901\n100\n" | sort -k1.1,1.2nb

r) echo -n -e " 901\n100\n" | sort -k1.1b,1.2n

s) echo -n -e "b 2\nb 1\nb 3\n" | sort +0 +1nr

t) echo -n -e " 901\n100\n" | sort -k1.1b,1.2n

u) echo -n -e " 901\n100\n" | sort -k1.1b,1.2n

v) echo -n -e " 901\n100\n" | sort -k1.1b,1.2n

x) echo -n -e "_________U__free\n_________U__malloc\n_________U__abort\n"
      . "_________U__memcpy\n_________U__memset\n"
      . "_________U_dyld_stub_binding_helper\n_________U__malloc\n"
      . "_________U___iob\n_________U__abort\n_________U__fprintf\n" | sort

y) echo -n -e "A\na\n_\n" | sort 

z) echo -n -e "A\na\n_\n" | sort -f

aa) echo -n -e "a\nA\n_\n" | sort -f

ab) echo -n -e "_\na\nA\n" | sort -f

ac) echo -n -e "a\n_\nA\n" | sort -f

ad) echo -n -e "A\na\n_\n" | sort -fs

ae) echo -n -e "a\n_\n" | sort -fu

Actual results:
Results are different (or command fails)

Expected results:
Results should be same

Additional info:
mistakes found after applying attached patch (it adds multibyte tests for utilities cut, expand, fold, join, pr, sort, unexpand, uniq)
Comment 1 Andrej Antas 2012-05-13 12:49:33 EDT
Created attachment 584157 [details]
patch adding multi-byte functionality tests
Comment 2 Ondrej Oprala 2013-03-29 17:52:52 EDT
Created attachment 718177 [details]
Patch to fix sort mb issues

a) is locale-dependent and the different ordering is correct ( ',' is used in the fr locale as the comma separator instead of a '.' ). Same goes for tests n1-mb and sort-numeric-mb, which my patch fixes by correctly breaking them ;) . The failing cases (namely jklmnos) fail because of deprecated arguments and seem to work fine once rewritten to the newer form (see sort info pages for more details). All the other cases should be fixed. I also noticed that p) seemed to sort incorrectly because of wrong strcoll's return value, I'll ask glibc upstream to confirm this. [patch was written for the current rawhide version of coreutils - 8.21]
Comment 3 Fedora End Of Life 2013-04-03 15:35:53 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19
Comment 4 Ondrej Oprala 2013-08-14 15:12:10 EDT
Patch pushed to coreutils rawhide