Zip 2GB Limit

From SlackWiki
Jump to navigation Jump to search

Fixing the 2GB file size limit in unzip

On some SlackWare versions, up to at least 12.0, the "unzip" command cannot unpack a file that is bigger than 2 GB. This applies to the file that is created being 2 GB, the .zip compressed file might be less than 2 GB. When the unzip command attempts to create the greater than 2 GB file, it makes the file up until it is 2 GB, and then produces this error message (PROP_ENT.TXT is the file that is bigger than 2 GB in this case) :

PROP_ENT.TXT:  write error (disk full?).  Continue? (y/n/^C) y

This procedure will update the unzip command to fix this. It may also fix problems in creating a .zip file that is bigger than 2 GB, but I have not been able to test that.

With these commands I retrieved the source package and unpacked the source trees:

mkdir infozip
cd infozip
tar xjvf unzip552.tar.bz2
tar xjvf zip232.tar.bz2

I next modified the Makefiles in the two source trees to use the flags "-DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" as described here:

To do that, I edited the file unzip-5.52/unix/Makefile and changed line 776 from "CF="-O3 -Wall -I. -DASM_CRC $(LOC)"" to "CF="-O3 -Wall -I. -DASM_CRC $(LOC) -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"".

I then editted zip-2.32/unix/Makefile and changed line 49 from "CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP)" to "CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP) -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" .

The second Makefile edit might not be necessary, it should fix any problems you are having with the "zip" command (the first Makefile fixes problems with the "unzip" command).

After editing those files, I re-tarred up the directories with the now fixed Makefiles, and then removed the source trees:

tar cjvf unzip552.tar.bz2 unzip-5.52/ 
tar cjvf zip232.tar.bz2 zip-2.32/
rm -rf unzip-5.52/ zip-2.32/

I then ran the SlackBuild to make the package:

chmod a+x infozip.SlackBuild

At this point the slackware package will be in /tmp/infozip-5.52-i486-2.tgz. You might wish to copy it somewhere if you are going to install it on a number of computers or save it. You can install it with "installpkg /tmp/infozip-5.52-i486-2.tgz" like a normal package.

If someone knows this is fixed in recent SlackWare versions, or has uploaded a precompiled package somewhere, please update this wiki.