Don't fail 'cat' when --length runs past the end of the blob - #421
Merged
Conversation
io.CopyN returns io.EOF when the source has fewer bytes left than were asked for, and that was handed straight back. 'desync cat -o <near the end> -l 4096' wrote the bytes that were there and then exited 1 with "Error: EOF". Reaching the end of the data is not a failure.
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.
io.CopyNreturnsio.EOFwhen the source has fewer bytes left than were asked for, and that was handed straight back to the caller.desync cat -o 2097000 -l 4096 blob.caibxon a 2097152-byte blob wrote the 152 bytes that were there and then exited 1 withError: EOF. Reaching the end of the data is not a failure, and a reader that stops there is whatcatis expected to do.An offset that lands past the end of the blob still fails, with the clearer message the seek already produces.