From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127425 invoked by alias); 9 Sep 2015 08:37:31 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 127017 invoked by uid 48); 9 Sep 2015 08:37:26 -0000 From: "egmont at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug locale/18927] Different strings should never collate as equal Date: Wed, 09 Sep 2015 08:37:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: locale X-Bugzilla-Version: 2.21 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: egmont at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg00101.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=18927 --- Comment #4 from Egmont Koblinger --- Going further with the example that strcoll("ssz", "szsz") == 0 (as it used to be in hu_HU): It's possible that "sort" prints multiple occurrences of these strings in mixed order. E.g. it might legally output this: szsz ssz szsz ssz ssz szsz (etc.) based on random, or stableness. In turn, when this is piped to "uniq", it might make some sense to print the first entry only (although it's still random whether that'll be "ssz" or "szsz"). Piping it to "LC_ALL=C uniq" instead wouldn't make much more sense either, its output (even the number of lines) would also be random. Trying to think of the big picture rather than the details, in my opinion this unexpected behavior should ideally be stopped at the very core, that is, in the locale implementation of strcoll() and strxfrm(), so that "sort" cannot produce the output shown above. Then there's no subsequent problem with "uniq" whatsoever. Otherwise, the only reliable way to print each line exactly once would be "LC_ALL=C sort | LC_ALL=C uniq" (or "LC_ALL=C sort -u" for short), and if you wanted to have the output sorted according to your current locale, you'd have to issue "LC_ALL=C sort | LC_ALL=C uniq | sort" (or "LC_ALL=C sort -u | sort" for short). Currently if you issue the obvious locale-dependent "sort | uniq" or "sort -u", you could never be sure whether the underlying locale's definition might cause unexpected (i.e. faulty - as seen by the user) behavior. -- You are receiving this mail because: You are on the CC list for the bug.