LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-11-2013, 02:45 PM   #1
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,855

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
Does "unzip -X" work in Info-ZIP UnZip 6.00?


According to the unzip man page, the -X option should, "restore [...] user and group info (UID/GID) under Unix".

I made a test zip file as follows (using Info-ZIP Zip 3.0) as root:

Code:
# touch testfile
# chown ruario:users testfile
# zip -m testfile.zip testfile
 adding: testfile (stored 0%)
Then restored it with UnZip (6.00) as follows:

Code:
# unzip -X testfile.zip 
Archive:  testfile.zip
 extracting: testfile
I then checked the file ownership for the restored file, expecting it to be owned by ruario:users, however:

Code:
# ls -l testfile
-rw-r--r-- 1 root root 0 Sep 11 21:28 testfile
Nonetheless, looking at the zip file info I can see Zip has stored an entry for Unix UID/GID:

Code:
# 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.
So any thoughts on why this fails for me? Does it work for anyone else?

P.S. Distro is Slackware64 14.0. I have recompiled infozip package (to add bzip2 compression).

Last edited by ruario; 09-12-2013 at 02:11 AM. Reason: example was missing '-X'; simplified example
 
Old 09-11-2013, 02:51 PM   #2
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,855

Original Poster
Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
I also looked at www.info-zip.org/UnZip.html and one of the highlight, new features in UnZip 6.0 is:

Quote:
On Unix, support restoration of 32-bit UID/GID data using the new "ux" IZUNIX3 extra field introduced with Zip 3.0.
So I can't see any reason why this wouldn't work but (for me at least) it completely fails.
 
Old 09-12-2013, 01:12 AM   #3
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,855

Original Poster
Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
A quick test and confirmation that others see the same (even if you have no suggestions as to how to fix) would be helpful. I tried to test on MacOSX 10.8.4, but this version has UnZip 5.52 (though it does have Zip 3.0). This means that UnZip reports the subfield with ID 0x7875 as unknown, hence I would not expect this to work anyway. I locally compiled UnZip 6.00 (on Mac) and tested that instead and then the result is the same as with (Slackware) Linux, the 0x7875 subfield is recognised as Unix UID/GID but UnZip still does not appear to use this information, even if I use -X.

EDIT: In the mean time I have logged this as a potential bug on Sourceforge and via Info-Zip's own bug reporting page.

Last edited by ruario; 09-12-2013 at 02:06 AM.
 
Old 09-12-2013, 02:37 AM   #4
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,855

Original Poster
Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
A bit more searching and I found the answer on the Info-Zip forums

EDIT: I have requested that this be fixed in Slackware (-current)

Last edited by ruario; 09-12-2013 at 04:26 AM.
 
Old 09-12-2013, 04:49 AM   #5
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,855

Original Poster
Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
If anyone else has this problem and wants to fix it for themselves, apply this patch to process.c in Info-Zip UnZip source package (unzip60.tar.gz or unzip60.zip)

Code:
--- ./process.c.orig    2009-03-06 02:25:10.000000000 +0100
+++ ./process.c 2013-09-12 10:51:16.000000000 +0200
@@ -2895,9 +2895,9 @@
         */
 
 #ifdef IZ_HAVE_UXUIDGID
-            if (eb_len >= EB_UX3_MINLEN
-                && z_uidgid != NULL
-                && (*((EB_HEADSIZE + 0) + ef_buf) == 1)
+            if ((eb_len >= EB_UX3_MINLEN)
+                && (z_uidgid != NULL)
+                && ((*((EB_HEADSIZE + 0) + ef_buf) == 1)))
                     /* only know about version 1 */
             {
                 uch uid_size;
@@ -2909,10 +2909,10 @@
                 flags &= ~0x0ff;      /* ignore any previous UNIX field */
 
                 if ( read_ux3_value((EB_HEADSIZE + 2) + ef_buf,
-                                    uid_size, z_uidgid[0])
+                                    uid_size, &z_uidgid[0])
                     &&
                      read_ux3_value((EB_HEADSIZE + uid_size + 3) + ef_buf,
-                                    gid_size, z_uidgid[1]) )
+                                    gid_size, &z_uidgid[1]) )
                 {
                     flags |= EB_UX2_VALID;   /* signal success */
                 }
And compile with LOCAL_UNZIP=-DIZ_HAVE_UXUIDGID, e.g.:

Code:
make -f unix/Makefile generic LOCAL_UNZIP=-DIZ_HAVE_UXUIDGID
 
Old 09-15-2013, 04:21 AM   #6
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 1,855

Original Poster
Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
Slackware (-current) just added a patch to their infozip package to fix UID/GID support in unzip (Debian had already done this previously). If you are running unzip 6.00 and it does not correctly support *nix UID/GID, you might want to request that your distro does the same.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How does one "zip" a folder with Linux .? How does Windows user "unzip" same ? brjoon1021 Linux - Software 5 12-19-2010 12:10 AM
[SOLVED] zip - unzip info deelinux Linux - Newbie 7 06-11-2010 06:06 AM
What is the difference between using "jar xvf" and "unzip" to unzip the zip-file? thomas2004ch Linux - Newbie 4 08-27-2009 05:11 AM
Where to "unzip" tar files? alaskazimm Linux - Software 5 04-30-2004 11:55 PM
how do i unzip a .zip? lax2sman Linux - General 2 02-11-2002 05:17 PM


All times are GMT -5. The time now is 01:01 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration