fix(libc): print unknown printf conversions and ' as titles' libc.prx does #11907
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11907"
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 JJenkx on 2026-10-27T12:24:08Z.
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(onmain8ff4baf534).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 #11893, which is based onmain8ff4baf534; it will follow #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).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-27T12:29:49Z.
Review: COMMENTED
I built the exact head
15b33e8e76on Linux (GCC 12.2.0, Release) after initializing the declared submodules and configured XRandR support. The focused tests passed:guest_formatting,guest_wide_formatting, andguest_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.