Bug 1055597
Summary: | sort produces incorrectly ordered results | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Tom Hughes <tom> |
Component: | coreutils | Assignee: | Ondrej Oprala <ooprala> |
Status: | CLOSED DUPLICATE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 20 | CC: | admiller, bugzilla, kdudka, kzak, ooprala, ovasik, pblaho, pbrady, 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: | 2015-01-16 03:36:51 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Tom Hughes
2014-01-20 15:26:52 UTC
Seems to be related to the i18n patch. With LC_ALL=C I'm getting the same output as you expect. (Used locales and --debug output is usually useful for sort reports) Locale is en_GB.utf8 if that helps. Another example. Inputfile is /tmp/a-a containing four lines with three tab-separated columns of which the middle one has these values: AA AAA A A A $ cat /tmp/a-a 2 AA E 3 AAA E 1 A E 0 A A E $ cut -f2 /tmp/a-a | sort A AA A A AAA $ cut -f2 /tmp/a-a | sort --debug sort: using ‘en_US.UTF-8’ sorting rules A _ AA __ A A ___ AAA ___ $ cut -f2 /tmp/a-a | sort --debug -r sort: using ‘en_US.UTF-8’ sorting rules AAA ___ A A ___ AA __ A _ All looks normal and is properly sorted till this far. Now sort the file with the three columns, the middle one being the key to sort. '$TAB' has the value of a real Tab character (^I). $ TAB=" ";echo x"$TAB"x x x $ < /tmp/a-a sort -t "$TAB" -k 2,2 3 AAA E 0 A A E 2 AA E 1 A E $ < /tmp/a-a sort -t "$TAB" -k 2,2 -r 1 A E 2 AA E 0 A A E 3 AAA E $ < /tmp/a-a sort -t "$TAB" -k 2,2 -i 1 A E 2 AA E 0 A A E 3 AAA E $ < /tmp/a-a sort -t "$TAB" -k 2,2 --debug sort: using ‘en_US.UTF-8’ sorting rules 3>AAA>E ___ _______ 0>A A>E ___ _______ 2>AA>E __ ______ 1>A>E _ _____ More info: $ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= $ type sort sort is hashed (/usr/bin/sort) $ rpm -qf /usr/bin/sort /usr/share/i18n/locales/en_US coreutils-8.21-21.fc20.x86_64 glibc-common-2.18-12.fc20.x86_64 The problem has been resolved for me in Fedora 21 with $ rpm -qf /usr/bin/sort /usr/share/i18n/locales/en_US coreutils-8.22-19.fc21.x86_64 glibc-common-2.20-7.fc21.x86_64 Agreed that this seems to be correct in F21. *** This bug has been marked as a duplicate of bug 1003544 *** |