fix(libc): return a newline from puts like FreeBSD #4804
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4804"
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 Gashrod1 on 2026-10-12T22:26:05Z.
What
puts_nid_postfixreturned the host'sputsresult:strlen(s) + 1on glibc and 0 on the Windows runtime. FreeBSD returns'\n'on success (lib/libc/stdio/puts.c:retval = __sfvwrite(stdout, &uio) ? EOF : '\n';). It now returns'\n', andEOFon failure as before.file_streamschecksputswith a non-empty and an empty string. It fails onmainand passes with the change.Tested
Linux (Arch, GCC), Release,
BUILD_TESTING=ON, based onmainee4962190:file_streamsaborts onmainand passes with the change (3 runs); full build and fullctestpass. Windows (WinLibs MinGW-w64 GCC 15.2.0 r7, NVIDIA RTX 5060), Release,BUILD_TESTING=ON: full build and fullctestpass (1018 tests, the same 7 skipped as onmain). No title or homebrew run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T18:42:13Z.
I opened #5394 to carry the Windows line-buffering fix from #5391. It touches
puts_nid_postfixto flush the newline; I listed #4804 as a dependency so yourputsreturn-value change can land first, then I can rebase and resolve the shared line. If you prefer a different merge order, please say so.Imported from boykopovar/AnyPS5. Originally posted by Gashrod1 on 2026-10-13T18:52:35Z.
Thanks for the heads-up, that merge order works for me. After #4804,
putsreturns'\n'on success instead of the host's non-negative value. Yourresult >= 0check still holds, so the rebase should only need to keep both changes on that line.One related point: #5394 also touches
fputs_nid_postfix, and #4803 changes its return value to the written length (capped atINT_MAX), as FreeBSD'sfputsdoes. The new line-buffered branch returns0on success, so whichever lands second should return the length there too, e.g.static_cast<int>(std::min<std::size_t>(length, INT_MAX)). I'm happy to rebase #4803 on top of yours if it goes in first.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T19:06:48Z.
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.
main)core/libs/prx/libc/src/Formatting.cppL543-544Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:38:01Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed