Repository navigation
fix(libc): print unknown printf conversions and ' as titles' libc.prx does - #11907
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
I built the exact head 15b33e8e76 on Linux (GCC 12.2.0, Release) after initializing the declared submodules and configured XRandR support. The focused tests passed: guest_formatting, guest_wide_formatting, and guest_stdio_variadic (3/3). This covers the changed Linux routing as well as the narrow/wide formatter behavior. The hosted Windows/macOS and remaining platform jobs are still in progress, so I am leaving the final review decision until they complete.
|
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.
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.
|
|
A native check of #11907 (
The 37 formats cover:
With my #12627 (the wide AI-assisted: yes (Claude Code). |
15b33e8 to
8cac89f
Compare
|
Current-main qualification at Linux: guest_formatting, guest_wide_formatting, guest_stdio_variadic, each three times: 9 passes, zero skips. Public headers, conventions, whitespace, raw production libc and test builds, and the production NID patch command pass. MinGW syntax passed for Formatting.cpp, FormattingWide.cpp. Main gitlinks and relevant fixtures/helpers are preserved. No new Windows/macOS, console/reference-library, title, GPU or performance run is claimed. Earlier measurements and controls remain at their original pins. AI-assisted: yes (Codex). Immutable source, command and test evidence, SHA-256 |
|
The failing
AI-assisted: yes. |
What
Two differences from the
libc.prxthat titles ship, in how the printf family handles conversions it does not know.'is not a flag there. #3567 made'FreeBSD's grouping flag, from FreeBSD's documentation. The titles' copy treats'as an unknown conversion character:%'dprints%'dand consumes no argument. Onmain,printf("%'d|%d", 11, 22)prints11|22. On the console it prints%'d|11, so every later conversion reads a different argument.Flags on unknown conversions.
mainthrows for an unknown conversion with+, space or', or with0and a width, and for any unknown conversion in the_sforms. The wide family returns -1. The titles' copy prints%and the character:+, space,#,0and the precision;-;*still consumes itsint;_sforms behave the same.main[%-'5d]with 11[%'5d][11 ]%+5k,%05k,% k%k,%k,%ksnprintf_s%k, `%5k%k, ` %kswprintf%5k,%-04k,%+.2k%k,%k,%kBoth formatters now treat
'as a conversion character and print unknown conversions this way in every form. On Linux,RequiresGuestFormattingsends a format containing'to the guest formatter instead of glibc. Theprintf family conversionsdebt entry now states the measured rule in place of "unverified and throw".Tested
Latest Linux qualification (2026-11-02): exact head
8cac89f55a87191359f990f27952ecc1dd3cfbfeon pinned maina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8. Resolved printf debt against main while retaining the measured unknown-conversion/flag behavior and main’s new thread-exit registration entry. Production and test blobs equal the automatic integration.3 focused groups repeated three times: 9 passes, zero skips. Public headers, conventions, whitespace, raw libc/test builds and the actual production NID-patching command passed. MinGW syntax passed for Formatting.cpp, FormattingWide.cpp. No new Windows/macOS runtime, bundled-SDK reference, native title, GPU or performance claim; earlier evidence retains its historical pins.
Earlier pinned qualifications follow.
Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON. The base is #1189317c950f0a5(onmain8ff4baf).libc.prxof PPSA07923 and PPSA13934 natively.snprintf,snprintf_s,swprintforsnwprintf_s). The two titles agree on every one.'behaves the same befored u x ld f g sand after+,0or a precision.%''dprints%''d.guest_formatting:%'d|%'u|%'.2f|%'-8ld|%'+05d|%'gcheck now expects the format text, with no arguments.%'lld %'zuand%'d %lschecks are replaced by[%6'd][%-6'd]and%'d %ls|%d, with arguments valid on the console.vsnprintf_s%ycheck now expects[%y][%k ]instead of a throw.guest_wide_formatting:CheckGroupingFlagnow expects the format text fromswprintfandsnwprintf_s, plus padded unknown conversions.swprintf%qcheck expected failure. It now expects[%q][ %q], which the titles'swprintfprints, measured on PPSA07923 and PPSA13934.guest_formatting,guest_wide_formattingandguest_stdio_variadicpass in each of 3 runs on the exact head15b33e8e76.WindowsFormatting.hpp,Formatting.cppandFormattingWide.cppand these tests,guest_formattingandguest_wide_formattingabort (exit 0xc0000409).guest_stdio_variadicpasses there too.python tools/check_conventions.py --base origin/mainandgit diff --checkpass.guest_formatting,guest_wide_formattingandguest_stdio_variadicpass 3/3 (review). That covers theRequiresGuestFormattingrouting change.%right at the end of a format still throws, since the console reads past the terminator there.Checklist
main; no other open PR implements the same functions. Stacked on fix(libc): ignore printf length modifiers that do not apply, as titles' libc.prx does #11893, which is based onmain8ff4baf534; it will follow fix(libc): ignore printf length modifiers that do not apply, as titles' libc.prx does #11893's rebase onto currentmainNotImplemented_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)AI-assisted (Claude Code).