Bug 208266 - strxfrm and strcoll do not always agree
Summary: strxfrm and strcoll do not always agree
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Baptiste Daroussin
Depends on:
Reported: 2016-03-24 19:37 UTC by Thomas Munro
Modified: 2018-09-22 03:00 UTC (History)
4 users (show)

See Also:

Test program (4.81 KB, text/plain)
2016-03-24 20:17 UTC, Thomas Munro
no flags Details
Script to run test program against all locales (148 bytes, text/plain)
2016-03-24 20:18 UTC, Thomas Munro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Munro 2016-03-24 19:37:16 UTC
The man page for strxfrm says:

"Comparing two strings using strcmp() after strxfrm() is equal to compar-
ing two original strings with strcoll()."

The PostgreSQL hackers wrote a test program to study a collation bug
on another operating system.  The test generates random strings and
checks if strxfrm and strcoll agree on their ordering, according to
each locale available on the system.  I decided to try it out on
FreeBSD and found that it passes on 10.2, but fails miserably on

The test program is here:

Comment 1 Thomas Munro 2016-03-24 20:17:48 UTC
Created attachment 168579 [details]
Test program
Comment 2 Thomas Munro 2016-03-24 20:18:17 UTC
Created attachment 168580 [details]
Script to run test program against all locales
Comment 3 Thomas Munro 2016-03-24 20:32:02 UTC
Filed as 'standards' because POSIX requires strxfrm and strcoll to agree, but please move to the correct component for libc bugs if appropriate.
Comment 4 Yuri Pankov 2017-12-05 23:54:43 UTC
This should be fixed in base r317034.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2018-09-22 03:00:49 UTC
Assign to committer that resolves (see comment 4)

If the issue is not resolved, please re-open