Skip Menu |
 

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

Report information
The Basics
Id: 66361
Status: new
Priority: 0/
Queue: Archive-Zip

People
Owner: Nobody in particular
Requestors: geordie [...] korper.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.30
Fixed in: (no value)



Subject: $member->readFileHandle() corrupts the zip.
Download (untitled) / with headers
text/plain 1.4k
Saw this on both my Amazon EC2 web server and on my Mac OS X laptop. Webserver version was perl, v5.10.1 (*) built for i386-linux-thread-multi Linux 2.6.34.7-56.40.amzn1.i686 #1 SMP Fri Oct 22 18:48:33 UTC 2010 i686 i686 i386 GNU/Linux When I used Archive::Zip::MemberRead to read a member the zip was then corrupted. That seems like a pretty big deal. Fortunately I finally noticed in the documentation that $zip->contents(membername) exists which does not corrupt the zip and works much better for my needs anyway. Maybe the pod could be updated to clarify that you probably don't need to use it since there seem to be a fair number of examples on the internet of using it when $zip->contents() would be a cleaner solution. Still the bug is easy to reproduce and should probably be tracked. Here is an example script that demonstrates the problem: #!/usr/bin/perl use Archive::Zip; use Archive::Zip::MemberRead; my ($read, $buffer, $zip, $member); #Read in a zip file and then immediately save off a copy. $zip = Archive::Zip->new("sample.epub") or warn "Could not read source EPUB"; $zip->writeToFileNamed("good.zip"); #Read from a member # $member = $zip->memberNamed("META-INF/container.xml"); # $fh = $member->readFileHandle(); # # while (1) # { # $read = $fh->read($buffer, (32 * 1024)); # last if (!$read); # } # $fh->close(); #Save off the zip again (from which we have only read) and now it is corrupted. $zip->writeToFileNamed("bad.zip");


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.