Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.30
  • 1.31_04
Fixed in: (no value)



Subject: Calling ->overwrite() a second time renders a format error
I have a .zip file that I've stripped to the basics that simulate the problem.

Simply calling ->overwrite a second time produces: 

 

format error: bad signature: 0x4b502072 at offset 157 in file /tmp/jUUPRcL1N8/1_1_pretend.jar
 at /home/kent/.perlbrew/libs/perl-5.14.2@dzil_dev/lib/perl5/Archive/Zip.pm line 474
        Archive::Zip::_readSignature('IO::File=GLOB(0x17b7ee8)', '/tmp/jUUPRcL1N8/1_1_pretend.jar', 67324752) called at /home/kent/.perlbrew/libs/perl-5.14.2@dzil_dev/lib/perl5/Archive/Zip/ZipFileMember.pm line 71
        Archive::Zip::ZipFileMember::_seekToLocalHeader('Archive::Zip::ZipFileMember=HASH(0x17b77e0)') called at /home/kent/.perlbrew/libs/perl-5.14.2@dzil_dev/lib/perl5/Archive/Zip/ZipFileMember.pm line 397
        Archive::Zip::ZipFileMember::rewindData('Archive::Zip::ZipFileMember=HASH(0x17b77e0)') called at /home/kent/.perlbrew/libs/perl-5.14.2@dzil_dev/lib/perl5/Archive/Zip/Member.pm line 1084
        Archive::Zip::Member::_writeToFileHandle('Archive::Zip::ZipFileMember=HASH(0x17b77e0)', 'IO::File=GLOB(0x17b7de0)', 1, 0) called at /home/kent/.perlbrew/libs/perl-5.14.2@dzil_dev/lib/perl5/Archive/Zip/Archive.pm line 428
        Archive::Zip::Archive::writeToFileHandle('Archive::Zip::Archive=HASH(0x177c308)', 'IO::File=GLOB(0x17b7de0)') called at /home/kent/.perlbrew/libs/perl-5.14.2@dzil_dev/lib/perl5/Archive/Zip/Archive.pm line 464
        Archive::Zip::Archive::overwriteAs('Archive::Zip::Archive=HASH(0x177c308)', '/tmp/jUUPRcL1N8/1_1_pretend.jar') called at /home/kent/.perlbrew/libs/perl-5.14.2@dzil_dev/lib/perl5/Archive/Zip/Archive.pm line 448
        Archive::Zip::Archive::overwrite('Archive::Zip::Archive=HASH(0x177c308)') called at /tmp/arczip.pl line 38
Can't write to /tmp/oCzs7CZNp3.zip
 at /home/kent/.perlbrew/libs/perl-5.14.2@dzil_dev/lib/perl5/Archive/Zip/Archive.pm line 448
        Archive::Zip::Archive::overwrite('Archive::Zip::Archive=HASH(0x177c308)') called at /tmp/arczip.pl line 38
 

The Zip file is inlined as an escaped string.

Subject: arczip.pl
#!/usr/bin/env perl use 5.14.2; use strict; use warnings; # FILENAME: arczip.pl # CREATED: 01/24/12 07:09:20 by Kent Fredric (kentnl) <kentfredric@gmail.com> # ABSTRACT: Test double-overwrite behaviour use Archive::Zip; use File::Tempdir; use Path::Class qw( file dir ); my $tempdir = File::Tempdir->new(); my $dir = dir( $tempdir->name ); my $file = $dir->file("1_1_pretend.jar")->stringify; my ( @zip ) = ( "PK\3\4\n", "\0\0\0\0\x005]3\@\x9E)\0\xF2O\0\0\0O\0\0\0\24\0\34\0META-INF/MANIFEST.MFUT\t\0\3\xA5J\27OhC\16Oux\13\0\1\4\xE8\3\0\0\4\xE8\3\0\0 This is only a dummy file named META-INF/MANIFEST.MF in a dummy minecraft.jar PK\3\4\n", "\0\0\0\0\x005]3\@?\xD7'\x99P\0\0\0P\0\0\0\25\0\34\0META-INF/MOJANG_C.DSAUT\t\0\3\xA5J\27OhC\16Oux\13\0\1\4\xE8\3\0\0\4\xE8\3\0\0 This is only a dummy file named META-INF/MOJANG_C.DSA in a dummy minecraft.jar PK\1\2\36\3\n", "\0\0\0\0\x005]3\@\x9E)\0\xF2O\0\0\0O\0\0\0\24\0\30\0\0\0\0\0\0\0\0\0\xA4\x81\0\0\0\0META-INF/MANIFEST.MFUT\5\0\3\xA5J\27Oux\13\0\1\4\xE8\3\0\0\4\xE8\3\0\0PK\1\2\36\3\n", "\0\0\0\0\x005]3\@?\xD7'\x99P\0\0\0P\0\0\0\25\0\30\0\0\0\0\0\0\0\0\0\xA4\x81\x9D\0\0\0META-INF/MOJANG_C.DSAUT\5\0\3\xA5J\27Oux\13\0\1\4\xE8\3\0\0\4\xE8\3\0\0PK\5\6\0\0\0\0\2\0\2\0\xB5\0\0\0<\1\0\0\0\0", ); { open my $fh, '>', $file or die "$! writing $file"; $fh->print($_) for @zip; } { # Test my $zip = Archive::Zip->new(); $zip->read($file); $zip->removeMember('META-INF/MANIFEST.MF'); $zip->overwrite(); # $zip->addString('this is a test', 'stringMember.txt'); $zip->overwrite(); }