fix(libc): format %p the way the console's libc does #7562
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7562"
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 slick-daddy on 2026-10-18T14:06:37Z.
What
Formats
%pas the console'slibSceLibcInternal.sprxdoes, measured on firmware 12.70 in #7549, instead of the FreeBSD form. That module prints bare lowercase hex with no0xprefix (0for a null pointer), ignores#,+and the space flag, counts only the digits towards the width, pads with spaces on the left (on the right for-, with zeros for0when there is no precision), treats the precision as the minimum number of digits, prints nothing for a null pointer under%.0pand acceptsl. A title does not see the0x…form on hardware.FormatPointerdrops the prefix and the two columns it took from the width, the narrow Windows formatter accepts%lp, and Linux routes%pand%lpto the guest formatter instead of glibc, which prints the FreeBSD form and(nil)for a null pointer. The wide family still refuses%lpand returns -1, because the console'sswprintfwas not measured with it.Closes #7549
Depends on: #6315
Tested
Windows 11 Enterprise 26200, MinGW-w64 GCC (WinLibs), Release. Host tests only, no title:
guest_formattingandguest_wide_formattingfail before the change and pass after it;guest_allocating_strings,guest_scan_count,guest_wide_strings,guest_strftime,guest_strings,guest_standard_streamsand its closed-stdout variant,file_streamsandguest_searchpass unchanged. The console side is #7549's own payload measurement, not re-run here, and the Linux selector was not executed on this Windows host.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)Edge cases worth reading before merge:
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T14:13:44Z.
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.
core/libs/prx/libc/include/WindowsFormatting.hppcore/libs/tests/Formatting.cppdocs/dev/debt/libc.mdcore/libs/tests/GuestWideFormatting.cppdocs/dev/debt/libc.mdcore/libs/tests/Formatting.cppcore/libs/tests/GuestWideFormatting.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/prx/libc/src/Formatting.cppcore/libs/tests/Formatting.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/prx/libc/include/WindowsFormatting.hppcore/libs/tests/Formatting.cppcore/libs/tests/Formatting.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mdImported from boykopovar/AnyPS5. Originally posted by TheTerr4 on 2026-10-18T14:59:38Z.
Windows runtime check. Windows 11 Pro 10.0.26200, Ryzen 7 7800X3D, WinLibs GCC 15.2.0 r7 (UCRT), Release.
This PR's head
536fef322merged cleanly intomain385ed71f2; the full build andlibsboth exit 0.guest_formattingandguest_wide_formattingpass, three repeated-j1runs.libc/include/WindowsFormatting.hppandlibc/src/Formatting.cpprestored tomain's versions, both tests abort (exit 0xc0000409).AI-assisted: yes (Claude Code).