Skip Menu |
 

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

Report information
The Basics
Id: 28943
Status: resolved
Priority: 0/
Queue: Archive-Zip

People
Owner: Nobody in particular
Requestors: sean [...] blanton.com
Cc:
AdminCc:

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



Subject: Archive::Zip corrupts directory only entries from JAR
Download (untitled) / with headers
text/plain 1.6k
When reading a JAR file with some directory-only entries and then writing it back out using A::Z (without doing anything else), the archive is corrupt and can't be read according to both the zip and jar programs. The original JAR can be read by both zip and jar. If I update the XML file inside the JAR with the zip or jar programs, it works fine, but if use A::Z I get a corrupt archive. If I create the equivalent JAR using the zip program instead of the jar program, there is no problem. (But, I'm not creating the file - it comes from OpenMake, which uses Ant). Here is the code that exposes the problem, first create any jar file called foo.jar with the command 'jar cf foo.jar <files>': ------------------------------------------ #!/usr/bin/perl -w use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); use strict; my $az_foo = Archive::Zip->new('foo.jar'); die 'write error' unless $az_foo->overwriteAs('bar_bad.jar') == AZ_OK; my ( $meta_inf_member) = $az_foo->removeMember('META-INF/'); die 'write error' unless $az_foo->overwriteAs('bar_good.jar') == AZ_OK; ------------------------- zip gives a warning on bad_bar.jar: extended local header not found for META-INF/ jar gives an error on bad_bar.jar: java.util.zip.ZipException: only DEFLATED entries can have EXT descriptor at java.util.zip.ZipInputStream.readLOC(...) ----------------------------- You may not agree that it is important, but I'm fighting for Perl in the Java environment and winning, but this was a snag... ----------------------------- You may also refer to this post on perl monks... http://perlmonks.org/?node_id=632286 Thanks Sean Blanton
Download (untitled) / with headers
text/plain 485b
On Wed Aug 22 17:01:44 2007, sblanton wrote: Show quoted text
> jar gives an error on bad_bar.jar: > java.util.zip.ZipException: only DEFLATED entries can have EXT > descriptor > at java.util.zip.ZipInputStream.readLOC(...)
The described error is introduced through saving folders (or any items with a uncompressed size of 0) in STORED mode and leaving the GPBF_HAS_DATA_DESCRIPTOR_MASK unchanged. Adam fixed this in Version 1.21. Please try with a release >= 1.21 and check if the problem persists.
I believe this is resolved now.


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.