Repository navigation
Conversation
|
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.
|
|
Thanks bot. This is an adjacent, same-file overlap rather than duplicated logic: this PR adds the Linux 16-bit wide conversions ( 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 AI-assisted: yes |
Conflict with boykopovar#5285 (same author, same file): kept boykopovar#5291's ScanWideFile next to boykopovar#5285's code.
Since the port of boykopovar#5285 sscanf scans %ls on Linux too: %ls reads every non-white-space character, and guest_formatting no longer expects a rejection.
The scanf family threw for %ls, %lc, %l[, %S and %C on Linux because glibc would store a 32-bit wchar_t per character into the guest's 16-bit buffer. Scan them directly, decoding UTF-8 independently of the host locale as the narrow printf family does, and leave the non-wide conversions on the host.
c836266 to
d2bb74f
Compare
fscanf still threw for %ls, %lc, %l[, %S and %C on Linux. Scan them like vsscanf/sscanf, decoding the stream's UTF-8 into the guest's 16-bit buffer independently of the host locale, and leave the non-wide conversions on the host. Depends on boykopovar#5285.
|
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. |
fscanf still threw for %ls, %lc, %l[, %S and %C on Linux. Scan them like vsscanf/sscanf, decoding the stream's UTF-8 into the guest's 16-bit buffer independently of the host locale, and leave the non-wide conversions on the host. Depends on boykopovar#5285.
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)