fix(libc): follow measured wide printf behavior #5303

Merged
MarcZX10 merged 8 commits from upstream-pr/5303 into main 2026-11-12 13:26:05 +00:00
MarcZX10 commented 2026-10-13 16:46:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T16:46:28Z.


What

Updates non-secure guest wide printf formatting to match the measured literal-text behavior for %q, %D/%O/%U, unknown conversions, and width handling observed from libSceLibcInternal.sprx on firmware 12.70. The probe called swprintf from a payload process; it did not exercise a title or its bundled libc.prx, whose Dinkumware _Printf behavior remains unverified. The probe also showed that a trailing % read past the format terminator, so incomplete conversions continue to fail safely. The secure snwprintf_s path 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

  • Current rebase: head 6de675ebf48b46bb5546a4c8a606e54ce480d08d is based on main 0e9dc7bc4c9755c3ce803f6bbdff9dc9f25d68bb; the existing authored commits were preserved. git diff --check, the conventions/template check, and the merge preview passed.
  • pr_test_quality.py emitted a possible-unregistered C++ test warning. Inspection of core/libs/prx/libc/CMakeLists.txt confirms that guest_wide_formatting_tests is registered with CTest as guest_wide_formatting.
  • Head 06bd24679818bec01461f191fec3e6d745ca88b6 built guest_wide_formatting_tests and passed ctest -R guest_wide_formatting --output-on-failure (1/1). Build and CTest were not rerun after rebasing.
  • No title libc.prx runtime test, Windows build or full test suite was run.

Checklist

  • Based on current main; no other open PR implements the same wide-format functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed under technical debt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4846505194 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T16:46:28Z. --- ### What Updates non-secure guest wide `printf` formatting to match the measured literal-text behavior for `%q`, `%D`/`%O`/`%U`, unknown conversions, and width handling observed from `libSceLibcInternal.sprx` on firmware 12.70. The probe called `swprintf` from a payload process; it did not exercise a title or its bundled `libc.prx`, whose Dinkumware `_Printf` behavior remains unverified. The probe also showed that a trailing `%` read past the format terminator, so incomplete conversions continue to fail safely. The secure `snwprintf_s` path 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 - Current rebase: head `6de675ebf48b46bb5546a4c8a606e54ce480d08d` is based on `main` `0e9dc7bc4c9755c3ce803f6bbdff9dc9f25d68bb`; the existing authored commits were preserved. `git diff --check`, the conventions/template check, and the merge preview passed. - `pr_test_quality.py` emitted a possible-unregistered C++ test warning. Inspection of `core/libs/prx/libc/CMakeLists.txt` confirms that `guest_wide_formatting_tests` is registered with CTest as `guest_wide_formatting`. - Head `06bd24679818bec01461f191fec3e6d745ca88b6` built `guest_wide_formatting_tests` and passed `ctest -R guest_wide_formatting --output-on-failure` (1/1). Build and CTest were not rerun after rebasing. - No title `libc.prx` runtime test, Windows build or full test suite was run. ### Checklist - [x] Based on current `main`; no other open PR implements the same wide-format functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed under technical debt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
oneandonlydean commented 2026-10-14 04:30:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T04:30:50Z.


Which title prints %q, %D/%O/%U, an unknown conversion or a trailing % through the wide printf family? The source here is FreeBSD 11.4, but the console's libc.prx formats through Dinkumware's _Printf, which can handle unknown conversions and q differently (same question as the review on #3987). Until a title reaches it, or _Printf in a title's libc.prx confirms these cases, main's throw is the safer behaviour.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6160926994 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6160926994). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T04:30:50Z. --- Which title prints `%q`, `%D`/`%O`/`%U`, an unknown conversion or a trailing `%` through the wide `printf` family? The source here is FreeBSD 11.4, but the console's `libc.prx` formats through Dinkumware's `_Printf`, which can handle unknown conversions and `q` differently (same question as the review on #3987). Until a title reaches it, or `_Printf` in a title's `libc.prx` confirms these cases, main's throw is the safer behaviour.
MarcZX10 commented 2026-10-14 05:03:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T05:03:51Z.


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6161312162 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6161312162). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T05:03:51Z. --- 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 commented 2026-10-14 18:34:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T18:34:18Z.

