mafintosh / tar-stream

tar-stream is a streaming tar parser and generator.
MIT License
406 stars 92 forks source link

Error is thrown when file is valid .tar.gz #107

Closed tiagonapoli closed 4 years ago

tiagonapoli commented 4 years ago

I have the following repository with the specific file that tar-stream is throwing error: https://github.com/tiagonapoli/tar-fs-test

I'm able to extract the tar using bash utility tar and tar node package as well. When using tar-fs or tar-stream I get:

Error: Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?
    at Object.exports.decode (/home/tiagonapoli/Desktop/tmp/tar-fs-test/node_modules/tar-stream/headers.js:267:43)
    at Extract.onheader (/home/tiagonapoli/Desktop/tmp/tar-fs-test/node_modules/tar-stream/extract.js:123:39)
    at Extract._write (/home/tiagonapoli/Desktop/tmp/tar-fs-test/node_modules/tar-stream/extract.js:249:8)
    at doWrite (/home/tiagonapoli/Desktop/tmp/tar-fs-test/node_modules/readable-stream/lib/_stream_writable.js:405:139)
    at writeOrBuffer (/home/tiagonapoli/Desktop/tmp/tar-fs-test/node_modules/readable-stream/lib/_stream_writable.js:394:5)
    at Extract.Writable.write (/home/tiagonapoli/Desktop/tmp/tar-fs-test/node_modules/readable-stream/lib/_stream_writable.js:303:11)
    at ReadStream.ondata (_stream_readable.js:713:22)
    at ReadStream.emit (events.js:203:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
Emitted 'error' event at:
    at errorOrDestroy (internal/streams/destroy.js:107:12)
    at Extract.onerror (_stream_readable.js:737:7)
    at Extract.emit (events.js:203:13)
    at Extract.onheader (/home/tiagonapoli/Desktop/tmp/tar-fs-test/node_modules/tar-stream/extract.js:125:12)
    at Extract._write (/home/tiagonapoli/Desktop/tmp/tar-fs-test/node_modules/tar-stream/extract.js:249:8)
    [... lines matching original stack trace ...]
    at ReadStream.emit (events.js:203:13)

Since yarn uses this package I'm having this issue with yarn as well.

mafintosh commented 4 years ago

Was this not a bug after all?

piranna commented 4 years ago

Was this not a bug after all?

Being a .tar.gz instead of a .tar, I suspect the problem was in the .gz part of the .tar.gz ;-)