mafintosh / tar-stream

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

Fix encodeOct to parse correctly headers and do not add extra space to support old tar formats #115

Closed Cheprer closed 1 year ago

Cheprer commented 4 years ago

I've faced the issue with wrongly parsed header of old tar format accepted by busybox. Based on the https://en.wikipedia.org/wiki/Tar_%28computing%29#File_format. For uid header, for example, it should be used all 7 bytes instead of parsing 6 and adding a space. The allocated buffer then uses \0 by default on the remaining bytes.

This seems to be fixed for size and mtime headers. Using 11 instead of ten.

Please take a look and try and let me know if I'm wrong but for me this works. Cheers.

Mastermind of the fix @sairon

Cheprer commented 4 years ago

I'll take a more deeper look at the tests in few days. But seems to me that it is caused by generated fixtures made with wrong header parsing.

mafintosh commented 4 years ago

@Cheprer any update? you think it's the fixtures that are wrong still?

Cheprer commented 4 years ago

@mafintosh forgot about this PR. I'll try to take a look at it within a week.

mafintosh commented 4 years ago

@Cheprer no rush, open source, we are all just volunteering :)

mafintosh commented 1 year ago

reopen if relevant