Review: CHANGES_REQUESTED


Thanks for the fix. Blocking points:

  • The console's libc.prx formats through Dinkumware's _Printf, not FreeBSD's vfwprintf. As discussed above, neither a title nor _Printf evidence 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 _Printf disassembled from a title's libc.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.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5522809933 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#pullrequestreview-5522809933). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T18:34:18Z. **Review:** CHANGES_REQUESTED --- Thanks for the fix. Blocking points: - The console's `libc.prx` formats through Dinkumware's `_Printf`, not FreeBSD's `vfwprintf`. As discussed above, neither a title nor `_Printf` evidence 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 `_Printf` disassembled from a title's `libc.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.
MarcZX10 commented 2026-10-16 15:35:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T15:35:52Z.


Thanks for the detailed blocking review. I have no new title trace or Dinkumware _Printf evidence, so the current FreeBSD/Linux results still do not justify claiming console behavior. I’ll leave the PR unrebased until that evidence exists; the relevant _Printf branches or a title reaching these conversions remain the needed next step.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6218975621 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6218975621). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-16T15:35:52Z. --- Thanks for the detailed blocking review. I have no new title trace or Dinkumware `_Printf` evidence, so the current FreeBSD/Linux results still do not justify claiming console behavior. I’ll leave the PR unrebased until that evidence exists; the relevant `_Printf` branches or a title reaching these conversions remain the needed next step.
ionut27001 commented 2026-10-19 10:34:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ionut27001 on 2026-10-19T10:34:28Z.


I have some hardware data for these cases, though not the kind the review asks for. @adriadam10: this is libSceLibcInternal.sprx's swprintf in a payload process on a PS5 (firmware 12.70), not _Printf in a title's libc.prx. I have no title trace and did not disassemble libc.prx, so this does not settle the blocking point.

Setup: an ELF payload (ps5-payload-dev/sdk v0.44, clang 18.1.8), started from a payload manager, resolves swprintf from libSceLibcInternal.sprx and calls swprintf(buf, 40, fmt, a1, a2, a3, 0, 0) with a 16-bit wchar_t. Each ASCII format is copied unit by unit, NUL included, into the same wchar_t fmt[48], which is never cleared. text is the output up to its first NUL (nul_at), logged as ASCII (? for any other unit; none appeared).

p23: meta fw=0x12700001 pid=135 sdk=v0.44 compiler=Clang 18.1.8 built=Oct 18 2026 02:46:33
p23: resolve sym=swprintf module=libSceLibcInternal.sprx exported=yes
p23: case meta sizeof_wchar_t=2
p23: case swprintf fmt="%qd|%qu|%qx|%5qd" ret=18 text="%qd|%qu|%qx|   %qd" nul_at=18
p23: case swprintf fmt="%D|%O|%U" ret=8 text="%D|%O|%U" nul_at=8
p23: case swprintf fmt="%hD|%hhU|%5D|%-4O|" ret=17 text="%D|%U|   %D|%O  |" nul_at=17
p23: case swprintf fmt="%y|[%5%]|[%-5y]" ret=18 text="%y|[    %]|[%y   ]" nul_at=18
p23: case swprintf fmt="%05y" ret=5 text="   %y" nul_at=5
p23: case swprintf fmt="100%" ret=15 text="100%5%]|[%y   ]" nul_at=15
p23: case swprintf fmt="%d%" ret=13 text="3%5%]|[%y   ]" nul_at=13
p23: case swprintf fmt="%lqd" ret=3 text="%qd" nul_at=3
p23: case swprintf fmt="%m" ret=2 text="%m" nul_at=2

Compared with CheckFreebsdConversions in core/libs/tests/GuestWideFormatting.cpp and the new line in docs/dev/debt/libc.md at 178de73:

  • q, %D, %O, %U print as written. h/hh are dropped, and the width pads the printed text: %5qd gives %qd, %5D gives %D and %-4O gives %O . The test expects -5|7|ff| 9 (13), 5000000000|10|18446744073709551615 (34) and 70000|70000| -3|10 | (23). My arguments differ from the test's (5, 300, 7 for the third format), but no argument appears in these three outputs.
  • Unknown conversion: %y keeps its %, and the width counts both characters: [%-5y] gives [%y ]. The test expects y|[ %]|[y ]|€ (19); I ran the format without |%€. [%5%] matches. %05y is blank-padded, as the debt line says, but it prints %y, not y.
  • Trailing %: the test expects 100 (3) for "100%" and 7 (1) for Format(buffer, 48, u"%d%", 7). Here swprintf printed the % and kept reading past the terminator. After 100%, fmt still held 5%]|[%-5y] from the earlier %y|[%5%]|[%-5y], and that tail appears formatted in the output. The same tail follows 3% in the %d% case, which also passed the terminator 100% had left. I ran this through swprintf, not vswprintf. What gets printed depends on the memory after the format, but it did not stop at the %.
  • %m and %lqd: the debt line says these "still fail", and the test expects a negative return (and an empty buffer for %m). Here they print as text: %m (2) and %qd (3).

Main does not match this output either: vswprintf_nid_postfix returns -1 with an empty buffer when FormatWide throws (FormattingWide.cpp on main), and every case above throws there. In this process, all of them came back as text.

Not measured: a title or its libc.prx; vswprintf and wprintf; all the snwprintf_s cases; the surrogate-pair cases; |%€, ab%5, %d%l, a lone % and %lp. Each case ran once.

I can attach the probe source and the full log if that helps.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6265219762 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6265219762). Originally posted by [ionut27001](https://github.com/ionut27001) on 2026-10-19T10:34:28Z. --- I have some hardware data for these cases, though not the kind the review asks for. @adriadam10: this is **libSceLibcInternal.sprx's `swprintf` in a payload process on a PS5 (firmware 12.70)**, not `_Printf` in a title's `libc.prx`. I have no title trace and did not disassemble `libc.prx`, so this does not settle the blocking point. Setup: an ELF payload (ps5-payload-dev/sdk v0.44, clang 18.1.8), started from a payload manager, resolves `swprintf` from libSceLibcInternal.sprx and calls `swprintf(buf, 40, fmt, a1, a2, a3, 0, 0)` with a 16-bit `wchar_t`. Each ASCII format is copied unit by unit, NUL included, into the same `wchar_t fmt[48]`, which is never cleared. `text` is the output up to its first NUL (`nul_at`), logged as ASCII (`?` for any other unit; none appeared). ``` p23: meta fw=0x12700001 pid=135 sdk=v0.44 compiler=Clang 18.1.8 built=Oct 18 2026 02:46:33 p23: resolve sym=swprintf module=libSceLibcInternal.sprx exported=yes p23: case meta sizeof_wchar_t=2 p23: case swprintf fmt="%qd|%qu|%qx|%5qd" ret=18 text="%qd|%qu|%qx| %qd" nul_at=18 p23: case swprintf fmt="%D|%O|%U" ret=8 text="%D|%O|%U" nul_at=8 p23: case swprintf fmt="%hD|%hhU|%5D|%-4O|" ret=17 text="%D|%U| %D|%O |" nul_at=17 p23: case swprintf fmt="%y|[%5%]|[%-5y]" ret=18 text="%y|[ %]|[%y ]" nul_at=18 p23: case swprintf fmt="%05y" ret=5 text=" %y" nul_at=5 p23: case swprintf fmt="100%" ret=15 text="100%5%]|[%y ]" nul_at=15 p23: case swprintf fmt="%d%" ret=13 text="3%5%]|[%y ]" nul_at=13 p23: case swprintf fmt="%lqd" ret=3 text="%qd" nul_at=3 p23: case swprintf fmt="%m" ret=2 text="%m" nul_at=2 ``` Compared with `CheckFreebsdConversions` in [`core/libs/tests/GuestWideFormatting.cpp`](https://github.com/boykopovar/AnyPS5/blob/178de731b00b30fe8a213768c52bbe6a12076d76/core/libs/tests/GuestWideFormatting.cpp#L143-L174) and the new line in [`docs/dev/debt/libc.md`](https://github.com/boykopovar/AnyPS5/blob/178de731b00b30fe8a213768c52bbe6a12076d76/docs/dev/debt/libc.md#L55) at 178de73: - **`q`, `%D`, `%O`, `%U`** print as written. `h`/`hh` are dropped, and the width pads the printed text: `%5qd` gives ` %qd`, `%5D` gives ` %D` and `%-4O` gives `%O `. The test expects `-5|7|ff| 9` (13), `5000000000|10|18446744073709551615` (34) and `70000|70000| -3|10 |` (23). My arguments differ from the test's (`5, 300, 7` for the third format), but no argument appears in these three outputs. - **Unknown conversion:** `%y` keeps its `%`, and the width counts both characters: `[%-5y]` gives `[%y ]`. The test expects `y|[ %]|[y ]|€` (19); I ran the format without `|%€`. `[%5%]` matches. `%05y` is blank-padded, as the debt line says, but it prints `%y`, not `y`. - **Trailing `%`:** the test expects `100` (3) for `"100%"` and `7` (1) for `Format(buffer, 48, u"%d%", 7)`. Here `swprintf` printed the `%` and kept reading past the terminator. After `100%`, `fmt` still held `5%]|[%-5y]` from the earlier `%y|[%5%]|[%-5y]`, and that tail appears formatted in the output. The same tail follows `3%` in the `%d%` case, which also passed the terminator `100%` had left. I ran this through `swprintf`, not `vswprintf`. What gets printed depends on the memory after the format, but it did not stop at the `%`. - **`%m` and `%lqd`:** the debt line says these "still fail", and the test expects a negative return (and an empty buffer for `%m`). Here they print as text: `%m` (2) and `%qd` (3). Main does not match this output either: `vswprintf_nid_postfix` returns -1 with an empty buffer when `FormatWide` throws ([`FormattingWide.cpp` on main](https://github.com/boykopovar/AnyPS5/blob/8816fd772005585886f19b3f6c13a99931e41241/core/libs/prx/libc/src/FormattingWide.cpp#L222-L235)), and every case above throws there. In this process, all of them came back as text. Not measured: a title or its `libc.prx`; `vswprintf` and `wprintf`; all the `snwprintf_s` cases; the surrogate-pair cases; `|%€`, `ab%5`, `%d%l`, a lone `%` and `%lp`. Each case ran once. I can attach the probe source and the full log if that helps.
MarcZX10 commented 2026-10-19 15:01:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T15:01:07Z.


Rebased onto current main (00d7e611ef). Preserved all three commits and original authorship. git diff --check passes. I attempted a Linux CMake configure for focused validation, but configuration is blocked because the checked-out SDL2 source lacks CMakeLists.txt and XRandR development support is unavailable; no local test executable was built. The PR checks are running on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6270339154 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6270339154). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T15:01:07Z. --- Rebased onto current main (`00d7e611ef`). Preserved all three commits and original authorship. `git diff --check` passes. I attempted a Linux CMake configure for focused validation, but configuration is blocked because the checked-out SDL2 source lacks `CMakeLists.txt` and XRandR development support is unavailable; no local test executable was built. The PR checks are running on the updated head.
adriadam10 commented 2026-10-19 15:03:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T15:03:16Z.

