Skip to content

Don't fail 'cat' when --length runs past the end of the blob - #421

Merged
folbricht merged 1 commit into
masterfrom
fix-cat-length-past-end
Sep 3, 2026
Merged

Don't fail 'cat' when --length runs past the end of the blob#421
folbricht merged 1 commit into
masterfrom
fix-cat-length-past-end

Conversation

@folbricht

Copy link
Copy Markdown
Owner

io.CopyN returns io.EOF when 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.caibx on a 2097152-byte blob wrote the 152 bytes that were there and then exited 1 with Error: EOF. Reaching the end of the data is not a failure, and a reader that stops there is what cat is expected to do.

An offset that lands past the end of the blob still fails, with the clearer message the seek already produces.

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.
@folbricht
folbricht merged commit 5646c1e into master Sep 3, 2026
9 checks passed
@folbricht
folbricht deleted the fix-cat-length-past-end branch September 3, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant