You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(libc): return a newline from puts like FreeBSD - #4804
puts_nid_postfix returned the host's puts result: strlen(s) + 1 on 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', and EOF on failure as before.
file_streams checks puts with a non-empty and an empty string. It fails on main and passes with the change.
Tested
Linux (Arch, GCC), Release, BUILD_TESTING=ON, based on mainee4962190: file_streams aborts on main and passes with the change (3 runs); full build and full ctest pass. Windows (WinLibs MinGW-w64 GCC 15.2.0 r7, NVIDIA RTX 5060), Release, BUILD_TESTING=ON: full build and full ctest pass (1018 tests, the same 7 skipped as on main). No title or homebrew run.
Checklist
Based on current main; no other open PR implements the same functions
I opened #5394 to carry the Windows line-buffering fix from #5391. It touches puts_nid_postfix to flush the newline; I listed #4804 as a dependency so your puts return-value change can land first, then I can rebase and resolve the shared line. If you prefer a different merge order, please say so.
Thanks for the heads-up, that merge order works for me. After #4804, puts returns '\n' on success instead of the host's non-negative value. Your result >= 0 check 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 at INT_MAX), as FreeBSD's fputs does. The new line-buffered branch returns 0 on 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.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)