Review: CHANGES_REQUESTED


Thanks for the rebase. Blocking points:

  • New console data in this thread (@ionut27001, swprintf from libSceLibcInternal.sprx on firmware 12.70) contradicts the behaviour this PR implements: %qd, %D, %O, %U and unknown conversions such as %y are printed as literal text (width pads the whole %y/%qd; h/hh are dropped), and %m and %lqd print as text too. The PR formats them the FreeBSD way (-5, 5000000000, y), so the tests and the debt line would pin values the console does not produce. The trailing % case was not cleanly measured. Please rework against that data, or keep main's throw for what is still unmeasured.
  • The head does not compile after the rebase: core/libs/tests/GuestWideFormatting.cpp defines CheckGroupingFlag (lines 149 and 247) and CheckSwprintf (lines 189 and 256) twice, and main calls CheckSwprintf() twice (lines 351, 354).
  • docs/dev/debt/libc.md now has the "narrow printf family" line twice (95, 99) and two "Guest path resolution" lines (104, with a stray .., plus the old one); only the wide printf line should be added.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5573557945 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#pullrequestreview-5573557945). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T15:03:16Z. **Review:** CHANGES_REQUESTED --- Thanks for the rebase. Blocking points: - New console data in this thread (@ionut27001, `swprintf` from `libSceLibcInternal.sprx` on firmware 12.70) contradicts the behaviour this PR implements: `%qd`, `%D`, `%O`, `%U` and unknown conversions such as `%y` are printed as literal text (width pads the whole `%y`/`%qd`; `h`/`hh` are dropped), and `%m` and `%lqd` print as text too. The PR formats them the FreeBSD way (`-5`, `5000000000`, `y`), so the tests and the debt line would pin values the console does not produce. The trailing `%` case was not cleanly measured. Please rework against that data, or keep main's throw for what is still unmeasured. - The head does not compile after the rebase: `core/libs/tests/GuestWideFormatting.cpp` defines `CheckGroupingFlag` (lines 149 and 247) and `CheckSwprintf` (lines 189 and 256) twice, and `main` calls `CheckSwprintf()` twice (lines 351, 354). - `docs/dev/debt/libc.md` now has the "narrow printf family" line twice (95, 99) and two "Guest path resolution" lines (104, with a stray `..`, plus the old one); only the wide printf line should be added.
