Closed palavrov closed 3 years ago
I'm getting this error on certain tar file that unpacks perfectly fine using other tools, any thoughts? (I've zipped it up to attach it here) - The tar's come from a vxWorks platform if that helps?
@PaulMcGuinness, the issue I got was caused by me modifying tar-stream header.size
variable. If your code is modifying this variable too could be a good reason for this error message.
No, not doing any modifications. Using the simple example code. It's definitely tar version related (as newer versions of the same platform's backup work fine)
So ... I debugged a bit and got the problem - your tar file fails the proper header checks ( look here if you are curious https://github.com/mafintosh/tar-stream/blob/e08fcd845744c43e1e71343f117be9993208103a/headers.js#L264 ).
Solution is to:
1) Conform with the expected tar file format.
2) Pass to extract({allowUnknownFormat:true})
3) Do a PR here with a fix how to detect the header
I would suggest to go for 1
Many thanks for the solutions - I can't change the tar format, and (3) is outside my abilities, so I'll try (2) tomorrow :-)
Option (2) worked perfectly - Many thanks! :-)
If you wanna add a note about that to the readme send a PR 😊
https://github.com/mafintosh/tar-stream/blob/b737a8d5d24306ee14c46184fb2d34a862b08c79/extract.js#L180-L181
If
header.size
is modified for some reason inentry
event handler causes this error. For now quick fix is just to avoid modifying theheader.size
in the event handler but at least it needs to be documented or even better to make and use a copy of the size in local variable.