extract, list: auto-detect and decompress gzip archives#168
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
===========================================
+ Coverage 60.83% 96.54% +35.70%
===========================================
Files 7 10 +3
Lines 789 1157 +368
Branches 24 26 +2
===========================================
+ Hits 480 1117 +637
+ Misses 309 39 -270
- Partials 0 1 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
437f082 to
f41d9b9
Compare
|
Hi Kevin! I'm holding this for just a bit while I get the support for reading from stdin in as that will change some function interfaces. I'll review this right after. |
|
Please tage #158 in the commit description. |
|
I see quite a lot of patches just came in; anything I can help review? |
83e869e to
371d6cc
Compare
I filed Issues for each piece of missing functionality so that we can coordinate. If more people are showing up, I want them to be able to claim an issue rather than have any conflict. But I'll tag you in two others (that are blocking these at the moment) |
b98b8d5 to
08cf2ca
Compare
08cf2ca to
63389ab
Compare
Teach tar to auto-detect gzip-compressed archives for list and extract operations while keeping archive creation explicit via -z/--gzip. The implementation now routes archive I/O through a shared compression helper so the read path can sniff gzip input and the write path can wrap output in gzip only when requested. Add integration tests covering gzip create, list, extract, explicit -z on extract/list, round-tripping a gzip archive, and invalid gzip input failure behavior.
63389ab to
32faabe
Compare
Previously, extract and list passed the raw file bytes directly to the tar parser without decompression. When given a .tar.gz file, the compressed gzip stream was interpreted as tar headers, producing errors like "numeric field did not have utf-8 text" on the checksum field.
Detect gzip compression by reading the two-byte magic number (0x1f 0x8b) at the start of the file, and wrap the reader in a GzDecoder when present. Plain .tar files continue to work as before.
Confirmed this patch allows extraction of Go source code from https://go.dev/dl/ (previously we would get an error).