bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21844: `sort` behavior unstable based on neighboring elements ?


From: Pádraig Brady
Subject: bug#21844: `sort` behavior unstable based on neighboring elements ?
Date: Fri, 6 Nov 2015 16:53:02 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

tag 21844 notabug
close 21844
stop

On 06/11/15 16:41, Mike Frysinger wrote:
> i got this bug report today about sort mismatches.  the order of the
> inputs changes the order of the outputs which surprised me.  but it
> might be a nuance of unicode collation i'm not familiar with ?
> 
> $ printf '%s\n' aarch64 abc zed | LC_ALL=nb_NO.UTF-8 sort -u
> aarch64
> abc
> zed
> $ printf '%s\n' abc aarch64 zed | LC_ALL=nb_NO.UTF-8 sort -u
> abc
> zed
> aarch64
> 
> why aren't the outputs here the same ?  a nordic user pointed out
> that aa is an alternative for å which comes after z, which is fine,
> but that doesn't explain why the output isn't the same here.
> -mike

strcoll is giving the wrong results:

$ printf '%s\n' abc aarch64 zed | LC_ALL=nb_NO.UTF-8 ltrace -e strcoll sort 
>/dev/null
sort->strcoll("aarch64", "zed")                                                
= 3
sort->strcoll("abc", "zed")                                                    
= -25

$ printf '%s\n' aarch64 abc zed | LC_ALL=nb_NO.UTF-8 ltrace -e strcoll sort 
>/dev/null
sort->strcoll("abc", "zed")                                                    
= -25
sort->strcoll("aarch64", "abc")                                                
= -1

I think this is due to:
https://sourceware.org/bugzilla/show_bug.cgi?id=18589

Fixed by:
https://sourceware.org/git/?p=glibc.git;a=commit;h=87701a58

cheers,
Pádraig.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]