Repository navigation
Report close failures when writing a tar archive - #424
Merged
Merged
Conversation
The gnu-tar output path closed both the tar writer and the file it wrote to with the error discarded. Closing the tar writer is what writes the padding and the two end-of-archive blocks, so a failure there, on a full disk or a broken pipe, left a truncated archive behind and still exited 0. Readers accept an archive with no end-of-archive marker, so nothing downstream reports it either. Both closes now go into the returned error, the way the disk output path already handled its own. The shared helper for that replaces the three copies this would otherwise need.
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.
The gnu-tar output path closed both the tar writer and the file it wrote to with the error discarded. Closing the tar writer is what writes the padding and the two end-of-archive blocks, so a failure there — a full disk, a broken pipe — left a truncated archive behind and still exited 0.
Nothing downstream reports it either: both
archive/tarand GNU tar read an archive with no end-of-archive marker without complaint. On the test archive the difference is 8704 bytes against 7680, and neither reader minds.Both closes now go into the returned error, the way the disk output path already handled its own.
closeIntoreplaces the three copies of that pattern this would otherwise need, and is covered directly; the command test checks that the archive it writes ends with the marker, since parsing it is not enough to notice.