Bug 1269895 - strcoll is broken on fedora 23 with LC_COLLATE=cs_CZ
strcoll is broken on fedora 23 with LC_COLLATE=cs_CZ
Status: CLOSED DUPLICATE of bug 1276711
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Carlos O'Donell
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2015-10-08 08:38 EDT by Pavel Raiskup
Modified: 2015-11-11 09:08 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-11-11 09:08:15 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Reproducer. (382 bytes, application/x-gzip)
2015-10-08 08:38 EDT, Pavel Raiskup
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Sourceware 18589 None None None Never

  None (edit)
Description Pavel Raiskup 2015-10-08 08:38:20 EDT
Created attachment 1080988 [details]

Reproducer attached, strcoll() fails to compare "config" and "choose"
in czech collation.

Actual results:

  $ tar xf reproducer.tar.gz && cd reproducer
  $ make
  gcc main.c -o reproducer

Expected results:

  $ tar xf reproducer.tar.gz && cd reproducer
  $ make
  gcc main.c -o reproducer
Comment 2 Florian Weimer 2015-10-08 09:43:40 EDT
“config“ comes before “choose” in the Czech alphabet because CH is a digraph that sorts between H and I.  We cannot fix this without breaking the expected collation order for Czech.
Comment 3 Pavel Raiskup 2015-10-08 09:53:00 EDT
Yes, but strcoll("config", "choose") returns positive number in cs_CZ, but
should return negative.  Or what am I missing here?  Have you tried the
reproducer, Florian?
Comment 4 Florian Weimer 2015-10-08 10:23:25 EDT
I cannot reproduce this:

$ cat main.c 
#include <stdio.h>
#include <string.h>
#include <locale.h>

int main()
    setlocale (LC_ALL, "");
    printf("%d\n", strcoll("config", "choose"));
    return 0;
$ gcc -O2 -Wall main.c 
$ LC_ALL=cs_CZ ./a.out 
Comment 5 Pavel Raiskup 2015-10-08 10:34:23 EDT
Well, thats weird.  I can do that on native 23 box and also in F23 mock
on F23 box.  While I'm not able to reproduce this in F22 box.

My output looks like:
 sh-4.3# LC_ALL=cs_CZ ./a.out 
 sh-4.3# cat /etc/os-release | grep PRETTY
 PRETTY_NAME="Fedora 23 (Twenty Three)"
Comment 6 Pavel Raiskup 2015-10-08 11:05:16 EDT
# from fedora 22 x86_64:
mock -r fedora-23-x86_64 --copyin /tmp/reproducer.tar.gz /
mock -r fedora-23-x86_64 --shell 'tar -xf reproducer.tar.gz && make -C reproducer'
Start: shell
make: Entering directory '/reproducer'
make: Leaving directory '/reproducer'
Finish: shell

Correctly working glibc prints:
Comment 7 Florian Weimer 2015-10-08 12:14:44 EDT
Right, I used the wrong chroot, sorry.
Comment 8 Carlos O'Donell 2015-10-08 12:33:27 EDT
I cam reproduce it in F23.

This is upstream bug 18589, and reverting Leonhard's optimization fixes the sorting.

I'll get this fixed ASAP.
Comment 9 Pavel Raiskup 2015-11-11 08:28:33 EST
Carlos, any progress on this?
Comment 10 Florian Weimer 2015-11-11 08:43:49 EST
(In reply to Pavel Raiskup from comment #9)
> Carlos, any progress on this?

I think this is being fixed via bug 1276711.
Comment 11 Pavel Raiskup 2015-11-11 09:08:15 EST
Truth, I'm not sure this is real duplicate but using updated glibc fixed
this problem to me.

*** This bug has been marked as a duplicate of bug 1276711 ***

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