Package: perl-modules
Version: 5.10.0-19
Severity: normal
Tags: patch

Archive::Tar fails to validate some archives created by SunOS and HP-UX
tar (e.g.
http://ftp.us.debian.org/debian/pool/main/n/nateon/nateon_1.0-20080814.orig.tar.gz)

        use Archive::Tar;
        my $tar = Archive::Tar->new;
        $tar->read('nateon_1.0-20080814.orig.tar.gz',1);

returns lots of checksum errors

GNU tar documents that these archives use a wrong checksums, but accept
these archives anyway:
http://www.gnu.org/software/tar/manual/tar.html#SEC139

The attached patch makes Archive::Tar::File::validate() accepts both
checksum algorithms.

Best Regards,
-- 
Nekral
--- /usr/share/perl/5.10.0/Archive/Tar/File.pm	2009-02-21 18:40:40.933204400 +0100
+++ /tmp/File.pm	2009-02-21 18:40:21.353209691 +0100
@@ -445,7 +445,8 @@
 
     ### don't know why this one is different from the one we /write/ ###
     substr ($raw, 148, 8) = "        ";
-	return unpack ("%16C*", $raw) == $self->chksum ? 1 : 0;
+	return (   (unpack ("%16C*", $raw) == $self->chksum)
+	        or (unpack ("%16c*", $raw) == $self->chksum)) ? 1 : 0;
 }
 
 =head2 has_content

Reply via email to