redhotpenguin / perl-Archive-Zip

Archive::Zip as seen at https://metacpan.org/pod/Archive::Zip
Other
15 stars 44 forks source link

Archive::Zip 1.68: some tests fail on AIX 6.1 64 bits #87

Open sblondeel opened 3 years ago

sblondeel commented 3 years ago

Attached are STDOUT and STDERR to "make test".

Please let me know if you would like more information about the system.

Regards. Archive-Zip-1.68-make-test-AIX-61-64bits-stderr.txt Archive-Zip-1.68-make-test-AIX-61-64bits-stdout.txt

pmqs commented 3 years ago

The failure you are getting suggests corruption of the data being written to file.

#   Failed test at t/02_main.t line 107.
# Got result:
# Archive:  /tmp/testout-4svme.zip
# warning [/tmp/testout-4svme.zip]:  76 extra bytes at beginning or within zipfile
#   (attempting to process anyway)
# error [/tmp/testout-4svme.zip]:  reported length of central directory is
#   -76 bytes too long (Atari STZip zipfile?  J.H.Holm ZIPSPLIT 1.1
#   zipfile?).  Compensating...
#     testing: testdir/kE07cwkkQI/      OK
# 
# note:  didn't find end-of-central-dir signature at end of central dir.
#   (please check that you have transferred or created the zipfile in the
#   appropriate BINARY mode and that you have compiled UnZip properly)
# At least one warning-error was detected in /tmp/testout-4svme.zip.
# Exit value 512

I suspect this is going to be a endian issue (Linux/Windows is Little Endian, AIX is Big Endian).

Without access to AIX, we are going to need to see an example of a corrupt zip file created with Archive::Zip. Could you try the following please?

Post the output from running perl -V (note that is an uppercase "V".

Change directory into the Archive::Zip source directory and run this script

use strict;
use warnings;

use lib 'lib';
use Archive::Zip;

my $zip = Archive::Zip->new();

my $member = $zip->addDirectory('lib');
$zip->writeToFileNamed("test.zip");

That should create a file called test.zip. This is what unzip should show if it is created properly

$ unzip -l test.zip 
Archive:  test.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2021-05-09 09:30   lib/
---------                     -------
        0                     1 file

Can you uploadtest.zip`?

sblondeel commented 3 years ago

Thanks for your quick reply. You will find attached the files requested; I added the output of unzip -l for good measure (on AIX, you can do it on your own box of course).

As I wasn't sure the .zip file extension would pass (Outlook / my personal mail) security, I packed all three files in .tgz format Let me know if you prefer me to unpack them and repost, or if this is fine.

Correction: github does not accept the .tgz file extension so I added to it a phony .zip extension. Ignore the last .zip extension issue-87.tgz.zip , and then you have a .tar.gz file containing test.zip and two .txt files with explicit names. I hope this makes sense :-)

PS: This funny interface inserts attachments where your mouse pointer was at the time apparently. Whatever..

pmqs commented 3 years ago

Hmm, that didn't fail for you as I had expected. Your AIX box created the zip file correctly.

The other possibility is the unzip that ships with AIX may not support ZIP64.

Can you run unzip -v and see if it mentions ZIP64_SUPPORT?

$ unzip -v
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 9.2.0 for Unix (Linux ELF).

UnZip special compilation options:
        ACORN_FTYPE_NFS
        COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
        SET_DIR_ATTRIB
        SYMLINKS (symbolic links supported, if RTL and file system permit)
        TIMESTAMP
        UNIXBACKUP
        USE_EF_UT_TIME
        USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
        USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
        UNICODE_SUPPORT [wide-chars, char coding: UTF-8] (handle UTF-8 paths)
        LARGE_FILE_SUPPORT (large files over 2 GiB supported)
        ZIP64_SUPPORT (archives using Zip64 for large files supported)
        USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.8, 13-Jul-2019)
        VMS_TEXT_CONV
        WILD_STOP_AT_DIR
        [decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
           UNZIP:  [none]
        UNZIPOPT:  [none]
         ZIPINFO:  [none]
      ZIPINFOOPT:  [none]

For good measure, try creating a another zip file with this script below and see what unzip -l thinks of it. The only difference with this one is is will force a ZIP64 zip file.

use strict;
use warnings;

use lib 'lib';
use Archive::Zip;

my $zip = Archive::Zip->new();
$zip->desiredZip64Mode(1);
my $member = $zip->addDirectory('lib');
$zip->writeToFileNamed("test.zip");

Can you post the results again please?

sblondeel commented 3 years ago

build/Archive-Zip-1.68# unzip -v UnZip 5.51 of 22 May 2004, by Info-ZIP. Maintained by C. Spieler. Send bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ; see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with cc for Unix (IBM AIX) on Sep 27 2004.

UnZip special compilation options: COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported) LZW_CLEAN (PKZIP/Zip 1.x unshrinking method not supported) SET_DIR_ATTRIB TIMESTAMPbuild/Archive-Zip-1.68# unzip -v UnZip 5.51 of 22 May 2004, by Info-ZIP. Maintained by C. Spieler. Send bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ; see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with cc for Unix (IBM AIX) on Sep 27 2004.

UnZip special compilation options: COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported) LZW_CLEAN (PKZIP/Zip 1.x unshrinking method not supported) SET_DIR_ATTRIB TIMESTAMP USE_EF_UT_TIME USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported) VMS_TEXT_CONV [decryption, version 2.9 of 05 May 2000]

UnZip and ZipInfo environment options: UNZIP: [none] UNZIPOPT: [none] ZIPINFO: [none] ZIPINFOOPT: [none]

test.zip

    USE_EF_UT_TIME
    USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
    VMS_TEXT_CONV
    [decryption, version 2.9 of 05 May 2000]

UnZip and ZipInfo environment options: UNZIP: [none] UNZIPOPT: [none] ZIPINFO: [none] ZIPINFOOPT: [none]

unzip-l2.txt

pmqs commented 3 years ago

Thanks , that looks like the issue then. Your unzip doesn't seem to support ZIP64.

Just to be certain, can you post the output from running unzip -l against the test.zip file please?

sblondeel commented 3 years ago

build/Archive-Zip-1.68# unzip -l test.zip > /tmp/unzip-l3.txt 2> /tmp/unzip-l3.err.txt unzip-l3.err.txt unzip-l3.txt

pmqs commented 3 years ago

OK. Here is the root cause -- your unzip doesn't support ZIP64 and the test harness for Archive::Zip doesn't check for that.

You can ignore the test failure

sblondeel commented 3 years ago

That is what I did so far, I wasn't too worried. Do you plan to add this check in your harness? (skip or ignore those tests). Sorry to bother you with 2004 issues in 2021 but my context has little Unix culture... and "some" technical debt.

pmqs commented 3 years ago

You are correct, fix for this would involve generating a skip if unzip doesn't support ZIP64. It's jus a matter of someone finding the time to do it.

pmqs commented 3 years ago

You are correct, fix for this would involve generating a skip if unzip doesn't support ZIP64. It's jus a matter of someone finding the time to do it.

kbulgrien commented 2 years ago

This issue also shows up on SCO Openserver 5.0.7 MP5 where UnZip 5.52 of 28 February 2005, by Info-ZIP also does not support ZIP64. Some attempts were made to build unzip 6.0, but, as of this writing, they have not produced a suitable unzip. (In case anyone wonders, though SCO Openserver 5.0.7 MP5 only offers perl 5.8.8, this was observed under a perl 5.10.1 interpreter.)