Repository navigation
fix(libc): isolate byte case comparisons from the host locale - #9642
Conversation
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
jotitadev
left a comment
There was a problem hiding this comment.
Linux run. The fix holds on glibc, but on a stock Linux install the new host-locale check never runs, so guest_fnmatch passes on main too.
Machine: Linux, Ubuntu 26.04, GCC 15.2.0 (glibc), x86-64. Head e52eac7ff merged with git merge --no-commit onto current main d6eafa54d. Full build, BUILD_TESTING=ON, ANYPS5_RELINKER_ONLY=OFF, Ninja Release.
Default locales (C, C.utf8, en_US.utf8): none of the candidate names resolve. CheckCaseInsensitiveHostLocale prints No installed locale changes host byte case folding; host-locale regression skipped. The PR test with main's Strings.cpp and Export.cpp passes. Under a UTF-8 LC_CTYPE, glibc's tolower leaves bytes above 0x7F unchanged, so stock Linux does not hit the bug. On an image with only UTF-8 locales, the test cannot catch a regression on Linux.
With a Latin-1 locale (localedef -i en_US -f ISO-8859-1 <dir>/en_US.ISO8859-1, run with LOCPATH=<dir>, so the test's en_US.ISO8859-1 candidate resolves):
guest_fnmatch |
|
|---|---|
PR test, main sources |
Checking guest byte comparisons with host LC_CTYPE=en_US.ISO8859-1, then Guest byte case check failed (abort) |
| PR | Passes with the same locale; guest_posix_filesystem, guest_resolver and guest_service_database also pass |
So the change also fixes the issue on Linux when the host has a single-byte locale. Today, only a Windows run, or a Linux host with a single-byte locale installed, catches a regression.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
The core change has useful breadth: all 65,536 byte pairs are exercised for the locale-sensitive operations, with unchanged-input checks and Windows code-page coverage. I noted the report of an earlier full CTest run at a prior base with four failures that reproduce on unchanged main and this branch; please rerun the full suite on the newer base before treating overall suite status as current. The focused tests and current-main conventions are author-reported; the latest hosted conventions, eligibility, intake, labels, report, relinker, registration and write-watch jobs pass, while Linux/Windows full jobs are skipped. |
|
I checked the current implementation and the existing Linux report. The |
e52eac7 to
45d0a3b
Compare
|
Rebased onto main b7d1d47 and removed the blank lines that split the bullet lists in both debt files. |
45d0a3b to
07bec52
Compare
|
I’ve noticed that asking you to hold this PR was unnecessary. It’s fine to keep submitting PRs; maintainers will handle them in due course. |
|
Data point for the expected values here: on #9163, @JJenkx ran the AI-assisted: yes (Claude Code) |
…tles' libc.prx does strcasecmp and strncasecmp returned the folded unsigned-byte difference, following FreeBSD 11.4's strcasecmp.c (#3966, #9642). The libc.prx bundled with eleven titles returns -1, 0 or 1, the sign of that difference; both functions now do the same, and the byte-pair tests expect it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…status and reason strings Only the PR's own commit f916937 (Ocsp.cpp, its test and debt bullet); the upstream merges the PR branch carries (boykopovar#9643, boykopovar#9642, boykopovar#8622, boykopovar#9992, boykopovar#10059) are left out. Ocsp.cpp joins our multi-file source list.
What
strcasecmpandstrncasecmpused the host'stolower, and WebKit'sstrcasestrdid the same. Changing hostLC_CTYPEcould make bytes compare equal even though the guest still exposes the C locale. On Windows code page 1252, for example,C4andE4became equal.Use the existing guest case conversion for the libc comparisons and the existing ASCII folding helper for the substring search. The result difference and first-match behavior follow FreeBSD 11.4 strcasecmp.c and strcasestr.c. The debt entries retain the unmeasured console locale behavior.
Tested
Windows 11 26H2 (build 10.0.26300), WinLibs GCC 15.2.0 r7, full Release build, head 07bec52 on main d6e7ab4.
guest_strings,guest_fnmatch,guest_localeandguest_rune_localepass, 4/4.tolowerleaves bytes above 0x7F unchanged, so the host-locale check reports a skip and passes on main too. jotitadev's run with a Latin-1 locale (localedef -i en_US -f ISO-8859-1) fails on main and passes with this PR, so Linux only catches a regression when a single-byte locale is installed.tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass.tools/pr_overlap.pyand merge tests against the 103 open pull requests that touch these files find no new conflict.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)