fix(libc): match bundled narrow scansets and scan directive parsing #12428
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12428"
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 JJenkx on 2026-10-28T13:23:03Z.
What
The narrow scanf paths now follow the bundled libraries' scanset, length and termination rules. Windows scansets are translated into explicit byte lists rather than inheriting the host's range rules, and string/character/scanset conversions retain only a bare
llength.The shared secure/stream scanner reads one length letter or
hh/ll, matching the Windows translator. Thus%hlsstops at the unknown conversion instead of accepting the whole length run and writing a narrow string through one entry point. A bare%lsstill writes UTF-16.Unknown conversions stop the shared scanner as a matching failure before it checks for input EOF. Incomplete Windows directives such as
%llikewise end the scan without setting EINVAL. Regression rows cover malformed lengths, empty input,%5y,%k, and%lsthrough both plain and secure entry points.Linux's remaining host string-length/EOF-errno differences and plain
qextension are recorded in the debt file. The shared secureqdirective now ends without storing, as the reference modules do.Tested
Exact follow-up head
4faeb3255c0d36d91503dd41b0d04b9dd8f67cef; qualification is of this PR branch, not a latest-main integration. Current-main rebase remains separate pending work.guest_formatting,guest_wide_formatting,guest_safe_errors,guest_stdio_variadic,guest_scan_count,guest_wide_stream_scan, each repeated3: 18 focused executions per host.sscanf/sscanf_s, including stored bytes/canaries, return count, errno and constraint-handler observations. Final actual Windows library matches all88 against both references without normalization.ldrop mutant. Original source is restored, Git is clean, and all9 formatting/error executions pass again. Additional stream/count/variadic groups then pass9 more executions.ScanSourcefails the new regression. Restoring the final source passes9 formatting/error executions again; the additional stream groups also pass9. Supplemental%qdrows confirm secure matching failure and the retained plain-Linux extension.Raw observations, probes, reference identities, both-host build/test logs and JUnit, source patch and mutation controls, SHA-256
d7880e3dbed6b5f28a4536973b6da8e2f8a5e6525f504c096bf5b91b4b2f284b(download verified). References execute as converted modules on Linux, not a console. macOS, other SDKs/locales and native-title effects remain unverified. No FPS claim.Original scanset qualification (earlier-head evidence; its100,000-case replay was not repeated in this follow-up):
Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, WinLibs GCC 15.2.0 UCRT r7, Ninja, Release,
BUILD_TESTING=ON, onmain750cf6cf48.libc.prx: I loaded PPSA07923's and PPSA05916'slibc.prxnatively and called theirsscanf(1Pk0qZQGeWo) andsscanf_s(24m4Z4bUaoY) side by side with this build. I compared the return value, the bytes stored and%n:49 hand-picked pairs: 0 differences.
100,000 random scansets each for
sscanfandsscanf_s, built fromabcz-]^*and the bytes 0x80/0xFF (sometimes negated), with random inputs:sscanfsscanf_smainThe 2 left both have a byte ≥ 0x80 as a literal in the format after the set. The titles fail that literal match and the host makes it. It's listed in the debt entry, not fixed here.
guest_formatting(16 new rows, each throughsscanfandsscanf_s),guest_stdio_variadic,guest_scan_countandguest_wide_stream_scanpass in each of 3 runs.main'sWindowsScanning.hppandFormatting.cpp,guest_formattingfails.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:
efdeef66aa35be7ef17c73152ac2dddac6ea18da. The source and tests merge automatically. The debt resolution keeps the measured narrow-scanset entry and main’s updated quad-length behavior, replacing the stale Linux-as-ll description.Linux Release:
guest_formatting,guest_wide_formatting,guest_stdio_variadic,guest_scan_count,guest_wide_stream_scanpass three repetitions (15 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).
Independent Windows validation, reported by bunbeans2-arch for topic
efdeef66aa35be7ef17c73152ac2dddac6ea18daagainst mainf7f03daf52: Windows 11 Pro 22631, i9-9900K, MSYS2 UCRT64 GCC 16.1, Release.guest_formattingpasses 5/5; retaining the new test while restoringFormatting.cppandWindowsScanning.hppto main fails 5/5; plain main passes 3/3. This is the contributor's run, not a new local Windows execution.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T13:52:21Z.
Review: CHANGES_REQUESTED
The code and test evidence are substantial, and I found no concrete implementation defect in the reviewed diff. The merge-order coordination is also now clear in the threads: #9087's author agreed it lands first, and #11852's author agreed it lands first and described the rebase placement needed afterward.
One repository checklist item still conflicts with that agreement.
CONTRIBUTING.mdsays to declare a required PR on the checklist line asDepends on: #N; the current line saysDepends on: nonewhile the body says #9087 and #11852 should land first. Please change the checklist to list both prerequisites so the recorded merge order matches the agreement. I am requesting this metadata correction only; no code correctness blocker is identified.