Repository navigation
Conversation
…does A write to a stream that fclose or a failed freopen closed set errno to EBADF in fputs, fputc and fprintf. On a PS5 fputs and fputc return -1 and leave errno unchanged, and fprintf fails with EINVAL (boykopovar#9763). Those three now do the same; putc, putchar and __swbuf forward to fputc and follow it. The other stream writes, which were not measured, keep EBADF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # core/libs/prx/libc/src/FileAndHeap.cpp # core/libs/prx/libc/src/StandardStreams.cpp
…unchanged On a closed stream fputc returns -1 without setting errno, as measured on a PS5. The fcloseall test asserted EBADF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
What
A write to a stream that
fcloseor a failedfreopenclosed seterrnotoEBADFinfputs,fputcandfprintf. On a PS5fputsandfputcreturn -1 and leaveerrnounchanged, andfprintffails withEINVAL(boykopovar#9763; thefreopen of a closed streamentry indocs/dev/debt/libc.md).putc,putcharand__swbufforward tofputcand follow it.fwrite,puts,printfand the wide forms) were not measured and keepEBADF; the debt entry says so.GuestStandardStreams.cppandGuestFreopenHostStandard.cppcheck the measured results where they checkedEBADFbefore.Tested
Linux (Debian 13, GCC 14.2.0, Release), on
mainec7369ecb8.ctest -R '^guest_(standard_streams.*|freopen_host_standard)$': 6/6 passed.main's sources and this branch's tests,guest_standard_streams,guest_standard_streams_closed_stdoutandguest_freopen_host_standardfail (errno9).ctest(5896 tests,-j 12) with this branch and my other twelve branches of this round merged ontomain521fb7fec4: 5880 passed. The 16 failures are the set that fails onmainin the same environment: sixagc_drivercases (agc_driver_image_table_packed_guardspasses when run on its own) and ten that need a.gitdirectory, network or a passwd entry for the user.python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch: failed closed on feat(libc): support archive-backed stdio reads boykopovar/AnyPS5#7447, fix(libc): support character reads from random device streams boykopovar/AnyPS5#8150, fix(libc): follow snprintf_s and sscanf_s constraints as measured on a PS5 boykopovar/AnyPS5#9087, feat(libc): decode non-ASCII scanset members and non-BMP characters in the guest wide scanf boykopovar/AnyPS5#9340, feat(libc): add std::__sce_v2::_Random_device, _Fiopen and setw boykopovar/AnyPS5#9526, fix(libc): bound narrow formatting fields boykopovar/AnyPS5#11332, feat(libc): implement __std_calloc_crt allocation wrapper boykopovar/AnyPS5#12184, feat(libkernel): cancel blocked POSIX reads with owned operations boykopovar/AnyPS5#12682, fix(libkernel): preserve blocking sockets over nonblocking native transport boykopovar/AnyPS5#12688, feat(libkernel): cancel blocked POSIX writes with partial progress boykopovar/AnyPS5#12700 and feat(libkernel): support deferred cancellation in POSIX accept boykopovar/AnyPS5#12965, which conflict withmain; none of their diffs touches the closed-stream checks offputs,fputcorfprintf.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)Summary by CodeRabbit