I created an archive with several text files in it.
When I untar/uncompressed with this object the first file written to disk had the file I expected. But the second one had a string of leading null bytes.
After looking at the implementation, I realized that the read() method was not cleaning out the raw buffer at the end of each stream. It turns out that that tar add trailing \0 padding to fill up the record. So when the last block of a specific file is read, you need to dump the rest of the buffer.
I created an archive with several text files in it.
When I untar/uncompressed with this object the first file written to disk had the file I expected. But the second one had a string of leading null bytes.
After looking at the implementation, I realized that the read() method was not cleaning out the raw buffer at the end of each stream. It turns out that that tar add trailing \0 padding to fill up the record. So when the last block of a specific file is read, you need to dump the rest of the buffer.
I have a fix for this:
I will be submitting a pull request with this fix in a few minutes.