This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug locale/18927] Different strings should never collate as equal


https://sourceware.org/bugzilla/show_bug.cgi?id=18927

--- Comment #2 from Egmont Koblinger <egmont at gmail dot com> ---
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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]