Repository navigation
Conversation
Merging this PR will not alter performance1 warning, 1 note
Comparing Footnotes
|
|
needs to be rebased and you should look at the perf regression please |
sort only uses the ICU collator in UTF-8 locales other than C/POSIX, but comm and join asked should_use_locale_collation(), which only looked at the locale name. Under a locale like en_US or ru_RU.KOI8-R, sort wrote lines in byte order and comm/join read them back with the collator, so lines present in both files were reported as unshared. Make should_use_locale_collation() also require a UTF-8 encoding, and have init_locale_collation() use it, so there is one answer to "does this locale collate?". Fixes uutils#15802 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4dcbf78 to
9f3eb59
Compare
sort only uses the locale collator when the locale is UTF-8 (and not C/POSIX), but comm and join decided with
should_use_locale_collation(), which only checked that the locale name isn't C/POSIX. So withLC_ALL=en_USorru_RU.KOI8-R, sort wrote byte order, comm/join compared with the collator, and lines in both files were reported as unique to each.should_use_locale_collation()now also requires a UTF-8 encoding, andinit_locale_collation()calls it instead of repeating the check, so sort, comm, join and ls all get the same answer. ls doesn't change in practice: in non-UTF-8 locales it already fell back to byte comparison.Tests use the example from the issue in comm and join, under
en_USandru_RU.KOI8-R. The locale is read fromLC_ALL, so they don't need it installed and run on every platform.Closes #15802
I used Claude to help with this change. I've gone through the diff and ran the comm, join, sort and ls tests, fmt and clippy myself.