Skip Menu |
 

This queue is for tickets about the Archive-Zip CPAN distribution.

Report information
The Basics
Id: 25925
Status: resolved
Worked: 3 hours (180 min)
Priority: 0/
Queue: Archive-Zip

People
Owner: SHLOMIF [...] cpan.org
Requestors: perl [...] evancarroll.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.18
Fixed in: (no value)



Subject: Failed test
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1175214161-19775-12"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 71
failed test please advise Archive::Zip fails to extract and create zip.
Subject: error.jpg
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1175214160-19775-11"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: image/jpeg; name="error.jpg"
Content-Disposition: inline; filename="error.jpg"
Content-Transfer-Encoding: base64
Content-Length: 56897
Download error.jpg
image/jpeg 55.5k
error.jpg
Subject: unzip.pl
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1175214125-19775-10"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: application/x-perl; name="unzip.pl"
Content-Disposition: inline; filename="unzip.pl"
Content-Transfer-Encoding: base64
Content-Length: 1638
Download unzip.pl
text/x-perl 1.5k
#!/usr/bin/perl -l use strict; use warnings; use Archive::Zip qw( :ERROR_CODES ); use Digest::MD5; use Test::More tests => 5; use Carp; use constant ERROR_PRONE_FILE => 'error.jpg'; use constant ERROR_FILE => 'corrupterror.jpg'; use constant ERROR_ARCHIVE => 'out.zip'; my $zip = Archive::Zip->new(); my $md5 = Digest::MD5->new; my ( $before, $after ); ## ## OPEN GOOD FILE GET MD5 ## { open ( my $fh, '<', ERROR_PRONE_FILE ) or die 'Can not open file' ; $before = $md5->addfile( $fh )->md5_hex; close $fh; } ## ## Zip up and write out ## { $zip->addFile( ERROR_PRONE_FILE ); $zip->extractMember( ERROR_PRONE_FILE, ERROR_FILE ); open ( my $fh, '<', ERROR_FILE ) or die 'Can not open file' ; $after = $md5->addfile( $fh )->md5_hex; close $fh; unlink ERROR_FILE; cmp_ok( $after, 'eq', $before , 'Failed test, pre-zip, and post-pre-zip do not match' ); my $status = $zip->writeToFileNamed( ERROR_ARCHIVE ); cmp_ok( $status, '==', AZ_OK, 'Wrote zip out alright' ); } ## ## Read back ## { my $zip2; eval { $zip2 = Archive::Zip->new( ERROR_ARCHIVE ); }; ok( !$@, "This stupid bugger crashed again, error:\n$@" ); ok ( defined $zip2, 'Perl failed at spawning the object of doom' ); $zip2->extractMember( ERROR_FILE ); open ( my $fh, '<', ERROR_FILE ) or croak 'Can not open file' ; $after = $md5->addfile( $fh )->md5_hex; close $fh; unlink ERROR_FILE; unlink ERROR_ARCHIVE; cmp_ok( $after, 'eq', $before , 'Failed test, pre-zip, and post-zip do not match' ); } print "Success sums match up all th way through!! Congrats"; print "Verbose: [ $before eq $after ]"; 1;
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Message-Id: <rt-3.6.HEAD-27890-1175216713-1509.25925-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1175216713-27890-17"
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 236
Download (untitled) / with headers
text/plain 236b
use this test instead the other one had some typos in it, this test is successful the bug is in Archive::Zip not being $\ safe. This is a good round robin test though for creation and extraction of a zip using md5s for checking results.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: multipart/mixed; boundary="----------=_1175216713-27890-16"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: application/x-perl; name="unzip.pl"
Content-Disposition: inline; filename="unzip.pl"
Content-Transfer-Encoding: base64
Content-Length: 1762
Download unzip.pl
text/x-perl 1.7k
#!/usr/bin/perl use strict; use warnings; use Archive::Zip qw( :ERROR_CODES ); use Digest::MD5; use Test::More tests => 5; use Carp; use constant ERROR_PRONE_FILE => 'error.jpg'; use constant ERROR_FILE => 'corrupterror.jpg'; use constant ERROR_ARCHIVE => 'out.zip'; my $zip = Archive::Zip->new(); my ( $before, $after ); ## ## OPEN GOOD FILE GET MD5 ## { my $md5 = Digest::MD5->new; open ( my $fh, '<', ERROR_PRONE_FILE ) or die 'Can not open file' ; binmode( $fh ); $before = $md5->addfile( $fh )->md5_hex; close $fh; } ## ## ZIP UP AND WRITE OUT ## { my $md5 = Digest::MD5->new; $zip->addFile( ERROR_PRONE_FILE ); $zip->extractMember( ERROR_PRONE_FILE, ERROR_FILE ); open ( my $fh, '<', ERROR_FILE ) or die 'Can not open file' ; binmode( $fh ); $after = $md5->addfile( $fh )->md5_hex; close $fh; unlink ERROR_FILE; cmp_ok( $after, 'eq', $before , 'Failed test, pre-zip, and post-pre-zip do not match' ); my $status = $zip->writeToFileNamed( ERROR_ARCHIVE ); cmp_ok( $status, '==', AZ_OK, 'Wrote zip out alright' ); } ## ## READ BACK ## { my $md5 = Digest::MD5->new; my $zip2; eval { $zip2 = Archive::Zip->new( ERROR_ARCHIVE ); }; ok( !$@, "This stupid bugger crashed again, error:\n$@" ); ok ( defined $zip2, 'Perl failed at spawning the object of doom' ); $zip2->extractMember( ERROR_PRONE_FILE, ERROR_FILE ); open ( my $fh, '<', ERROR_FILE ) or croak 'Can not open file' ; binmode( $fh ); $after = $md5->addfile( $fh )->md5_hex; close $fh; unlink ERROR_FILE; unlink ERROR_ARCHIVE; cmp_ok( $after, 'eq', $before , 'Failed test, pre-zip, and post-zip do not match' ); } print "Success sums match up all th way through!! Congrats"; print "Verbose: [ $before eq $after ]"; 1;
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Message-Id: <rt-3.6.HEAD-19780-1175270246-1264.25925-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1175270246-19780-24"
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 220
Download (untitled) / with headers
text/plain 220b
This is a last update of the round-robin test of creating a zip and testing the result of it, this could use /dev/urandom to create the content prior to the zip, but I'm not sure how well that would port to ActiveState.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Type: multipart/mixed; boundary="----------=_1175270223-19780-23"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: application/x-perl; name="t1.pl"
Content-Disposition: inline; filename="t1.pl"
Content-Transfer-Encoding: base64
Content-Length: 1768
Download t1.pl
text/x-perl 1.7k
#!/usr/bin/perl use strict; use warnings; use Archive::Zip qw( :ERROR_CODES ); use Digest::MD5; use Test::More tests => 5; use Carp; use constant ERROR_PRONE_FILE => 'error.jpg'; use constant ERROR_FILE => 'corrupterror.jpg'; use constant ERROR_ARCHIVE => 'out.zip'; my $zip = Archive::Zip->new(); my ( $before, $after ); ## ## OPEN GOOD FILE GET MD5 ## { my $md5 = Digest::MD5->new; open ( my $fh, '<', ERROR_PRONE_FILE ) or die 'Can not open file' ; binmode( $fh ); $before = $md5->addfile( $fh )->hexdigest; close $fh; } ## ## ZIP UP AND WRITE OUT ## { my $md5 = Digest::MD5->new; $zip->addFile( ERROR_PRONE_FILE ); $zip->extractMember( ERROR_PRONE_FILE, ERROR_FILE ); open ( my $fh, '<', ERROR_FILE ) or die 'Can not open file' ; binmode( $fh ); $after = $md5->addfile( $fh )->hexdigest; close $fh; unlink ERROR_FILE; cmp_ok( $after, 'eq', $before , 'Failed test, pre-zip, and post-pre-zip do not match' ); my $status = $zip->writeToFileNamed( ERROR_ARCHIVE ); cmp_ok( $status, '==', AZ_OK, 'Wrote zip out alright' ); } ## ## READ BACK ## { my $md5 = Digest::MD5->new; my $zip2; eval { $zip2 = Archive::Zip->new( ERROR_ARCHIVE ); }; ok( !$@, "This stupid bugger crashed again, error:\n$@" ); ok ( defined $zip2, 'Perl failed at spawning the object of doom' ); $zip2->extractMember( ERROR_PRONE_FILE, ERROR_FILE ); open ( my $fh, '<', ERROR_FILE ) or croak 'Can not open file' ; binmode( $fh ); $after = $md5->addfile( $fh )->hexdigest; close $fh; unlink ERROR_FILE; unlink ERROR_ARCHIVE; cmp_ok( $after, 'eq', $before , 'Failed test, pre-zip, and post-zip do not match' ); } print "Success sums match up all th way through!! Congrats"; print "Verbose: [ $before eq $after ]"; 1;
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-19780-1175270246-1264.25925-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
References: <rt-3.6.HEAD-19780-1175270246-1264.25925-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-9328-1193683563-1425.25925-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
From: SHLOMIF [...] cpan.org
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 946
Download (untitled) / with headers
text/plain 946b
Hi ECARROL! On Fri Mar 30 11:57:27 2007, ECARROLL wrote: Show quoted text
> This is a last update of the round-robin test of creating a zip and > testing the result of it, this could use /dev/urandom to create the > content prior to the zip, but I'm not sure how well that would port
to Show quoted text
> ActiveState.
I'm sorry, but I get all-OKs with the script on the following configurations: 1. Mandriva Cooker with Archive-Zip 1.20. 2. Mandriva Cooker with Archive-Zip 1.18. 3. Mandriva Cooker with Archive-Zip trunk. 4. WinXP with ActivePerl and built-in Archive-Zip. 5. WinXP with ActivePerl and Archive-Zip 1.18. Can you still reproduce this problem? In any case, the test file needs some work if it is to be included in the distribution. I'd like to: 1. Get rid of the dependency on Digest::MD5. 2. Add Test::Count "# TEST" lines to the file. 3. Remove "Failed" strings from the beginning of tests. 4. Change the ERROR constants to something more neutral.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-3948-1195587085-1062.25925-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 203
Download (untitled) / with headers
text/plain 203b
I talked with ECARROLL on IRC now, and as he told me, the problem is that the tests fail if one specifies the "-l" flag to perl. I checked and was able to reproduce the problem with Archive-Zip trunk.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-3914-1195641231-1897.25925-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 561
Download (untitled) / with headers
text/plain 561b
Fixed in Subversion trunk: {{{{{{{{{{{{{{{{{ - Fixed http://rt.cpan.org/Public/Bug/Display.html?id=25925 : - Archive-Zip wrote faulty .zip files when $\ was set (such as when running using perl -l). - Incorporated a heavily modified version of ECARROLL's test file. - Thanks for ECARROLL for reporting it, and helping with the investigation. - The fix was to convert all $fh->print(@data) to $self->_print($fh, @data) where the _print() method localizes $\ to undef. }}}}}}}}}}}}}}}}} Thanks again! Regards, Shlomi Fish


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.