#604617 say exactly what byte the trailing garbage was encountered at

Package:
gzip
Source:
gzip
Description:
GNU compression utilities
Submitter:
Date:
2010-11-24 03:09:10 UTC
Severity:
minor
#604617#5
Date:
2010-11-23 02:07:06 UTC
From:
To:
We see
gzip: myfile: decompression OK, trailing garbage ignored

We think "Huh? What trailing garbage? What byte did it start at? I want
to investigate."

However unlike iconv(1), which when used without -c will tell you
exactly what byte problems were encountered, gunzip, gzip -l --test
--verbose etc. won't!

We see
   CAVEATS
       When writing compressed data to a tape, it is generally necessary to pad the output with zeroes up to
       a block boundary. When the data is read and the whole block is passed to  gunzip  for  decompression,
       gunzip  detects that there is extra trailing garbage after the compressed data and emits a warning by
       default.

OK, but do say what byte it started at, so that we can be sure.

(We can't just gunzip, then gzip back up again to compare the difference
with the orignal, as there are too many factors to make the whole file
different.)
Of course if there were an option to print out the exact switches a
file.gz was made with, maybe we could.)

P.S., the man page gives no idea who to report bugs to. It also says
"local" on it. OK, I found something in /usr/share/doc/gzip.

(P.S., I could have used IO::Uncompress::AnyUncompress to figure out what
that trailing garbage was, but after an hour of pondering that man page,
I gave up. Too complicated for me.)

#604617#10
Date:
2010-11-24 03:05:23 UTC
From:
To:
PM> Sorry if you found IO::Uncompress::AnyUncompress to complicated.

PM> Let me show you one way of retrieving the trailing data that may exist
PM> beyond the end  of a gzip file using another of my Perl modules

OK thanks very much. I will append it to the bug report in case someday
one else needs to figure out how. Looking at what you wrote, I see I
could not have figured out how to do it on my own. Thanks.

PM> So first we need a gzip file
PM> $ gzip <~/.bash_profile >/tmp/try.gz

PM> And now let's add some "trailing garbage"

PM> $ echo Hello World >>/tmp/try.gz

PM> This Perl script will print the trailing data

PM> use warnings;
PM> use strict;
PM> use IO::Uncompress::Gunzip qw(:all) ;
PM> use IO::File ;

PM> my $file =  "/tmp/try.gz";
PM> my $in = new IO::File "<$file";

PM> gunzip $in => "/dev/null",
PM>     TrailingData => my $trailing;

PM> print "[$trailing]\n;"

PM> cheers