From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126563 invoked by alias); 9 Sep 2015 08:13:53 -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 120238 invoked by uid 48); 9 Sep 2015 08:13:48 -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:13: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/msg00099.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=18927 --- Comment #2 from Egmont Koblinger --- Sorry, I wasn't explicit on this. I meant to modify both strcoll() and strxfrm(), in accordance with each other. That is, strcoll() never to return 0 on strings that differ, and strxfrm() never to produce the same output for different inputs. The issue was originally discovered with the "uniq" utility which omitted certain lines it shouldn't have omitted. E.g. in Hungarian for the input lines "ssz" and "szsz" it only produced one output line, causing quite a headache to the guy who discovered it. The manual of uniq explicitly states that it honours LC_COLLATE. On the other hand, this utility shouldn't care about sorting, it should only care about equalness of strings. This implicly suggests that uniq's authors assume that different strings collating as equal is a valid case and they deliberately wish to drop these variants from the output. Otherwise they could've just gone with strcmp(). (By the way I haven't checked its implementation, can't tell if it uses strcoll() or strxfrm(), but it shouldn't matter.) On the other hand, I believe this approach is error-prone, and guaranteeing different collation for unequal strings would result in a more robust locale system, with fewer unexpected user-facing behaviors. Maybe we should loop in the coreutils folks to hear their opinion. Although "uniq" probably not the only tool influenced by this. -- You are receiving this mail because: You are on the CC list for the bug.