-
Notifications
You must be signed in to change notification settings - Fork 6
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
Implement Stream Decompression for tar #183
Merged
Merged
Conversation
This file contains 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
tempusfrangit
force-pushed
the
streaming-decompress-tar
branch
2 times, most recently
from
March 13, 2024 21:21
b38cb8e
to
8f69551
Compare
tempusfrangit
force-pushed
the
streaming-decompress-tar
branch
from
March 13, 2024 22:55
8f69551
to
7ad44ef
Compare
dkhokhlov
reviewed
Mar 14, 2024
tempusfrangit
force-pushed
the
streaming-decompress-tar
branch
2 times, most recently
from
March 20, 2024 22:54
cda1292
to
9c938c1
Compare
We should probably do something where we log a warning about compressed streams being a poor experience. |
Implement stream decompression for tar files. This mean that -x becomes smart enough to handle lzw, bzip2, gzip, and xz (common tar compression) formats automatically. This will remove a sharp edge on pget and handle cases of compressed tar files elegantly.
tempusfrangit
force-pushed
the
streaming-decompress-tar
branch
from
April 26, 2024 15:43
9c938c1
to
49a79c3
Compare
philandstuff
approved these changes
Apr 26, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be simplified quite a bit but it's good
Instead of implementing the peek reader, wrap everything in bufio.Reader and lean on it's peek() capabilities. This also allows for a simpler bytes.HasPrefix use for the magic numbers instead of needing to deal with the Endian-ness of the magic bytes -- critically this eliminates the padding for the 48-bit magic bytes header for some compression types.
Global PAX Headers are a meta-header that applies to subsequent files. However, in most cases these values are 100% ignorable as the underlying archive/tar handles merging things. However, the global header stat is not persisted across headers (as per the spec); notably this is largely "OK" as most values within the global header are not commonly used or relevant (i.e. size is unlikely to be relevant as that is file by file and not global). We can always add futher PAX Header support if needed, but the reality is pget is highly optimized for it's use case and doesn't go too far out of it's way for cases that aren't relevant.
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.
Implement stream decompression for tar files. This mean that -x becomes smart enough to handle lzw, bzip2, gzip, and xz (common tar compression) formats automatically. This will remove a sharp edge on pget and handle cases of compressed tar files elegantly.
It is recommended to use uncompressed TAR as a weights source as decompression is significantly slower for very minimal space savings.
This code is intended to make pget slightly more forgiving but does not improve performance.
Closes: #1