Firstly, thank you for your products! Secondly I have tried to test and explain this issue correctly to the best of my ability, however I may well have misunderstood how Zip/UnZip is supposed to work. If so, apologies in advance for any time wasted.
The issue is that I cannot restore Unix UIDs/GIDs when creating zips with Zip 3.0 and restoring with UnZip 6.00 (even with the '-X' switch specified). This has been tested on Slackware 14.0 (x86 32-Bit), Slackware64 14.0 (x86_64 64-Bit) and MacOS X 10.8.4 (x86_64).
I made a test zip file as follows (using Info-ZIP Zip 3.0) as root:
# touch testfile
# chown ruario:users testfile
# zip -m testfile.zip testfile
adding: testfile (stored 0%)
Then restored it with unzip as follows:
# unzip -X testfile.zip
Archive: testfile.zip
extracting: testfile
Checking the file ownership for the restored file I would expect it to be owned by ruario:users, however:
# ls -l testfile
-rw-r--r-- 1 root root 0 Sep 11 21:28 testfile
Nonetheless, if I check the zip file info I can see Zip has stored an entry for Unix UID/GID:
# unzip -Z -v testfile.zip | grep -A1 0x7875
- A subfield with ID 0x7875 (Unix UID/GID (any size)) and 11 data bytes:
01 04 e8 03 00 00 04 64 00 00 00.
Question: Am I using Zip/UnZip correctly to store/restore UID/GID information? If not I would appreciate a guidance in how to make use of UID/GID support.
Notes on building Zip/UnZip: I self compiled both Zip and UnZip on all machines using 'make -f unix/Makefile generic' with the only obvious tweak being that I added bzip2 sources to get bzip2 support. Here is some -v output for 32-Bit Slack and Mac (I do not have access to the 64-Bit Slack machine as I write this).
Slackware 14.0:
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
Currently maintained by E. Gordon. Please send bug reports to
the authors using the web page at www.info-zip.org; see README for details.
Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip,
as of above date; see http://www.info-zip.org/ for other sites.
Compiled with gcc 4.7.1 for Unix (Linux ELF) on Sep 11 2013.
Zip special compilation options:
ASM_CRC
ASMV
USE_EF_UT_TIME (store Universal Time)
BZIP2_SUPPORT (bzip2 library version 1.0.6, 6-Sept-2010)
bzip2 code and library copyright (c) Julian R Seward
(See the bzip2 license for terms of use)
SYMLINK_SUPPORT (symbolic links supported)
LARGE_FILE_SUPPORT (can read and write large files on file system)
ZIP64_SUPPORT (use Zip64 to store large files in archives)
UNICODE_SUPPORT (store and read UTF-8 Unicode paths)
STORE_UNIX_UIDs_GIDs (store UID/GID sizes/values using new extra field)
UIDGID_NOT_16BIT (old Unix 16-bit UID/GID extra field not used)
[encryption, version 2.91 of 05 Jan 2007] (modified for Zip 3)
Encryption notice:
The encryption code of this program is not copyrighted and is
put in the public domain. It was originally written in Europe
and, to the best of our knowledge, can be freely distributed
in both source and object forms from any country, including
the USA under License Exception TSU of the U.S. Export
Administration Regulations (section 740.13(e)) of 6 June 2002.
Zip environment options:
ZIP: [none]
ZIPOPT: [none]
UnZip 6.00 of 20 April 2009, 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 gcc 4.7.1 for Unix (Linux ELF) on Sep 11 2013.
UnZip special compilation options:
ASM_CRC
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)
MBCS-support (multibyte character support, MB_CUR_MAX = 6)
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.6, 6-Sept-2010)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]
UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]
MacOSX 10.8.4:
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
Currently maintained by E. Gordon. Please send bug reports to
the authors using the web page at www.info-zip.org; see README for details.
Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip,
as of above date; see http://www.info-zip.org/ for other sites.
Compiled with gcc 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.27) for Unix (Mac OS X) on Sep 11 2013.
Zip special compilation options:
USE_EF_UT_TIME (store Universal Time)
BZIP2_SUPPORT (bzip2 library version 1.0.6, 6-Sept-2010)
bzip2 code and library copyright (c) Julian R Seward
(See the bzip2 license for terms of use)
SYMLINK_SUPPORT (symbolic links supported)
LARGE_FILE_SUPPORT (can read and write large files on file system)
ZIP64_SUPPORT (use Zip64 to store large files in archives)
UNICODE_SUPPORT (store and read UTF-8 Unicode paths)
STORE_UNIX_UIDs_GIDs (store UID/GID sizes/values using new extra field)
UIDGID_NOT_16BIT (old Unix 16-bit UID/GID extra field not used)
[encryption, version 2.91 of 05 Jan 2007] (modified for Zip 3)
Encryption notice:
The encryption code of this program is not copyrighted and is
put in the public domain. It was originally written in Europe
and, to the best of our knowledge, can be freely distributed
in both source and object forms from any country, including
the USA under License Exception TSU of the U.S. Export
Administration Regulations (section 740.13(e)) of 6 June 2002.
Zip environment options:
ZIP: [none]
ZIPOPT: [none]
UnZip 6.00 of 20 April 2009, 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 gcc 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.27) for Unix Mac OS X on Sep 11 2013.
UnZip special compilation options:
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 [char coding: UTF-8] (handle UTF-8 paths)
MBCS-support (multibyte character support, MB_CUR_MAX = 6)
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.6, 6-Sept-2010)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]
UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]
Ok, I have just found this thread which answers the question:
http://www.info-zip.org/phpBB3/viewtopic.php?f=3&t=402
Using the patch that axel provided and building as follows fixed this for me:
make -f unix/Makefile generic LOCAL_UNZIP=-DIZ_HAVE_UXUIDGID
Will there be a minor update to the UnZip 6.0* series with the patch included and unix/Makefile corrected to include LOCAL_UNZIP=-DIZ_HAVE_UXUIDGID by default? It would seem warranted given that the page http://www.info-zip.org/UnZip.html has the following as one of its highlight features for 6.0
Additionally, is this also fixed in the latest Beta versions of UnZip now?
Last edit: Ruarí Ødegaard 2013-09-12
I checked UnZip Beta 6.10b and see that this is still broken.
The patch itself
Thanks for the report.
Probably not. The work-around is available, and the next beta kit
(probably 6.10c, with the fix) should appear relatively soon.
True.
Ok, fair enough I understand. I'll see if I can get it patched by my distro. In the mean time I'll compile my own.
Thanks again as always for all your hard work!! :)
P.S. I'll also check out 6.10c when it is available.