MarcZX10 commented 2026-10-19 15:07:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T15:07:05Z.


Thanks for the probe and review. It confirms behavior in libSceLibcInternal.sprx, which differs from this PR’s target (libc.prx), so it does not establish the target formatter’s behavior. I agree the FreeBSD differential results alone do not justify claiming title compatibility; title-side _Printf evidence is still missing. I corrected the rebase mistakes in head 9c0f6263c6: the duplicate CheckGroupingFlag/CheckSwprintf definitions and call are gone, and the duplicated narrow-printf and guest-path debt entries are removed. The PR description now distinguishes the module evidence and current-head validation. Focused tests still could not be run here; the CMake dependency/configuration blocker is stated above.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6270464903 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6270464903). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T15:07:05Z. --- Thanks for the probe and review. It confirms behavior in `libSceLibcInternal.sprx`, which differs from this PR’s target (`libc.prx`), so it does not establish the target formatter’s behavior. I agree the FreeBSD differential results alone do not justify claiming title compatibility; title-side `_Printf` evidence is still missing. I corrected the rebase mistakes in head `9c0f6263c6`: the duplicate `CheckGroupingFlag`/`CheckSwprintf` definitions and call are gone, and the duplicated narrow-printf and guest-path debt entries are removed. The PR description now distinguishes the module evidence and current-head validation. Focused tests still could not be run here; the CMake dependency/configuration blocker is stated above.
adriadam10 commented 2026-10-19 15:08:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T15:08:13Z.

Review: CHANGES_REQUESTED


Thanks, the rebase now looks clean (no duplicate helpers or debt lines). The main blocking point is unchanged:

  • FormattingWide.cpp:144-157,216-222 formats %qd, %D/%O/%U and unknown conversions the FreeBSD way, and GuestWideFormatting.cpp:213-244 plus the debt line pin those values. The only console measurement in this thread (@ionut27001, swprintf from libSceLibcInternal.sprx, firmware 12.70) prints all of them as literal text (width pads the whole %y/%qd, h/hh dropped), and %m/%lqd print as text too, while the tests expect an exception for those two. It is a different module than a title's libc.prx, but it is the only hardware data and it contradicts this code; nothing supports the FreeBSD behaviour on the console.
  • To unblock: either implement the measured behaviour (and say in the debt line that it comes from libSceLibcInternal.sprx, not measured on libc.prx), or drop these cases and keep main's throw until _Printf from a title's libc.prx is disassembled or a title reaches them.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5573623044 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#pullrequestreview-5573623044). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-19T15:08:13Z. **Review:** CHANGES_REQUESTED --- Thanks, the rebase now looks clean (no duplicate helpers or debt lines). The main blocking point is unchanged: - `FormattingWide.cpp:144-157,216-222` formats `%qd`, `%D`/`%O`/`%U` and unknown conversions the FreeBSD way, and `GuestWideFormatting.cpp:213-244` plus the debt line pin those values. The only console measurement in this thread (@ionut27001, `swprintf` from `libSceLibcInternal.sprx`, firmware 12.70) prints all of them as literal text (width pads the whole `%y`/`%qd`, `h`/`hh` dropped), and `%m`/`%lqd` print as text too, while the tests expect an exception for those two. It is a different module than a title's `libc.prx`, but it is the only hardware data and it contradicts this code; nothing supports the FreeBSD behaviour on the console. - To unblock: either implement the measured behaviour (and say in the debt line that it comes from `libSceLibcInternal.sprx`, not measured on `libc.prx`), or drop these cases and keep main's throw until `_Printf` from a title's `libc.prx` is disassembled or a title reaches them.
