Tar gzip writer adds bytes after flush

Im trying to make a tar.gzip byte[].

Im having strange behaviour, I write a file entity, but after making flushes the buffer grows without any data written to my tar.writer, how come? What am I doing wrong?


This will also make me get flate: corrupt input before offset errors when trying to read from created []byte

Here is a smaller example that shows the problem


I don’t know enough about the operation of the gzip package to know if this is a bug or not.

What is the idea behind calling Flush() multiple times without calling Write?

the code is extracted from a larger “small project”, Im having problems with corrupted output after using tar.gz writers and I found this strange behaviour. In my code I dont use Flush at all, I use close but somehow I still get corrupted output.

I was going to test gzip and tar separated, thank you, I modified your example to try archive/tar package and that the behaviour is different! tar is not adding any extra bytes to the buffer after flushing.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.