Repository navigation
fix(libc): match title printf behavior on Windows - #3987
adriadam10 merged 7 commits into
Conversation
|
Windows run (Windows 11 26300, WinLibs GCC 15.2.0 r7, Release, full build):
|
|
CI status note: all reported checks are passing except |
4b5a478 to
36276a0
Compare
36276a0 to
6fa2daa
Compare
6fa2daa to
308d006
Compare
308d006 to
e5b256f
Compare
|
Rebased onto current |
|
I do not have a title log showing a call with %q, %D, %O, %U, or another conversion that the PR newly rejects. The current evidence only compares the formatter with FreeBSD behavior. I will not claim that this establishes console behavior; if title or console evidence is required for the change, I agree it is still missing. |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the rebase. Two things before this can go in:
- Same question as @oneandonlydean's, still open: no title or console evidence that
%q,%D/%O/%U, an unknown conversion or a trailing%is ever printed. Until then the guest aborting is the safer behaviour than a plausible-but-wrong output. - The only source is FreeBSD 11.4
vfprintf.c, and the assumption in the TechnicalDebt line that the console takes these from the same code is unchecked. The console'slibc.prxexports Dinkumware's_Printf/_Printf.percent, whose handling of unknown conversions and ofqcan differ (e.g. printing the whole%yspec rather than justy). Disassembling_Printfin a title'slibc.prxand checking those four cases would settle it; then the code and the expected values in the test should follow that.
Also, the current head hasn't had a Windows run (the earlier ones were before the rebase); guest_formatting only exercises these cases on Windows.
be146cb to
26761c6
Compare
|
Rebased onto current |
|
I do not have the requested title |
|
Thanks for the clarification and for the firmware 12.70 payload measurement. Since it exercises |
26761c6 to
d2186b5
Compare
|
Updated the PR after the title-module probe in #3975 and rebased onto current The focused direct |
|
I built the branch's Results, against the new asserts in
The Otherwise the unknown-conversion branch behaves as the debt entry says: widths/ |
…s on Windows The Windows printf family threw on the q length modifier, the D, O and U conversions, an unknown conversion character and a format ending in a percent sign, where FreeBSD's vfprintf formats the first three and prints the unknown character itself or stops at the end of the format. (cherry picked from commit 0e3b289)
…Windows does not The unknown-conversion branch printed %m, positional arguments, the grouping flag and modifiers in an unusual order as literal characters. Only characters FreeBSD's vfprintf prints as themselves are now printed. (cherry picked from commit 0106858)
d2186b5 to
a5e6092
Compare
|
Checked the new branches of |
Keep boykopovar#3987's q, D, O, U, width, '-' and trailing '%' handling for unknown conversions and fold it into this branch's measured path: '#' and precision are ignored as measured, '+', space, apostrophe and '0' with a width still throw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
On Windows, match the measured title
libc.prxDinkumware_Printfbehavior for%q,%D,%O,%U, and unknown conversion characters. These are emitted as literal text; unknown conversions keep the leading%, use the measured width and-behavior, and discard length modifiers. Width handling for%%remains covered. A trailing%reads beyond the format NUL in the measured binaries, so this implementation throws instead of reproducing that undefined over-read. Unknown conversions with other flags or precision still throw because those cases were not measured.The probe in #3975 loaded the decrypted
libc.prxfrom PPSA13934, PPSA07923, PPSA05916 and PPSA04158 and called each module'ssnprintfexport. All four returned byte-identical results for the tested formats.The overlap scan found adjacent test insertions with #7386 in
Formatting.cpp; the wide-scanf and printf checks are independent, and I proposed landing this small test block first so #7386 can rebase while keeping its tests. Other shared formatter/debt files belong to separate open work on argument positions (#9552), float conversions (#9699, #9916, #9927 and #9958), and UTF-16 string conversion (#9939); I reviewed their changed hunks, and this change does not depend on those implementations. Preserve each PR's test and debt entries when rebasing.Tested
FormatWindowsdirectly and passed the measured literal, width, length-modifier and incomplete-format cases.python3 tools/check_conventions.py --base upstream/main --head HEADpassed;git diff --checkpassed.guest_formattingtest was not run on Windows for this head.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)