Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't add a padding entry if it has no bytes #67

Merged
merged 2 commits into from
Jul 21, 2023
Merged

Conversation

vbatts
Copy link
Owner

@vbatts vbatts commented Jul 21, 2023

Fixes #65

If the read bytes is 0, then don't even create the entry for that padding.
This sounds like the solution for the issue opened, but I haven't found a reproducer for this issue yet. :-\

vbatts added 2 commits July 21, 2023 09:02
Reference #65

Signed-off-by: Vincent Batts <[email protected]>
Fixes #65

if the read bytes is 0, then don't even create the entry for that
padding.
This sounds like the solution for the issue opened, but I haven't found
a reproducer for this issue yet. :-\

Signed-off-by: Vincent Batts <[email protected]>
@vbatts
Copy link
Owner Author

vbatts commented Jul 21, 2023

all green

@vbatts vbatts merged commit 9982e47 into main Jul 21, 2023
@vbatts vbatts deleted the troubleshoot_65 branch July 21, 2023 13:10
@tianon
Copy link
Contributor

tianon commented Jul 21, 2023

Hmm zero bytes; some of the tags in my tianon/scratch image are variations on zero bytes 🤔 (varying compression)

@@ -135,6 +135,9 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
}
isEOF = true
}
if n == 0 {
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://pkg.go.dev/io#Reader says

Callers should treat a return of 0 and nil as indicating that nothing happened; in particular it does not indicate EOF.

so I think this should, pedantically, be

if n != 0 {
   if _, err := AddEntry(…); err != nil { fail }
}

letting isEOF break the loop, but continuing to the next iteration on Read returning 0, nil.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #68 .

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.

Empty entry added when no padding at end of file
3 participants