Repository navigation
Conversation
…tioned FreeBSD refills a stream only while its end-of-file indicator is clear, so fgetc, fgets and fread keep returning end-of-file after the first one until clearerr, a seek or ungetc. The Windows CRT reads again on every call, which returned bytes appended after the end was reached.
They are macros on macOS, so a global-scope qualifier does not compile there.
…repositioned fscanf now returns end-of-file while the end-of-file indicator is set, like the other read paths. The debt entry also lists the host ungetc limits.
…format A format that consumes nothing returns 0, a literal or a conversion that needs input returns end-of-file, and a leading %n stays with the host. This also replaces a stray NUL byte in the previous change with a decision made by the format.
10 tasks done
Contributor
Author
|
Closing this duplicate: it carries the same EOF-sticky implementation already reviewed in #5330 (and #5222). The maintainer closed #5330 because no title-specific failure was identified and asked contributors to hold generic PRs while the queue is high. I should have found that history before opening this PR. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #5279.
What
A Windows host stream can resume reading after EOF when another handle appends bytes, while FreeBSD keeps returning EOF until
clearerr, a seek, orungetc. Keep the guest stream’s EOF behavior consistent acrossfgetc,fgets,fread, andfscanf, including the EOF return rules for formats that do or do not require input. The regression covers the reported append-after-EOF sequence and scanner format cases.The change carries Hussein Kadhim’s reviewed fix commits with his original commit authorship preserved. The known
%n-leading format limitation remains recorded inTechnicalDebt.md.Tested
guest_standard_streamsandfile_streamspassed (2/2).tools/check_conventions.py --base upstream/mainpassed.Checklist
main; no other open PR implements the same functions