[SCM] Debian packaging of libarchive-zip-perl branch, master, updated. 8b86ff18fbd35f4cc647d01b0a42f712f2956d01

gregor herrmann gregoa at debian.org
Thu Jan 12 22:23:43 UTC 2012


The following commit has been merged in the master branch:
commit f6d77964cf02c3740b7dc1499ba7addcdccddcd2
Author: gregor herrmann <gregoa at debian.org>
Date:   Thu Jan 12 23:00:15 2012 +0100

    Add new patches
    0001-Make-the-embedded-File-Which-which-work-in-BEGIN-blo.patch,
    0002-TODO-test-for-rt.cpan.org-73797-deflated-empty-file-.patch,
    0003-Fix-for-rt.cpan.org-73797-deflated-empty-file-direct.patch: keep empty
    file deflated.
    
    Closes: #654899
    Thanks: Niko Tyni for analyzing the tricky issue and providing patches.

diff --git a/debian/patches/0001-Make-the-embedded-File-Which-which-work-in-BEGIN-blo.patch b/debian/patches/0001-Make-the-embedded-File-Which-which-work-in-BEGIN-blo.patch
new file mode 100644
index 0000000..c29d916
--- /dev/null
+++ b/debian/patches/0001-Make-the-embedded-File-Which-which-work-in-BEGIN-blo.patch
@@ -0,0 +1,42 @@
+From c191ff37a6998471dd37d6f5f383236a2e6f492c Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Tue, 10 Jan 2012 20:28:48 +0200
+Subject: [PATCH 1/3] Make the embedded File::Which::which() work in BEGIN
+ blocks
+
+The File::Which::which() subroutine uses a lexical variable @path_ext,
+which used to be uninitialized when the subroutine was called
+from BEGIN blocks.
+
+This included the 'use constant' lines, making both HAVEZIP and HAVEUNZIP
+constants unconditionally false and disabling 'testzip' functionality
+in for instance t/02_main.t:
+
+ ok 132 # skip No 'unzip' program to test against
+---
+ t/common.pl |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/t/common.pl b/t/common.pl
+index 808d6b8..1560fd2 100644
+--- a/t/common.pl
++++ b/t/common.pl
+@@ -7,6 +7,7 @@ use constant OUTPUTZIP => 'testout.zip';
+ 
+ # Do we have the 'zip' and 'unzip' programs?
+ # Embed a copy of the module, rather than adding a dependency
++BEGIN {
+ SCOPE: {
+ 	package File::Which;
+ 
+@@ -103,6 +104,7 @@ SCOPE: {
+ 	    }
+ 	}
+ }
++}
+ use constant HAVEZIP   => !! File::Which::which('zip');
+ use constant HAVEUNZIP => !! File::Which::which('unzip');
+ 
+-- 
+1.7.8.2
+
diff --git a/debian/patches/0002-TODO-test-for-rt.cpan.org-73797-deflated-empty-file-.patch b/debian/patches/0002-TODO-test-for-rt.cpan.org-73797-deflated-empty-file-.patch
new file mode 100644
index 0000000..0c643b5
--- /dev/null
+++ b/debian/patches/0002-TODO-test-for-rt.cpan.org-73797-deflated-empty-file-.patch
@@ -0,0 +1,77 @@
+From b8adb151fbc48f2cd7b5bb3b95a8e4d8152225e6 Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Tue, 10 Jan 2012 20:40:04 +0200
+Subject: [PATCH 2/3] TODO test for [rt.cpan.org #73797]: deflated empty file
+ / directory gets corrupted
+
+When reading a zip with a deflated empty file / directory and then
+writing it out, the output gets corrupted. 'unzip -t' outputs:
+
+Archive:  testout.zip
+META-INF/:  ucsize 0 <> csize 2 for STORED entry
+         continuing with "compressed" size value
+    testing: META-INF/                bad CRC 1a6cd7b3  (should be 00000000)
+
+Add a TODO test for this. The test file was created with 'jar'
+from OpenJDK 6:
+
+ mkdir empty && /usr/lib/jvm/java-6-openjdk/bin/jar c empty/ > empty.jar
+---
+ t/17_bug_73797.t |   29 +++++++++++++++++++++++++++++
+ t/data/jar.zip   |  Bin 0 -> 427 bytes
+ 2 files changed, 29 insertions(+), 0 deletions(-)
+ create mode 100644 t/17_bug_73797.t
+ create mode 100644 t/data/jar.zip
+
+diff --git a/t/17_bug_73797.t b/t/17_bug_73797.t
+new file mode 100644
+index 0000000..9280d84
+--- /dev/null
++++ b/t/17_bug_73797.t
+@@ -0,0 +1,29 @@
++#!/usr/bin/perl
++
++use strict;
++
++BEGIN {
++    $|  = 1;
++    $^W = 1;
++}
++use Archive::Zip qw( :ERROR_CODES );
++use Test::More tests => 4;
++
++BEGIN {
++    unshift @INC, "t/"; 
++    require( File::Spec->catfile('t', 'common.pl') )
++                or die "Can't load t/common.pl";
++}
++
++my $zip = Archive::Zip->new();
++isa_ok( $zip, 'Archive::Zip' );
++is( $zip->read('t/data/jar.zip'), AZ_OK, 'Read file' );
++is($zip->writeToFileNamed(OUTPUTZIP), AZ_OK, 'Wrote file');
++
++my ($status, $zipout) = testZip();
++# STDERR->print("status= $status, out=$zipout\n");
++skip( "test zip doesn't work", 1 ) if $testZipDoesntWork;
++TODO: {
++    local $TODO = "deflated empty files/directories corrupt the output";
++is( $status, 0, "output zip isn't corrupted" );
++}
+diff --git a/t/data/jar.zip b/t/data/jar.zip
+new file mode 100644
+index 0000000000000000000000000000000000000000..a58c356035743874f2d61b2e4fbaf240f8e9b73d
+GIT binary patch
+literal 427
+zcmWIWW at Zs#-~d9YA}t37B*4kQ!r<!~;;8HC=cfPf6axb at Lx49s2S^1IR9OH{%_2Y*
+zaLvAsex7cw!6ACSZl8V6oc8h7)w{^+t*dqJ%=yhh23L$9JT21m^40P5y;!=6g>%MB
+z$s^J;H8NPHKhyk?rY8PWJX~!0l4oMt70*;(XMQUBSi}f+NWSGHR(GH^APjN{7uZpP
+zXue<uik7772Y53wi7=pg6y^(%M^ORX<sfgPYelvf<V^&y1v24Ukvt7Dfr|mR`w%7^
+W12Vy`Wn}{iG6Uf{ApIP~VE_PkdPo=m
+
+literal 0
+HcmV?d00001
+
+-- 
+1.7.8.2
+
diff --git a/debian/patches/0003-Fix-for-rt.cpan.org-73797-deflated-empty-file-direct.patch b/debian/patches/0003-Fix-for-rt.cpan.org-73797-deflated-empty-file-direct.patch
new file mode 100644
index 0000000..49aba6a
--- /dev/null
+++ b/debian/patches/0003-Fix-for-rt.cpan.org-73797-deflated-empty-file-direct.patch
@@ -0,0 +1,42 @@
+From 92b2b67dd4728d10b053f172063be6ad1d14da8f Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Wed, 11 Jan 2012 21:47:46 +0200
+Subject: [PATCH 3/3] Fix for [rt.cpan.org #73797]: deflated empty file /
+ directory gets corrupted
+
+The output header needs to be refreshed also in the case where
+uncompressed size is 0 but the compressed size is > 0 (deflation
+of an empty file.)
+---
+ lib/Archive/Zip/Member.pm |    2 +-
+ t/17_bug_73797.t          |    3 ---
+ 2 files changed, 1 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Archive/Zip/Member.pm b/lib/Archive/Zip/Member.pm
+index f86ef75..d4d709a 100644
+--- a/lib/Archive/Zip/Member.pm
++++ b/lib/Archive/Zip/Member.pm
+@@ -1011,7 +1011,7 @@ sub _writeToFileHandle {
+     # I need to do this if I can't refresh the header
+     # and I don't know compressed size or crc32 fields.
+     my $headerFieldsUnknown = (
+-        ( $self->uncompressedSize() > 0 )
++        ( $self->uncompressedSize() > 0 or $self->compressedSize > 0 )
+           and ($self->compressionMethod() == COMPRESSION_STORED
+             or $self->desiredCompressionMethod() == COMPRESSION_DEFLATED )
+     );
+diff --git a/t/17_bug_73797.t b/t/17_bug_73797.t
+index 9280d84..8cacf54 100644
+--- a/t/17_bug_73797.t
++++ b/t/17_bug_73797.t
+@@ -23,7 +23,4 @@ is($zip->writeToFileNamed(OUTPUTZIP), AZ_OK, 'Wrote file');
+ my ($status, $zipout) = testZip();
+ # STDERR->print("status= $status, out=$zipout\n");
+ skip( "test zip doesn't work", 1 ) if $testZipDoesntWork;
+-TODO: {
+-    local $TODO = "deflated empty files/directories corrupt the output";
+ is( $status, 0, "output zip isn't corrupted" );
+-}
+-- 
+1.7.8.2
+

-- 
Debian packaging of libarchive-zip-perl



More information about the Pkg-perl-cvs-commits mailing list