Bug 192315

Summary: does -X work?
Product: [Fedora] Fedora Reporter: Ben Konrath <ben>
Component: zipAssignee: Ivana Varekova <varekova>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-22 14:41:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ben Konrath 2006-05-18 21:14:38 UTC
From the zip man page, the -X flag:

-X     Do not save extra file attributes (Extended Attributes on OS/2, 
       uid/gid and file times on Unix).

I assumed that the file times would not be saved if I used this option. However,
when I tried to use the -X flag, the file times are still saved. It seems that
the -X flag only disables the zip file creation time from being stored in the
zip. Here's a little example:

# make some test files
% echo "This is a test file." > test1.txt
% echo "This is also a test file." > test2.txt

# make two zips with the same content and same file times
% zip -X zip1 test1.txt test2.txt
  adding: test1.txt (stored 0%)
  adding: test2.txt (stored 0%)
% zip -X zip2 test1.txt test2.txt
  adding: test1.txt (stored 0%)
  adding: test2.txt (stored 0%)

# change the file time on one file and make a third zip
% touch test1.txt
% zip -X zip3 test1.txt test2.txt
  adding: test1.txt (stored 0%)
  adding: test2.txt (stored 0%)

# check to see if the md5sums are the same
# the first two are, but zip3 (with the changed file time) is different
% md5sum zip1.zip zip2.zip zip3.zip
44562da3c409e2b6404ff42f2e68c7a1  zip1.zip
44562da3c409e2b6404ff42f2e68c7a1  zip2.zip
4e7ddffe736502bf6b0d6f98b0ef57e8  zip3.zip

# list the files and notice that the file times are being saved
% unzip -l zip1.zip
Archive:  zip1.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
       21  05-18-06 14:42   test1.txt
       26  05-18-06 14:43   test2.txt
 --------                   -------
       47                   2 files
% unzip -l zip2.zip
Archive:  zip2.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
       21  05-18-06 14:42   test1.txt
       26  05-18-06 14:43   test2.txt
 --------                   -------
       47                   2 files
% unzip -l zip3.zip
Archive:  zip3.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
       21  05-18-06 14:44   test1.txt
       26  05-18-06 14:43   test2.txt
 --------                   -------
       47                   2 files
%

Is this the correct behaviour, or is this a bug? The reason I'm filing this bug
is because having a flag to stop zip from storing the file times of the files
within a zip is needed to make md5sums of zip files the same across platforms
(which is needed to avoid multilib conflicts).

Comment 1 Ivana Varekova 2006-05-22 14:41:23 UTC
Modify time is a part of compulsory file header which have to be in zip file.
Extended voluntary field (which is not saved if you use -X) contains values -
access time and change time.