Repository navigation
return write error for short final chunk in File.ReadFrom - #670
Merged
puellanivis merged 1 commit intoOct 18, 2026
Merged
Conversation
puellanivis
approved these changes
Oct 16, 2026
Contributor
Author
Collaborator
|
I kind of want to merge the flaky test fix, and then rebase… it’s a regular annoyance of having to hit |
Contributor
Author
|
if you merge 676 first, I can rebase this on top, then it should not be flakey anymore |
When the reader ends part-way through the buffer, io.ReadFull returns io.ErrUnexpectedEOF with the last bytes. ReadFrom kept that error over the error from writing those bytes and then returned nil for it, so a refused final write was reported as success. Only replace it when the write failed, so the loop doesn't read r again after it has ended. Fixes pkg#668
christhomas
force-pushed
the
fix-readfrom-final-chunk-error
branch
from
October 17, 2026 10:20
cfe7b34 to
8634d51
Compare
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 #668
When the reader ends part-way through the buffer,
io.ReadFullreturnsio.ErrUnexpectedEOFtogether with the last bytes. That error was kept over the error from writing those bytes, and then turned into nil.This follows the suggestion in the issue, with one difference: the unexpected EOF is only replaced when the write failed. Replacing it with a nil
err2as well would send the loop back toReadFullafter the reader has ended, which on a terminal waits for a second Ctrl-D. The "no error" case in the test checks for that.