MarcZX10 commented 2026-10-19 15:44:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T15:44:33Z.


I updated the implementation and regression cases to match the reported libSceLibcInternal.sprx payload swprintf output: %q, %D/%O/%U, %m, %lqd, and unknown conversions are preserved as literal text, with width applied to the full text. Incomplete conversions still fail safely because the trailing-% probe read beyond the format terminator. The secure path remains rejecting these forms because it was not measured. The PR title and description now describe this accurately and explicitly state that this does not establish behavior in a title’s bundled libc.prx/Dinkumware _Printf.

At head 3c74c99b673e1513d51fa9aed48511b7118b9a8a, the focused Linux guest_wide_formatting test passes (1/1), conventions pass, and git diff --check passes. The title-side evidence is still absent, as requested in the review; the existing payload measurement is only module-specific evidence.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6271206564 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6271206564). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T15:44:33Z. --- I updated the implementation and regression cases to match the reported `libSceLibcInternal.sprx` payload `swprintf` output: `%q`, `%D`/`%O`/`%U`, `%m`, `%lqd`, and unknown conversions are preserved as literal text, with width applied to the full text. Incomplete conversions still fail safely because the trailing-`%` probe read beyond the format terminator. The secure path remains rejecting these forms because it was not measured. The PR title and description now describe this accurately and explicitly state that this does not establish behavior in a title’s bundled `libc.prx`/Dinkumware `_Printf`. At head `3c74c99b673e1513d51fa9aed48511b7118b9a8a`, the focused Linux `guest_wide_formatting` test passes (1/1), conventions pass, and `git diff --check` passes. The title-side evidence is still absent, as requested in the review; the existing payload measurement is only module-specific evidence.
MarcZX10 commented 2026-10-19 15:46:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T15:46:45Z.


The review follow-up is now rebased onto current main at d047690c6391577c9add655ae1dc2ed20df177a8; the rebase completed without conflicts and preserved all five commits’ authorship. On the new head 06bd246798, I rebuilt guest_wide_formatting_tests and reran ctest -R guest_wide_formatting --output-on-failure (1/1 passed), tools/check_conventions.py (passed), and git diff --check (passed). The implementation, tests, and debt note reflect the payload libSceLibcInternal.sprx measurements; title libc.prx behavior remains unverified as stated in the PR description.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6271245582 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6271245582). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T15:46:45Z. --- The review follow-up is now rebased onto current `main` at `d047690c6391577c9add655ae1dc2ed20df177a8`; the rebase completed without conflicts and preserved all five commits’ authorship. On the new head `06bd246798`, I rebuilt `guest_wide_formatting_tests` and reran `ctest -R guest_wide_formatting --output-on-failure` (1/1 passed), `tools/check_conventions.py` (passed), and `git diff --check` (passed). The implementation, tests, and debt note reflect the payload `libSceLibcInternal.sprx` measurements; title `libc.prx` behavior remains unverified as stated in the PR description.
MarcZX10 commented 2026-10-19 16:52:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T16:52:35Z.


Thanks for approving. I have kept the module-specific measured behavior and the remaining title libc.prx evidence limitation explicit in the PR description and follow-up.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6272483312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6272483312). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-19T16:52:35Z. --- Thanks for approving. I have kept the module-specific measured behavior and the remaining title `libc.prx` evidence limitation explicit in the PR description and follow-up.
MarcZX10 commented 2026-10-20 08:29:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T08:29:35Z.


