mhd.tahawi has asked for the wisdom of the Perl Monks concerning the following question:

I have a zip file created by the zip command in Ubuntu and updated by the Archive Manager included in Ubuntu.
I was trying to read the members of that archive using PERL as follows:
use strict; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); my $zip = Archive::Zip->new(); unless ($zip->read('/home/mohamad/Desktop/VM/vm.zip') == AZ_OK ){ die 'read error'; } my @files = $zip->memberNames(); print join("\n" , @files) ."\n";
This zip file is about 12 GB and I know that this module has the limitation of zipping no more than 4 GB, but I am trying to see if it can at least be used to access the members of a a +4GB archive. here is the error I am getting:
at /usr/share/perl5/Archive/Zip.pm line 477. Archive::Zip::_readSignature('IO::File=GLOB(0xb75ae8)', '/home/mohamad/Desktop/VM/vm.zip') called at /usr/share/perl5/Archive/Zip/Archive.pm line 603 Archive::Zip::Archive::readFromFileHandle('Archive::Zip::Archive= +HASH(0xb75c20)', 'IO::File=GLOB(0xb75ae8)', '/home/mohamad/Desktop/VM/vm.zip') called at /usr/share/perl5/Archive/Zip/Archive.pm line 548 Archive::Zip::Archive::read('Archive::Zip::Archive=HASH(0xb75c20) +', '/home/mohamad/Desktop/VM/vm.zip') called at test.pm line 6 read error + at test.pm line 7.
my questions are:

Replies are listed 'Best First'.
Re: Archive::Zip error when reading a zip file format error: bad signature
by jellisii2 (Hermit) on Aug 01, 2014 at 11:46 UTC

    There is an assumption that the zip file in question is not corrupted. Have you verified this assumption?

    Since you haven't said what you're doing, and the file sizes suggest that all you need to do is read/extract a part of the file. If so, this might be some good information: Per Archive::Zip's documentation:

    If you are just going to be extracting zips (and/or other archives) you are recommended to look at using Archive::Extract instead, as it is much easier to use and factors out archive-specific functionality.

    A quick search of Archive::Zip doesn't suggest there's a file size ceiling. Can you point that out to me? Are you using the latest?

    In the event you have no control over the zip file you're processing, you always have the BigHammer(tm) approach of unzip the file with an external tool, grab what you want, and wipe out the temp folder.

    I'm not sure if switching to tar with gzip would get you any traction or not. The heart of tar is designed for dealing with these kinds of massive files. Since you're in a *NIX toolchain for the creation, it might be worth looking at.

    You probably already know this, but the underlying filesystem is going to matter. There's an assumption that FAT32 isn't anywhere in the chain, but that is an assumption. Having been burned in the past by overlooking the obvious, I mention this.

      Thank you so much for your reply, I started to feel ignored by the monks
      first of all: I have only tested the zip file through opening it with archive manager. is that considered enough ? and here is what I am really trying to do:

      according to This therad Archive::Zip can only handle up to 4 GB. I have a code that includes zipping functionality and I need to extend it to be able to zip + GB archives.
      I am using IO::Compress::Zip to do that since I can pass an option zip64 => 1 for +4 GB files, but I also need to rename the member files inside the archives after zipping and IO::Compress::Zip doesn't seem to offer this functionality.
      so I thought about zipping with IO::Compress::Zip and renamein member files with Archive::Zip. I ran a little test before I do this to see if it is possible with big archives and that was my original post.

      so in a summary I need a way to create a big archive and then rename member files.
      thank you !
        "I started to feel ignored by the monks "
        "feel ignored" ? ... in just under two hours?

        That may reflect a misunderstanding of how the Monastery works... especially when the question was less than crystal clear (judging by your need to clarify.)

        We're here to help, but the 'free-help' and 'instant-help' domains are not always co-terminus. Have some patience, mhd.tahawi, and recognize that the good Monks are not always instantly available to solve your problems.

        And consider, also, the possibility that reversing the workflow you specified ("create a big archive and then rename member files") would solve your problem without needing to do renames inside the zipfile.


        check Ln42!