On Mon Jan 30 05:31:16 2006, bevapost@pobox.sk wrote:
Show quoted text> I have Created test1.tar dummy Archive. (attached)
> It contain Garbage at the end (as expected).
Thanks for that archive.. it allowed me to track down the problem.
It turns out archive::tar's garbage protection isn't as robust as it should be,
but i've found a way to add another check, that at least tackles 'trailing
garbage' well enough;
==== //member/kane/archive-tar-new/lib/Archive/Tar.pm#99 - /Users/kane/sources/p4/
other/archive-tar-new/lib/Archive/Tar.pm ====
270a271,282
Show quoted text> ### according to the posix spec, the last 12 bytes of the header are
> ### null bytes, to pad it to a 512 byte block. That means if these
> ### bytes are NOT null bytes, it's a corrrupt header. See:
> ### www.koders.com/c/
fidCE473AD3D9F835D690259D60AD5654591D91D5BA.aspx
Show quoted text> ### line 111
> { my $nulls = join '', "\0" x 12;
> unless( $nulls eq substr( $chunk, 500, 12 ) ) {
> $self->_error( qq[Invalid header block at offset $offset] );
> next LOOP;
> }
> }
>
This seems to effectively stop any garbage being produced from the
archive you provided... a simple ptar on it now warns about the invalid
headers, but operates normally otherwise:
$ perl bin/ptar -t -f /tmp/test1.tar
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
Invalid header block at offset unknown at bin/ptar line 36
/var/adm/new._ACL
/var/adm/new._OWNER
/var/adm/new._PROD_DFLT_ACL
/var/adm/new._SOC_DFLT_ACL
/var/adm/new.secrets
/var/adm/cleanup.log
I'll be adding this fix to A::T 1.29, which will be released shortly.
Thanks for reporting,