views:

390

answers:

2
+1  A: 

It looks like a reasonable implementation. Have you tried decompressing the TGZ with a known good tool (i.e. tar -xzf) and seeing if that works OK?

Adam Wright
I tried now. That worked. It does not get crap.
quano
+5  A: 

Based on the code you posted it looks like your trying to read a Tar'ed gZip'ed file using gzip only.

My guess is that the "junk" at the start of the file after decompression is infact the TAR file header (I see a file name there right at the start).

More hints at Tar File Format point to the 512 byte size.

gzip can only compress a single file. If you are only trying to compress a single file you don't need to tar it first.

If you are trying to compress multiple files and as a single archive then you would need to use TAR and untar the files after you decompressed them.

Just a guess.

chris.

PyjamaSam
This sounds like the source of the issue. The files are tar:ed individually. How do you only "gz" them?
quano
Answer: gzip -c original > output
quano
Thanks, this was indeed the issue.
quano