Menu

#2730 (ok 3.0) Cannot import zip file

fixed
1
2014-08-20
2008-07-31
No

Trying to import a zipfile fails with the message:

Error in ZIP archive: Compressed size is not equal with the value in header information.

This message originates from the library unzip.lib.php which compares the strlen() of the binary data from the zipfile with the compressed size field in the header. I'm not entirely sure where the problem lies, but I do know that my zipfile is valid. Other tools (unzip, zipinfo, Archive::ZIP (Perl)) do not complain.

My guess is that the calculation of the actual size is not correct. Zipinfo tells me:

gertjan@byte12:~/Desktop$ zipinfo -2vth test.zip
Archive: test.zip 601 bytes 1 file

End-of-central-directory record:
-------------------------------

Actual offset of end-of-central-dir record: 579 (00000243h)
Expected offset of end-of-central-dir record: 579 (00000243h)
(based on the length of the central directory and its expected offset)

This zipfile constitutes the sole disk of a single-part archive; its
central directory contains 1 entry. The central directory is 93
(0000005Dh) bytes long, and its (expected) offset in bytes from the
beginning of the zipfile is 486 (000001E6h).

There is no zipfile comment.

Central directory entry #1:
---------------------------

db002260_henk-2008-07-31_08h19.sql

offset of local header from start of archive: 0 (00000000h) bytes
file system or operating system of origin: Unix
version of encoding software: 2.3
minimum file system compatibility required: MS-DOS, OS/2 or NT FAT
minimum software version required to extract: 2.0
compression method: deflated
compression sub-type (deflation): normal
file security status: not encrypted
extended local header: no
file last modified on (DOS date/time): 2008 Jul 31 08:19:04
file last modified on (UT extra field modtime): 2008 Jul 31 08:19:04 local
file last modified on (UT extra field modtime): 2008 Jul 31 06:19:04 UTC
32-bit CRC value (hex): 0ee52f7d
compressed size: 401 bytes
uncompressed size: 1224 bytes
length of filename: 34 characters
length of extra field: 13 bytes
length of file comment: 0 characters
disk number on which file begins: disk 1
apparent file type: text
Unix file attributes (100644 octal): -rw-r--r--
MS-DOS file attributes (00 hex): none

The central-directory extra field contains:
- A subfield with ID 0x5455 (universal time) and 5 data bytes.
The local extra field has UTC/GMT modification/access times.
- A subfield with ID 0x7855 (Unix UID/GID) and 0 data bytes.

There is no file comment.
1 file, 1224 bytes uncompressed, 401 bytes compressed: 67.2%

The zipfile is created with zip on Linux. I attached the zipfile to this report.

Additional question: why not use the ZIp-library from PHP (http://www.php.net/manual/en/ref.zip.php)? My guess is that that library is more robust, and more thoroughly tested than unzip.lib.php. At least make this configurable in config.inc.php!

Discussion

  • Gertjan Oude Lohuis

     
  • Gertjan Oude Lohuis

    Logged In: YES
    user_id=2164261
    Originator: YES

    Additional note: this problem exists in latest commit (11441) in Subversion, and exists for quite some time now.

     
  • Marc Delisle

    Marc Delisle - 2008-08-09
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2008-08-09

    Logged In: YES
    user_id=210714
    Originator: NO

    Good suggestion: I even removed unzip.lib.php from 3.0.

     
  • Marc Delisle

    Marc Delisle - 2008-08-09
    • priority: 5 --> 1
    • summary: Importing a zipfile fails (header size != actual size) --> (ok 3.0) Cannot import zip file
    • status: open --> open-fixed
     
  • Gertjan Oude Lohuis

    Logged In: YES
    user_id=2164261
    Originator: YES

    I updated our installation to 3.0.0-alpha and importing a zipfile now works correctly. Thanks!

     
  • Marc Delisle

    Marc Delisle - 2008-09-27
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed
     
MongoDB Logo MongoDB