Repository navigation
fix(libc): follow measured wide printf behavior - #5303
Conversation
|
Which title prints |
|
I do not have title traces or Dinkumware _Printf evidence for these wide-format cases. The current evidence is FreeBSD 11.4 behavior and Linux-side tests, so I cannot claim console compatibility for %q, %D/%O/%U, unknown conversions, or a trailing %. I agree this leaves the added behavior unverified against the console; absent title or _Printf evidence, main’s throw is safer. I will avoid presenting these cases as title-required until we have that evidence. |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the fix. Blocking points:
- The console's
libc.prxformats through Dinkumware's_Printf, not FreeBSD'svfwprintf. As discussed above, neither a title nor_Printfevidence shows that%q,%D/%O/%U, unknown conversions (with width) or a trailing%behave as FreeBSD 11.4 does there; main's throw is the safe behaviour until then. Evidence that would unblock it: the relevant branches of_Printfdisassembled from a title'slibc.prx(same approach as in #3987), or a title that reaches these cases. - Once evidence exists, the branch conflicts with main in
core/libs/tests/GuestWideFormatting.cpp; it needs a rebase.
|
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.
|
Verdictstale+rebase Findings
Freshness envelope
Cross-PR ledger
|
fb98512 to
6de675e
Compare
|
The current PR description is missing the template’s |
|
Correction: Previous review flagged verdict should-fix Findings
Freshness envelope
Cross-PR ledger
|
MarcZX10
left a comment
There was a problem hiding this comment.
Replies checked — Fixes checklist line missing, no code finding
The PR body omits the template's Fixes: checklist line that a reviewer asked for, and the branch merges cleanly with current upstream/main.
What I ran
- Live head:
6de675ebf48b46bb5546a4c8a606e54ce480d08d(OPEN, matches the batch file). gh apicomments, review comments and reviews on #5303, kept only items after 2026-10-27T00:00:07Z from users other than MarcZX10 and bots.gh pr view 5303 --json body,statusCheckRollup.git show 6de675ebf48b46bb5546a4c8a606e54ce480d08d:.github/pull_request_template.md.git merge-tree --write-tree upstream/main 6de675ebf48b46bb5546a4c8a606e54ce480d08d(upstream/main926f7dd492).- Nothing was built or run.
Results
| Check | Result | Note |
|---|---|---|
| Live head | matches batch | OPEN |
PR body vs template Fixes: line |
missing | template line at .github/pull_request_template.md L16 |
merge-tree vs upstream/main |
exit 0 | clean; 716 behind, 8 ahead |
Hosted conventions |
SUCCESS | one older run CANCELLED |
Findings
- @oneandonlydean (2026-11-01 09:52 UTC) asks for
- [x] Fixes: none. Confirmed: the body's checklist has noFixes:line. Answer: agreed, add- [x] Fixes: none(this PR closes no issue). - @fogydes (2026-10-29, corrected 2026-11-01 13:30 UTC) reported a merge conflict in
GuestWideFormatting.cpp. Stale: the head now merges cleanly with upstream/main. No answer needed beyond the checklist. - @fogydes says conventions passes locally. Hosted conventions is SUCCESS at this head; the local run was not repeated.
- @fogydes lists overlaps with #11214 and #11907 (both OPEN). Not re-run here; not verified.
- The measured PS5 behaviour for
%q,%D/%O/%Uand unknown conversions is author-reported. Not verified here.
Sources
AnyPS5/.github/pull_request_template.md
Line 16 in 6de675e
Not verified
…t in the wide printf family The wide printf family rejected the q length modifier, the D, O and U conversions, unknown conversion characters and a format ending in a percent sign, which FreeBSD 11.4 vfwprintf formats: q is long long, D, O and U are the long forms of d, o and u, an unknown conversion character prints itself with the width and the - flag, and the format ends at a trailing percent sign. swprintf, vswprintf and wprintf now do the same; snwprintf_s keeps rejecting them.
…te pair whole as an unknown conversion snwprintf_s accepted the q length modifier through the shared parser and now rejects it again. An unknown conversion character that is a surrogate pair is printed as one character, so the width padding no longer splits the pair.
6de675e to
9ff570b
Compare
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release.
The same test passes on AI-assisted: yes. |
|
Hi @MarcZX10 @adriadam10,
One change fixes it. Let every unit from 0x80 up count as an unknown conversion: } else if (conversion == u'S' || conversion >= 0x80 || !std::strchr(LibcDetail::KnownConversions, static_cast<char>(conversion))) {With that line, and nothing else changed, the whole of Could one of you add it and run the test on your side? We'll re-review once it is pushed. |
What
Updates non-secure guest wide
printfformatting to match the measured literal-text behavior for%q,%D/%O/%U, unknown conversions, and width handling observed fromlibSceLibcInternal.sprxon firmware 12.70. The probe calledswprintffrom a payload process; it did not exercise a title or its bundledlibc.prx, whose Dinkumware_Printfbehavior remains unverified. The probe also showed that a trailing%read past the format terminator, so incomplete conversions continue to fail safely. The securesnwprintf_spath continues to reject these forms because its console behavior was not measured.The original implementation commits retain Hussein Kadhim as author, and the original test commits retain MarcZX100. The review follow-up is authored by MarcZX10.
Tested
6de675ebf48b46bb5546a4c8a606e54ce480d08dis based onmain0e9dc7bc4c9755c3ce803f6bbdff9dc9f25d68bb; the existing authored commits were preserved.git diff --check, the conventions/template check, and the merge preview passed.pr_test_quality.pyemitted a possible-unregistered C++ test warning. Inspection ofcore/libs/prx/libc/CMakeLists.txtconfirms thatguest_wide_formatting_testsis registered with CTest asguest_wide_formatting.06bd24679818bec01461f191fec3e6d745ca88b6builtguest_wide_formatting_testsand passedctest -R guest_wide_formatting --output-on-failure(1/1). Build and CTest were not rerun after rebasing.libc.prxruntime test, Windows build or full test suite was run.Checklist
main; no other open PR implements the same wide-format functions.mdfiles or images added to the repository