Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1451953 - Incorrect timestamps on unzipped files.
Summary: Incorrect timestamps on unzipped files.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: unzip
Version: 25
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Petr Stodulka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-18 01:59 UTC by Chris Karel
Modified: 2017-07-20 06:14 UTC (History)
2 users (show)

Fixed In Version: unzip-6.0-32.fc25 unzip-6.0-34.fc26 unzip-6.0-34.fc27
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-19 16:22:03 UTC
Type: Bug


Attachments (Terms of Use)
Attachment created by example. (412 bytes, application/zip)
2017-05-18 01:59 UTC, Chris Karel
no flags Details

Description Chris Karel 2017-05-18 01:59:39 UTC
Created attachment 1279853 [details]
Attachment created by example.

Description of problem:

Unzip will sometimes round up timestamps of unpacked files.  This results in a 1 second difference between the timestamp shown via zipinfo -T, and the unzipped file on disk

Version-Release number of selected component (if applicable):
zip-3.0-16.fc24.x86_64
unzip-6.0-31.fc25.x86_64

How reproducible:

Very

Steps to Reproduce:
1.  Zip files with different timestamps.
2.  Note the timestamps stored in the archive with `zipinfo -T`
3.  Unzip the archive
4.  Compare the timestamps with `ls --full-time`
5.  Note a difference of 1 second on some files.  (Perhaps rounding up?)

Actual results:
Timestamps are off by a second on some files

Expected results:
Timestamps should match between zipinfo and ls.

Additional info:

Example -- note the timestamps on file "1"

$ touch 1
$ zip test.zip 1
  adding: 1 (stored 0%)
$ touch 2
$ zip test.zip 2
  adding: 2 (stored 0%)
$ touch 3
$ zip test.zip 3
  adding: 3 (stored 0%)
$ ls --full-time
total 4
-rw-r--r--. 1 root root   0 2017-05-17 20:56:03.581961297 -0500 1
-rw-r--r--. 1 root root   0 2017-05-17 20:56:12.893885812 -0500 2
-rw-r--r--. 1 root root   0 2017-05-17 20:56:16.116859685 -0500 3
-rw-r--r--. 1 root root 412 2017-05-17 20:56:17.289850177 -0500 test.zip
$ rm -f 1 2 3
$ unzip test.zip
Archive:  test.zip
 extracting: 1
 extracting: 2
 extracting: 3
$ ls --full-time
total 4
-rw-r--r--. 1 root root   0 2017-05-17 20:56:04.000000000 -0500 1
-rw-r--r--. 1 root root   0 2017-05-17 20:56:12.000000000 -0500 2
-rw-r--r--. 1 root root   0 2017-05-17 20:56:16.000000000 -0500 3
-rw-r--r--. 1 root root 412 2017-05-17 20:56:17.289850177 -0500 test.zip
$ zipinfo -T test.zip
Archive:  test.zip
Zip file size: 412 bytes, number of entries: 3
-rw-r--r--  3.0 unx        0 bx stor 20170517.205603 1
-rw-r--r--  3.0 unx        0 bx stor 20170517.205612 2
-rw-r--r--  3.0 unx        0 bx stor 20170517.205616 3
3 files, 0 bytes uncompressed, 0 bytes compressed:  0.0%


$ cat /etc/os-release
NAME=Fedora
VERSION="25 (Server Edition)"
ID=fedora
VERSION_ID=25
PRETTY_NAME="Fedora 25 (Server Edition)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:25"
HOME_URL="https://fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=25
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=25
PRIVACY_POLICY_URL=https://fedoraproject.org/wiki/Legal:PrivacyPolicy
VARIANT="Server Edition"
VARIANT_ID=server

$ rpm -q zip unzip
zip-3.0-16.fc24.x86_64
unzip-6.0-31.fc25.x86_64

Comment 1 Jiri Hruska 2017-07-11 11:14:56 UTC
Although `zip` stores both the legacy ZIP "DOS" timestamp (with 2-second precision) and an extension block with proper Unix timestamp, `unzip` is not using the latter during extraction because of a bug.

Apart from the possible 1 second difference this has also negative implications when working across multiple time zones. Because the legacy timestamp uses local time zone, when e.g. someone packs source code in UTC+2 and someone else uses it later in UTC-8, their project will be always rebuilding for the next 10 hours, because `make` thinks the sources are still newer than the build outputs.

Unfortunately it seems the upstream Info-ZIP folks still don't have anything like a repo to check for updates since 2009, but luckily Debian already has a patch for this:
http://sources.debian.net/patches/unzip/6.0-21/17-restore-unix-timestamps-accurately.patch/
I have verified their version 6.0-21 does the right thing.

Thanks for your consideration.

Comment 2 Petr Stodulka 2017-07-14 15:17:51 UTC
Thanks Jirka for your time & investigation. Yes, repositories of (un)zip are not public and probably will not be.

Comment 3 Fedora Update System 2017-07-14 21:20:31 UTC
unzip-6.0-34.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-28fd8ef47d

Comment 4 Fedora Update System 2017-07-14 21:20:38 UTC
unzip-6.0-32.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-077cbd8617

Comment 5 Fedora Update System 2017-07-15 21:51:46 UTC
unzip-6.0-32.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-077cbd8617

Comment 6 Fedora Update System 2017-07-16 21:21:44 UTC
unzip-6.0-34.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-28fd8ef47d

Comment 7 Fedora Update System 2017-07-19 16:22:03 UTC
unzip-6.0-34.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2017-07-19 20:23:38 UTC
unzip-6.0-32.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.