Thanks for the firmware 12.70 payload report. The current PR head already follows the measured literal handling for the reported non-secure wide swprintf cases and explicitly limits its claim to libSceLibcInternal.sprx, not a title’s bundled libc.prx. Your trailing-percent probe shows an out-of-bounds read, so it does not support a deterministic output; the implementation continues to reject an incomplete conversion. I found no additional code change justified by this report. The open title _Printf evidence/rebase review point remains as stated in the latest review.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6286816203 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6286816203). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T08:29:35Z. --- Thanks for the firmware 12.70 payload report. The current PR head already follows the measured literal handling for the reported non-secure wide `swprintf` cases and explicitly limits its claim to `libSceLibcInternal.sprx`, not a title’s bundled `libc.prx`. Your trailing-percent probe shows an out-of-bounds read, so it does not support a deterministic output; the implementation continues to reject an incomplete conversion. I found no additional code change justified by this report. The open title `_Printf` evidence/rebase review point remains as stated in the latest review.
MarcZX10 commented 2026-10-20 08:34:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T08:34:14Z.


Rebased the six existing commits onto current upstream main 661f8b71718083fbac1c45b44f5d67dc39cb4624, preserving their original authors. The debt-file conflict retained current-main entries and the PR’s distinction between measured and extrapolated payload behavior. Conventions and git diff --check pass on new head f52d991a2d; the focused Linux 1/1 formatting test passed on the prior head 06bd246798 and has not been rerun after this rebase. No claim is made for title libc.prx behavior or Windows/full-suite validation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6286895791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6286895791). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T08:34:14Z. --- Rebased the six existing commits onto current upstream `main` `661f8b71718083fbac1c45b44f5d67dc39cb4624`, preserving their original authors. The debt-file conflict retained current-main entries and the PR’s distinction between measured and extrapolated payload behavior. Conventions and `git diff --check` pass on new head `f52d991a2d`; the focused Linux 1/1 formatting test passed on the prior head `06bd246798` and has not been rerun after this rebase. No claim is made for title `libc.prx` behavior or Windows/full-suite validation.
MarcZX10 commented 2026-10-20 08:41:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T08:41:12Z.


Final hosted check update for head f52d991a2df498e341d0ccd7620c80588f97f73d: the Windows relinker CTest has completed successfully. All relinker, register-context, write-watch, ASan, conventions, labels, eligibility and report checks passed. Linux and Windows AGC jobs remain skipped by the PR workflow policy. The focused guest_wide_formatting test has still not been rerun after the rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6287011984 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6287011984). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T08:41:12Z. --- Final hosted check update for head `f52d991a2df498e341d0ccd7620c80588f97f73d`: the Windows relinker CTest has completed successfully. All relinker, register-context, write-watch, ASan, conventions, labels, eligibility and report checks passed. Linux and Windows AGC jobs remain skipped by the PR workflow policy. The focused `guest_wide_formatting` test has still not been rerun after the rebase.
MarcZX10 commented 2026-10-21 00:00:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T00:00:12Z.


I compared the previously tested head 06bd246798 with the current PR head f36936b1edbcd1b660a998dfe08680faea458de1: FormattingWide.cpp and GuestWideFormatting.cpp are byte-for-byte unchanged. The only difference among those paths is the debt documentation. So the focused test result from 06bd246798 still covers the current implementation and test source; I did not rerun the executable after the rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6304540778 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#issuecomment-6304540778). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T00:00:12Z. --- I compared the previously tested head `06bd246798` with the current PR head `f36936b1edbcd1b660a998dfe08680faea458de1`: `FormattingWide.cpp` and `GuestWideFormatting.cpp` are byte-for-byte unchanged. The only difference among those paths is the debt documentation. So the focused test result from `06bd246798` still covers the current implementation and test source; I did not rerun the executable after the rebase.
MarcZX10 commented 2026-11-02 04:56:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:56:45Z.

Review: COMMENTED


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 api comments, 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/main 926f7dd492).
  • 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 no Fixes: 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/%U and unknown conversions is author-reported. Not verified here.

Sources

Not verified

  • The PS5 measurements and the overlap claims with #11214 and #11907.
  • The local conventions run and any build or test.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732245176 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5303#pullrequestreview-5732245176). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T04:56:45Z. **Review:** COMMENTED --- # 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 api` comments, 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/main `926f7dd492`). - 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 no `Fixes:` 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`/`%U` and unknown conversions is author-reported. Not verified here. ## Sources - https://github.com/boykopovar/AnyPS5/blob/6de675ebf48b46bb5546a4c8a606e54ce480d08d/.github/pull_request_template.md#L16 ## Not verified - The PS5 measurements and the overlap claims with #11214 and #11907. - The local conventions run and any build or test.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5303
No description provided.