Bug 1029784

Summary: Case insensitive sort does not work in multibyte locale
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: coreutilsAssignee: Ondrej Vasik <ovasik>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: admiller, kdudka, kzak, ooprala, ovasik, p, ppisar, 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-11-13 13:46:40 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 Petr Pisar 2013-11-13 08:30:39 UTC
$ printf 'A\nB\na\n' | LC_ALL=en_US.UTF-8 sort -i
A
B
a
$ rpm -qf $(type -p sort)
coreutils-8.21-20.fc21.x86_64

This probably because of broken multi-byte patch (bug #1003544) because coreutils-8.21-16.fc20.x86_64 sorts as expected:

$ printf 'A\nB\na\n' | LC_ALL=en_US.UTF-8 sort -i
a
A
B

Comment 1 Ondrej Vasik 2013-11-13 13:23:44 UTC
Does occur even with the C locales... btw. -i doesn't mean case insensitive sort - it does mean "ignore nonprinting characters". I think you want -f option, which seems to work properly.

With coreutils-8.21-20 (compiled on RHEL-6)
printf 'A\nB\na\nb\n' | LC_ALL=C ./sort -i
A
B
a
b

printf 'A\nB\na\n' | LC_ALL=C ./sort -f
A
a
B

printf 'A\nB\na\n' | LC_ALL=en_US.UTF-8 ./sort -f
A
a
B

For me, it looks more like something was fixed than broken. Can you confirm?

Comment 2 Petr Pisar 2013-11-13 13:46:40 UTC
God damn! I lived in a lie until now. The `-f' option works for me. I tested it  in en_US.UTF-8, cs_CZ.UTF-8 and C locales.