feat(libc): scan 16-bit wide conversions on Linux #5285
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5285"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Nixitov on 2026-10-13T16:31:42Z.
What
On Linux the scanf family threw for the 16-bit wide conversions (
%ls,%lc,%l[,%S,%C) because glibc would store a 32-bitwchar_tper character into the guest's 16-bit buffer.vsscanf/sscanfnow scan them here instead:%ls,%Sand%lc,%Cdecode the input's UTF-8 into the guest's 16-bit buffer independently of the host locale, as the narrow printf family already encodes wide arguments; a code point above U+FFFF becomes a surrogate pair.%l[is scanned through the host's wide scanset.ScanGuestalready does for the_sforms, so the non-wide conversions keep the host's behaviour and the wide ones no longer reach glibc'swchar_t.fscanfand the_sforms still throw for wide conversions on Linux; only the buffer scans (vsscanf/sscanf) changed.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release.
guest_wide_formattinggainsCheckScanning: wide strings, two of them, a mixed%d %ls, a field width,%lc,%n, leading whitespace, and (Linux only) accented UTF-8 and a non-BMP code point. It passes, andguest_formattingpasses.python tools/check_conventions.py --base origin/mainpasses.ScanWindows), so the Linux branch was not run locally. The behaviour is recorded indocs/dev/debt/libc.md.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T16:32:31Z.
Progress report (
016db92→d2bb74f)📈 System libraries: 88.22% (+0.03%, +1 implemented functions)
✅ 1 implemented
vsscanf_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T16:35:13Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libc/src/Formatting.cppL377, L396core/libs/prx/libc/src/Formatting.cppL11core/libs/prx/libc/src/Formatting.cppL11core/libs/prx/libc/src/Formatting.cppL374, L393, L396docs/dev/debt/libc.mdL56Imported from boykopovar/AnyPS5. Originally posted by Nixitov on 2026-10-13T17:03:26Z.
Thanks bot. This is an adjacent, same-file overlap rather than duplicated logic: this PR adds the Linux 16-bit wide conversions (
%ls,%lc,%S,%C) tovsscanf/sscanfinFormatting.cppand its test. #4966 (suppressed conversions before EOF) and #5222 (EOF stickiness) also touch the scanf code nearby.Nothing here depends on them; whoever lands second just needs a small rebase. I'm happy to rebase this after either lands, and to reconcile the input-failure/EOF return values with #5222's
ScanResultAtEndOfFileso the wide scanner follows the same rule.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:29:46Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed