FS#14127 - [unzip] lacks large fiel support

Attached to Project: Arch Linux
Opened by N K (synackfin) - Monday, 06 April 2009, 20:17 GMT
Last edited by Douglas Soares de Andrade (dsa) - Wednesday, 10 June 2009, 15:26 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Douglas Soares de Andrade (dsa)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:
package "zip" is correctly compiled with LARGE_FILE_SUPPORT and ZIP64_SUPPORT
package "unzip", however, lacks these settings.

Additional info:
* package version(s)
* config and/or log files etc.


Steps to reproduce:
unzip any file whose _compressed_ size is over 4.3GB
run `zip -v` to see the flags zip was compiled with
run `unzip -v` to see the flags unzip was compiled with

This task depends upon

Closed by  Douglas Soares de Andrade (dsa)
Wednesday, 10 June 2009, 15:26 GMT
Reason for closing:  Fixed
Additional comments about closing:  Upgraded for unzip 6.0 with large file support.
Comment by N K (synackfin) - Monday, 06 April 2009, 20:20 GMT
http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1239049145004+28353475&threadId=1120242

According to HP, unzip pre-6.0 lacks the ability to deal w/ files with compressed size > 4GB

Comment by Greg (dolby) - Tuesday, 07 April 2009, 11:43 GMT
Thats great but the latest unzip version is 5.52. http://www.info-zip.org/UnZip.html
Care to link to versions higher than 6?
Comment by N K (synackfin) - Tuesday, 07 April 2009, 12:23 GMT
InfoZip version 6.0 is still in internal beta, 6.0e will be a public beta (and is supposed to be the release candidate for 6.0). But ArchLinux shouldn't wait for 6.0 -- extra/unzip already ships with unzip542-size-64bit.patch, but when I examined the patch, the problem is clear. The patch uses 64bit variables when dealing with the uncompressed size, but continues to use 32bit variables when dealing with the compressed size.
Comment by N K (synackfin) - Tuesday, 07 April 2009, 12:29 GMT
The PKGBUILD also seems to have this strange line:
[ "$CARCH" = "x86_64" ] && (patch -Np0 -i ../unzip542-size-64bit.patch || return 1)

I think it's strange, because gcc supports int64_t and uint64_t on 32-bit machines (and therefore the patch would work on 32-bit machines), and i686 boxes should be allowed to unzip files with a compressed size > 4GB.
Comment by N K (synackfin) - Tuesday, 07 April 2009, 12:41 GMT
Fyi - there seems to be some bug in zipinfo.c zi_long() function -- the 64-bit patch doesn't modify the variables in this function and they remain 32-bit, causing it to wrap on 4.2GB.

// Output for unzip -l (4.6GB big file) -- shows wrong compressed size (725MB)
# unzip -l S111408-v3.zip
Archive: S111408-v3.zip
warning [S111408-v3.zip]: 4294967296 extra bytes at beginning or within zipfile
(attempting to process anyway)
Length Date Time Name
-------- ---- ---- ----
725360569 11-14-08 12:47 S111408-v3.txt
-------- -------
725360569 1 file

// Output from gunzip -l (4.6GB big file) -- shows correct results
[nkumar@archusb Nasdaq]$ gunzip -l S111408-v3.zip
compressed uncompressed ratio uncompressed_name
4697150667 -1 0.0% S111408-v3.zip
Comment by N K (synackfin) - Tuesday, 07 April 2009, 12:42 GMT
Fyi, I am running on an x86-64 box:

# uname -a
Linux xxxxx 2.6.28-ARCH #1 SMP PREEMPT Tue Mar 17 07:22:53 CET 2009 x86_64 Quad-Core AMD Opteron(tm) Processor 2376 AuthenticAMD GNU/Linux
Comment by N K (synackfin) - Tuesday, 07 April 2009, 12:49 GMT Comment by N K (synackfin) - Tuesday, 07 April 2009, 12:52 GMT
Since it's all open-source, can we copy the Fedora patches over to ArchLinux?

Fedora unzip542.rpm summary:
Summary: A utility for unpacking zip files
Name: unzip
Version: 5.52
License: BSD
Source: ftp://ftp.info-zip.org/pub/infozip/src/unzip552.tar.gz
Patch0: unzip542-rpmoptflags.patch
Patch2: unzip-5.51-link-segv.patch
Patch3: unzip-5.51-link-segv2.patch
Patch6: unzip-5.52-toctou.patch
Patch7: unzip-5.52-near-4GB.patch
Patch8: unzip-5.52-near-4GB2.patch
Patch9: unzip-5.52-long-filename.patch
Patch10: unzip-5.52-makefile.patch

Comment by N K (synackfin) - Tuesday, 07 April 2009, 12:56 GMT
Fyi, the Fedora rpm lists the source as unzip552.tar.gz, but InfoZip changed the URL, the path is now .tgz:
ftp://ftp.info-zip.org/pub/infozip/src/unzip552.tgz
Comment by Robson Roberto Souza Peixoto (robsonpeixoto) - Tuesday, 19 May 2009, 12:41 GMT
Try upgrade to unzip 6.0
   PKGBUILD (0.9 KiB)

Loading...