libc: guest_standard_streams aborts on Windows because a second ungetc on an unbuffered stream fails #17423
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Danigamer05 on 2026-11-08T19:25:52Z.
What happens
guest_standard_streamsaborts on Windows (Exit code 0xc0000409) on currentmain: the secondungetcon an unbuffered stream returnsEOFinCheckGetdelimAndGetline.Title, test or build step
ctest
guest_standard_streams(core/libs/tests/GuestStandardStreams.cpp, the read-error fixture added with #12920)AnyPS5 commit
main095ff72367c, nothing merged on top. The same abort appears with #17331 merged on top, in that pull request's hostedwindowsjob (run).System
Windows 11 Pro 26200, MinGW-w64 GCC 15.2 (UCRT), Ninja, Release. GPU not involved.
Steps to reproduce
It stops within half a second, every run (5 of 5 on the merge with #17331, 3 of 3 on plain
main).Log
gdb on the test binary:
With
Requiretemporarily changed to print__LINE__, the failing check is line 473:What was checked
ungetc_nid_postfix(core/libs/prx/libc/src/StandardStreams.cpp) forwards to the hoststd::ungetc. The UCRT keeps a single pushback byte for an_IONBFstream, so the second call fails; FreeBSD'sungetcgrows its own pushback buffer and accepts it, which is what the fixture expects. Either the fixture should push back only one byte on an unbuffered stream, orungetcneeds a pushback buffer of its own on Windows to match FreeBSD.Not checked on Linux or macOS, where the host
ungetcmay accept more than one byte. The hosted Windows job onmainwas still queued at the time of writing.