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 96.84% 97.77% +0.92%
==========================================
Files 11 15 +4
Lines 1492 1751 +259
Branches 29 34 +5
==========================================
+ Hits 1445 1712 +267
+ Misses 46 38 -8
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 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
63389ab to
32faabe
Compare
32faabe to
adb7fe2
Compare
adb7fe2 to
3576007
Compare
33822fa to
77374c7
Compare
Teach tar to auto-detect gzip-compressed archives for list and extract operations while keeping archive creation explicit via -z/--gzip. Route archive I/O through a shared compression helper that supports plain, gzip, and zstd streams. This keeps the existing --zstd behavior while adding gzip sniffing on reads and gzip encoding on writes when requested. Add integration tests covering gzip create, list, extract, explicit -z on extract/list, stdio round-tripping, invalid gzip input, and continued zstd create/list/extract behavior.
77374c7 to
f8884ba
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).