fix(libc): isolate host diagnostics from guest buffering #10020
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10020"
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 Queuse on 2026-10-23T04:27:17Z.
What
On Windows, guest
setvbuf(stderr, ..., _IOFBF, ...)also buffers host diagnostics until the guest flushes the stream. The same sharing affectsstdoutthroughsetbuf.Preserve a separate, unbuffered host stream before changing the guest standard stream's buffering. Reuse that retained descriptor when a later guest
dup2preserves the host destination. Guest output keeps its requested buffering and redirection. Preserve the native stream lock before taking the cache mutex, including calls made under guestflockfile.The title logs discussed in #9941 were found in redirected files. This fix addresses the independently reproduced buffering defect; it is not evidence of the cause of those titles' missing runner output.
Tested
Windows 11 x86-64, WinLibs MinGW-w64 GCC 15.2.0-r7, Ninja, Release. Head
d43043b6e5includes main097a9514a0.guest_standard_streams,guest_standard_streams_closed_stdout,guest_standard_streams_exclusive_stdout,file_streams,guest_host_standard_error_windows,guest_host_standard_buffering_windows,guest_host_streams: 7/7 pass, with no skips.a23f8fc9fbis clean; runtime results remain tied to the included base097a9514a0.The existing regression fails on main
9d6adeb550because the host marker remains buffered. This revision retains the stdout/stderr, guest-flush, dup2 and lock-held buffering coverage. Fresh overlap analysis has 29 shared-file comparisons blocked by other PRs' base conflicts; their inspected patches add neither these preservation helpers nor this buffering fixture. #9945 is a separate stream-initialization fix. #6044 changes test organization. The standalone head was not retested on Linux/macOS; no full product build, title or console run was performed.Additional integration run: tree 5e44964f85 combines this buffering fix with the #9945 stream-initialization follow-ups on main
85f2f2d478. Rebuilt the affected libraries and tests: 10/10 Windows, 8/8 Ubuntu 26.04.1 under WSL2 (GCC 15.2.0), no skips. This includes closed/missing standard descriptors, an already rebound CRT stream, host buffering/redirection andguest_freopen_host_standard. The buffering implementation and fixture match headd43043b6e5; the combined tree additionally changes standard-stream initialization. A trial merge of the combined tree with consulted maind1fc16348eis clean. No game or full-suite run.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-23T04:31:56Z.
Review: COMMENTED
Reviewed the current Windows stream-preservation diff and the submitted test evidence. The focused Windows matrix is valuable, and its scope is clear. I did not find a concrete blocking issue in this pass; hosted Linux and Windows product jobs are currently pending/skipped as reported, so I am not treating those as additional verification. The locking path is subtle: the new helper locks the native FILE before the cache mutex and the test exercises
setvbufwhile the guest stream lock is held, matching the deadlock concern described. Please keep the Windows jobs visible through completion.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T04:31:57Z.
Review: APPROVED
Reviewed the current exact head and the Windows/WSL focused test report. The change preserves the original host standard stream before guest buffering changes, and the tests cover immediate host output, delayed guest output, redirection, stdout/stderr, and lock-held buffering changes. CI convention, intake, labels, relinker, ASAN, register-context, and write-watch checks pass; Linux and Windows product jobs are skipped by current workflow policy. The report explicitly says full native-library builds and game runs were not performed. No blocking issue found in the reviewed scope.