Repository navigation
fix(libc): print %C, %S and a zero %lc in the printf families as titles' libc.prx does - #12397
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
The measured narrow-format behavior is well evidenced, but two parts of this diff remain unsettled:
-
KnownConversionsno longer containsC, andFormatWindowsnow prints%Cwithout taking an argument, butNumberedArgumentClassesstill classifiesCas an integer conversion ("diouxXcCsSpn"). It eagerly fetches all classified positional arguments inFormatArguments::NumberbeforeFormatWindowshandles the conversion. Thus a positional%1$Cis still treated as requiring/fetching an argument even though the measured narrow%Cconsumes none; the existing positional test was changed to avoid this case and the PR says positional%Cis unmeasured. Please removeCfrom that classifier or make positional%Cfail conservatively until measured, and add a regression that pins the chosen behavior. -
The hardware comparison described here calls the titles’
snprintfNID. The diff also changes the separateFormatWide/swprintfpath: it now ignores previously rejected lengths and prints unknown conversions rather than throwing.GuestWideFormattingtests encode these new outcomes, but I could not find a title-sideswprintfcomparison or other source for them. Please provide that evidence, or keep the wide changes at their previous conservative behavior and record the remaining wide-format gap as debt until measured.
Exact-head diff check, conventions, and test-registration checks pass (202 scripts). The Windows title-side and formatter evidence in the PR is useful for the narrow path; hosted checks for this head are still pending. I have not approved.
MarcZX10
left a comment
There was a problem hiding this comment.
Follow-up on exact head 0e1fc1e540baf0a466f8068839967b8b4599cedc. The new title-side swprintf comparison addresses my earlier wide-format evidence request. Two issues remain:
-
In
core/libs/prx/libc/include/WindowsFormatting.hpp,KnownConversionsnow excludes uppercaseC, soFormatWindowsprints%Cwithout consuming an argument, butNumberedArgumentClassesstill classifiesCas an integer in"diouxXcCsSpn".FormatArguments::Numbereagerly fetches every classified positional argument before formatting. Thus a positional%1$Cstill reads an argument even though%Cis handled as non-consuming; the changed positional test avoids this case. Please removeCfrom that classifier (or conservatively reject positional%C) and add a regression that pins the intended no-consumption behavior. -
This update adds
ApplicableLengthbehavior for unsupported length/conversion combinations in both narrow and wide formatting (%Ld,%hhc,%hf,%hp,%Ln, etc.). The PR's stated title comparisons cover%C,%lc,%Sand unknown conversions, but I don't see a title-side measurement for those ignored-length cases. Unit expectations alone don't establish console behavior. Please provide matching title-side evidence for the new length cases and updateTested, or keep this change limited to the measured conversions and retain the previous conservative behavior for unmeasured combinations.
I have not run the formatter binaries locally: this worktree has no configured build tree, and the registration audit only confirms that 202 test scripts are registered. git diff --check, conventions and the script-registration audit pass. Hosted checks are pending; I am not approving.
|
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.
|
|
@MarcZX10 Fixed the positional Linux x86-64, Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release: all four groups ( The ignored-length cases are inherited from #11893, rather than introduced here: exact head AI-assisted: yes (Codex). Exact patch, source/dependency proofs, inherited measurements, original/test-only/fixed logs and JUnit, SHA-256 |
MarcZX10
left a comment
There was a problem hiding this comment.
Follow-up on the new head : the positional-argument issue is fixed. Removing from and the new // regressions now match the stated non-consuming unknown-conversion behavior.
The other evidence gap remains: this PR changes for unsupported length/conversion combinations in both narrow and wide formatting. The title-side examples listed in the body cover // and /, but not combinations such as , , , or . The unit expectations alone do not establish the titles' behavior for these newly accepted formats. Please add title-side comparisons for the behavior being changed, or keep the previous conservative error path for combinations without evidence and cover the measured cases with regressions. I did not run the formatting binaries locally; the added regression source has not been executed in this review. No approval.
|
Correction to my immediately preceding review: shell quoting removed inline code tokens from the posted text. The intended content is: On head d017d6a, the positional-argument issue is fixed: uppercase C is removed from NumberedArgumentClasses, and the new positional %C regressions cover non-consumption. The separate evidence gap remains. ApplicableLength now changes unsupported length/conversion handling in narrow and wide formatting. The title-side examples in the PR body cover %hC, %lC, %#C, %hS and %lS, but do not cover combinations such as %Ld, %hhc, %hf, %hp or %Ln. Unit expectations alone do not establish title behavior for those newly accepted formats. Please add title-side comparisons for the changed behavior, or retain the prior conservative error path for combinations without evidence and add regressions for measured cases. I did not run the formatting binaries locally. No approval. |
|
@MarcZX10 I have now inlined the existing title-side length table directly under Tested, including AI-assisted: yes. |
|
@JJenkx the measurements are clear (libc.prx of two titles loaded natively, snprintf/swprintf called by NID eLdDw6l0-bU / nJz16JE1txM side by side, before/after counts) and the two own commits read correctly. One code bug and two debt points:
|
|
I rechecked the new head One documentation item from the #oneandonlydean review remains: the libc debt entry should state that positional |
|
@oneandonlydean thanks for the careful read.
AI-assisted: yes (Claude Code). |
|
Linux run at this PR's exact head Arch Linux, kernel 7.2.9, Ryzen 9 7950X, g++ (GCC) 16.2.1 20260810, glibc 2.44, x86-64. Release,
The PR conflicts with current |
|
Two cases the
If the bytes-not-characters reading is what the titles' |
boykopovar#12397 makes the wide formatters print %S literally as titles' libc.prx does, so this entry no longer states the old difference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — new head, looks good
The new head resolves the debt-file conflict, preserves the measured formatting changes, and includes an exact-head Windows rerun with a negative control.
What I ran
- Reviewed head
078102a03f127cd5dee128d1244195d4034916e4against currentmaindfcc0e17cb254d08fec9ec120e362620795d59a0; the merge preview is clean. - Compared current-main changes since the author's integrated base
95137178d026with the PR file list; no PR files changed in that interval. - Ran
git diff --check upstream/main...refs/remotes/review/pr-12397; it passed with no output. - Read the author's Windows 11 focused formatting rerun and negative-control report on this head. I did not run a local compiler or formatting tests.
git fetch upstream main
git merge-tree --write-tree upstream/main refs/remotes/review/pr-12397
git diff --name-only 95137178d026..upstream/main
gh pr view 12397 -R boykopovar/AnyPS5 --json files --jq '.files[].path'
git diff --check upstream/main...refs/remotes/review/pr-12397
gh pr checks 12397 -R boykopovar/AnyPS5Results
| Check | Result |
|---|---|
Merge preview against current main |
Pass; clean tree 1f79a818608bd391470cb8472eac564da0f1e637 |
| Main-path comparison since reported test base | No changed PR files |
| Diff check | Pass; no output |
| Hosted conventions, eligibility, labels, and report | Pass |
Author-reported Windows guest_formatting and guest_wide_formatting |
Pass 3/3 each on exact head |
| Hosted Windows and other platform checks | Pending; hosted Linux product job is skipped |
Unedited command output
1f79a818608bd391470cb8472eac564da0f1e637
conventions pass 15s https://github.com/boykopovar/AnyPS5/actions/runs/40880903467/job/123471831507
labels pass 8s https://github.com/boykopovar/AnyPS5/actions/runs/40880903392/job/123471830652
report pass 49s https://github.com/boykopovar/AnyPS5/actions/runs/40880911891/job/123471857888
eligibility pass 7s https://github.com/boykopovar/AnyPS5/actions/runs/40880911911/job/123472024744
windows pending 0 https://github.com/boykopovar/AnyPS5/actions/runs/40880911911/job/123476310032
linux skipping 0 https://github.com/boykopovar/AnyPS5/actions/runs/40880911911/job/123476312636
Negative control
| Assertion | Change made to code under test | New test failed? |
|---|---|---|
| The measured narrow/wide conversion cases differ from main as reported | Replaced the three changed formatter sources with main versions while keeping the tests | Yes; author-reported |
Findings
Blocking
None found in the reviewed head.
Non-blocking
The exact-head focused Windows run is author-reported, not independently reproduced. Hosted product Windows is still pending; Linux product tests are skipped.
Sources
- Formatter and regression tests at the reviewed head
- Author's exact-head Windows rerun and negative control
- Performance report requirements at the reviewed head
Not verified
I did not independently run Linux, macOS, console, or firmware formatting tests, and I did not rerun the GTA/reference comparisons. The author's Windows run and title observations are reported evidence.
Correction — exact-head Windows report linkThe Windows rerun citation in my review used the wrong comment ID; the report is here. |
|
Integrated current New head: Linux Release: This is current-main Linux integration and Windows cross-compilation syntax evidence. Earlier actual Windows/title-library measurements retain their historical pins; no new Windows runtime, macOS, title, GPU or performance result is claimed. AI-assisted: yes. Evidence: immutable Linux qualification bundle. Its SHA-256 is |
…es' libc.prx does
078102a to
4816b33
Compare
|
Current-main qualification at Linux: guest_formatting, guest_wide_formatting, guest_stdio_variadic, guest_crt, file_streams, each three times: 15 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 |
|
Current-main integration — 2026-11-04. Head Linux x86-64, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON: rebuilt actual libc/Ampr and selected executables. Source/parent/gitlink proofs, library/test hashes, raw logs/JUnit and head-leased push receipts: qualification archive, SHA-256 |
✅ AMD GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (10, not counted against this PR)Validation IDs already present on main (8 IDs in 803 tests)Skipped (62)ReproduceAutomated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Refreshed to Fresh Linux GCC16.2.1 Release qualification: actual libc CMake owner, relevant dependencies and fixtures build; four focused suites each pass three repetitions (12 passes, zero skips). Pinned main passes all eight selected suites three times (24 passes). Public-header audits pass for main and both branches; conventions and whitespace checks pass. Module selection is checked with Source diffs, scoped build recipes, complete build/test/JUnit logs, header audits and regression controls, SHA-256 |
Brings in main 495b960. The only conflict was docs/dev/debt/libc.md; it keeps main's entries and re-applies this branch's two debt edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Refreshed onto current
Windows check of AI-assisted: yes. |
The merge of main dropped this branch's edit to the entry: the plain forms also ignore any length on %S (ApplicableLength), as the formatting tests check. Co-authored-by: JJenkx <josh_jenkins@hotmail.com>
|
Hi @JJenkx, Thanks for refreshing this against main. Your merge kept the main wording of the "printf length modifiers" entry in |
|
Linux check of exact head
AI-assisted: yes |
Current refresh: head
51f8ea279c7dd2391fd39e4265579bb45b604b01includes main151a2cb6e274; scoped Linux CPU tests12/12, main24/24, public headers and regression controls pass. Current evidence is in the refresh comment; earlier platform reports retain their original pins.What
Titles' own
libc.prx(PPSA07923 and PPSA05916 agree on every row) prints these narrowprintfconversions differently from here:%C0xe9%C(2 bytes), no argument takené(as%lc)%5C|/%-3C|0xe9%C|/%C |é|/é |%hC,%lC,%#C0xe9%C%hC,%lC)%C%d65%C65Aand the next argument%lc0%3lc|0|: the width is ignored%hS|,%lS|u"aé€"%SSo
%Cis one of the unknown conversions this library already prints as%and its letter, padded to the width, without taking an argument (#11907). The change:CleavesKnownConversions;ApplicableLengthdrops the length ofS;%lcof 0 writes nothing.%lsand%Sretain their previously measured handling. The%lcadapter now ignores precision before writing the whole UTF-8 sequence and keeps byte-based field width: for U+00E9,%.1lcwritesc3 a9, and%5lcwrites three spaces followed byc3 a9. A zero wide character still writes nothing, including width/precision combinations.swprintf(second commit): in the titles' wide formatter neither%Cnor%Sis a conversion, with or without a length.%C|%5C|%hC|%S|%-3S|%lS%dwith 7 prints%C| %C|%C|%S|%S |%S7. Here both formatted their argument as%lc/%ls; they now take #11907's unknown-conversion path.%lc,%ls,%hsand valid UTF-8%salready matched. A wide%cor%sof bytes from 0x80 up is handled by #9964 and #9953, not here.One existing check changed:
"%2$ls|%1$C|%3$d"expected%1$Cto printA. Positional%Cwasn't measured, so that check now uses%1$lc; its purpose (a positional wide argument) is unchanged.Tested
Current-main integration — 2026-11-04. Head
c9d920d13a54745eba08af179a5cba8a8421eb85includes mainb11c7bf84f5d2f636ff60166cc3371bd071e24d5and preserves previous public commits and attribution/licence notices. Retains the measured nonconsuming%C/literal%Sbehavior and main’s newer invalid multibyte character guard. The former #11907 prerequisite is now merged.Linux x86-64, GCC 16.2.1, Ninja Release, BUILD_TESTING=ON: rebuilt actual libc/Ampr and selected executables.
guest_formatting,guest_wide_formatting,guest_stdio_variadic,guest_wide_conversioneach pass 3/3 (12 runtime passes, zero skips);public_headers, conventions and whitespace checks pass. Pinned main passes all 17 selected baseline groups 3/3 (51 passes) plus headers. Before/after dependency checks agree: 34 recursive trees and 31,551 tracked blobs, zero errors; the update=none QuickJS test262 corpus is explicitly excluded from these library inputs.Source/parent/gitlink proofs, library/test hashes, raw logs/JUnit and head-leased push receipts: qualification archive, SHA-256
7c347f620951ad6f39068740750949212c6412815da094a46a96eca1d15c8bbf(download verified). Older platform, stress, negative-control and reference reports retain their original pins; no new Windows/macOS, full-suite, SDK-module, console, title/GPU or performance claim. AI-assisted: yes (Codex).Earlier dated qualifications below retain their original source/platform pins.
Latest Linux qualification (2026-11-02): exact head
4816b33918cad6ec1bd9b963aecea143f27fac49on pinned maina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8. Uses the actual updated #11907 parent. Preserves measured narrow/wide %C/%S and length behavior, main’s UTF-8 helper/error handling, all added main fixtures and both sets of child regressions.5 focused groups repeated three times: 15 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.
Current-main Linux integration at
464a7f3e28988bf785c2ac267f883843699a8006: merged mainbc3e33f4e334996ab9ba5cbf8544942465be18f3and rebuilt the actual libc plusguest_formatting,guest_wide_formatting,guest_stdio_variadic,guest_scan_count. Each suite passes three consecutive executions (12 passes, zero skips). Conventions and diff checks pass. The libc debt conflict is resolved by retaining the updated printf description and main’s newasinhentry. Published by a normal fast-forward, retaining the previous public head as an ancestor. The latest-mainba5b5330b3merge preview is also clean; the executed build remains pinned tobc3e33f4e3. Earlier Windows/title-reference measurements below retain their original pins; this is not a new Windows or SDK-oracle run.Raw integrated-source proof, test/JUnit logs and commands, SHA-256
54e3d599fbfc9317fe9d88d713a7fa2516d887652579c710df445cc44aba098c(download verified). AI-assisted: yes (Codex).Earlier qualification at the original pins:
Exact follow-up head
41cfd4560a227a30c4848186ba6b8568998835e6:guest_formatting,guest_wide_formatting, andguest_safe_errorsrepeated three times: 9 executions per host.snprintf_sandsprintf_sreplays each match48 rows against both references. Windows replay coverssnprintf; its focused suite also checks shared safe-formatting behavior.%5lc/U+00E9 is five bytes: three spaces plus the two-byte character. The fix preserves this measured behavior while removing precision truncation.Probe sources, raw rows, both-host logs, JUnit, patch and negative controls, SHA-256
082d9f9ec17d5afc4ebe582699b77cebf45d5529d2b9a72b0813990e0aa34468(download verified). References ran on Linux, not a console; other locales/SDKs and native-title effects remain unverified. This qualifies the published PR branch, not a current-main integration; the separate rebase refresh remains outstanding. No FPS claim.Inherited title-side length comparisons (#11893, unchanged here). These are the earlier Windows-host calls into the bundled
libc.prxfrom PPSA07923 and PPSA13934, not new PS5 measurements. Both title libraries gave the following outcomes for the narrow and wide cases listed in #11893's Tested section:%Ldof the 32-bit0x89abcdefpattern-1985229329(int, notlong long)%hhcof0x44D%hfof1.51.500000%hpof pointer0x12341234a%Lnintcount of 1; the adjacent bytes remain unchangedThe parent report's narrow matrix covers
Lond/i/u/x/X/o/n, every length onc/s/n, the listed floating-length combinations andh/hh/ll/L/zonp; its explicitswprintfset is%Ld %Lx %hf %zg %hp %Lp %hhc %Lc %hhs %Ls %hs %Ln. Each new expectation was checked against both bundled libraries. #11893's follow-up tests use the matchingint/guarded-intargument types.The actual parent is updated #11907
8cac89f55a87191359f990f27952ecc1dd3cfbfeon maina4eca2a056bf3bbbec98ab42e9d28163e4ea9cb8. Earlier #11893/#11907 pins below describe historical measurements, not ancestry claims for this linear rebase. Against #11907, this PR adds onlyStoApplicableLength's pointer-like case; the%Ld/%hhc/%hf/%hp/%Lnbehavior is inherited unchanged. The%hS/%lSmeasurements for this PR remain separately listed above. Positional formats remain a CPU regression check, rather than a new title-side measurement.Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON, on #11907's head15b33e8e76.libc.prx: I loaded PPSA07923's and PPSA05916'slibc.prxnatively and called theirsnprintfby NID (eLdDw6l0-bU) side by side with this build. Over 31 format/argument pairs (the table above, plus%ls/%lc/%Swith units 0x7F to 0xFFFF, lone surrogates and precisions 1 to 4), comparing the return value,errnoand the output bytes:%Cand a zero%lc); the other 14 hit 2 more differences (%5C,%-3C) and then abort at%hC;swprintfagainst the titles (NIDnJz16JE1txM), 28 pairs: the 11%C/%S/unknown-conversion differences go to 0; the 6 left are the high-byte%c/%srows that fix(libc): convert a wide printf %c like btowc, as titles' libc.prx does #9964 and fix(libc): decode a wide printf %s as titles' libc.prx does, failing on invalid UTF-8 #9953 cover. Negative control: with fix(libc): print unknown printf conversions and ' as titles' libc.prx does #11907'sFormattingWide.cpp,guest_wide_formattingfails.guest_formatting,guest_wide_formatting,guest_stdio_variadicandguest_scan_countpass in each of 3 runs.WindowsFormatting.hpp,guest_formattingfails.Not tested on Linux or macOS. On Linux,
RequiresGuestFormattingalready sends formats with%Cand%lcto the same formatter, and now%hS/%lStoo, sinceApplicableLengthchanges their length.Overlap:
tools/pr_overlap.pylists the PRs that overlap #11893 and #11907, whose commits come first here. For this commit's own lines it reports only #11733 and #11737, which add debt entries next to the narrow-printf one; neither edits that entry.Review correction and inherited evidence (2026-10-28)
@MarcZX10 Fixed the positional
%Cargument read ind017d6a6a4da133ee82577db92df03abaa5d4b66.Cis now absent fromNumberedArgumentClassesas well asKnownConversions. The regression uses%1$C,%2$C,%1$hCand padded%1$5Cwith validVaListdescriptors whose unused argument-storage pointers are null, checking both register and overflow paths, the output and that the caller's descriptor is unchanged.%1$C%dwith one integer must print%C7.Linux x86-64, Arch Linux 7.2.9, Ryzen 9 7950X, GCC 16.2.1, Ninja Release: all four groups (
guest_formatting,guest_wide_formatting,guest_stdio_variadic,guest_scan_count) pass three times on the original reviewed head and three times on the fixed head (12/12 each, zero skips). With only the new regression and the old classifier,guest_formattingfaults on the eager argument read; the other three groups pass. Conventions and whitespace checks pass. This is CPU validation, not a new title-side measurement of positional formats.The ignored-length cases are inherited from #11893, rather than introduced here: historical head
17c950f0a54f8e44ec1e7561034ab6d7086ef824supplied the measured basis through #11907 at15b33e8e763cc814c74aa122a83b34c8cf8fe25e. #11893's Tested section records the earlier Windows comparisons with PPSA07923 and PPSA13934: the narrow length matrix, plus wide%Ld %Lx %hf %zg %hp %Lp %hhc %Lc %hhs %Ls %hs %Ln. Comparing this PR with #11907 changesApplicableLengthonly forS, whose%hS/%lSmeasurements are already listed here. The inherited length behavior and its secure-format debt remain intact.AI-assisted: yes (Codex).
Exact patch, source/dependency proofs, inherited measurements, original/test-only/fixed logs and JUnit, SHA-256
a535eeb4a7654869751db4be670d15c91bd2c9c1e0a03953ca2ee915f4bf1633. Please re-review the fixed classifier and the existing parent measurements. No new Windows, macOS or console measurement is claimed.Current Linux qualification — 2026-10-29
Integrated current
main157b02c4f1803e9d2cd757677b9a805961203fc4by normal fast-forward merge; earlier measured fixes, tests and actual parent ancestry are retained.New head:
078102a03f127cd5dee128d1244195d4034916e4. The merge is automatic. The precision/width and positional unknown-conversion regressions remain, alongside main’s tests and entry-point calls.Linux Release:
guest_formatting,guest_wide_formatting,guest_stdio_variadic,guest_scan_countpass three repetitions (12 checks), plus the public-header audit, zero skips. ActualFormatting.cppandFormattingWide.cpp, includingWindowsFormatting.hpp, pass MinGW GCC16.2.0 cross syntax checking. Conventions report zero errors; any debt-length warnings are preserved in the logs. Whitespace and recursive submodule-pointer checks pass.This is current-main Linux integration and Windows cross-compilation syntax evidence. Earlier actual Windows/title-library measurements retain their historical pins; no new Windows runtime, macOS, title, GPU or performance result is claimed. AI-assisted: yes.
Evidence: immutable Linux qualification bundle. Its SHA-256 is
ca6b35926bcc6d3f21a9650517894c86b65594e2e2b653c5c32cd1c1de89c835. No fresh Windows runtime execution is claimed; older measurements retain their recorded source pins.AI-assisted: yes (Codex).
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)