[Reproducible-commits] [strip-nondeterminism] 01/01: gzip: don't set a canonical timestamp if file didn't already have a timestamp

Andrew Ayer agwa at andrewayer.name
Tue May 26 18:32:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

agwa-guest pushed a commit to branch master
in repository strip-nondeterminism.

commit 3f47b7497f64cdec8b51b8f2596287474225dcfd
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Tue May 26 11:16:44 2015 -0700

    gzip: don't set a canonical timestamp if file didn't already have a timestamp
    
    Closes: #785742
---
 lib/File/StripNondeterminism/handlers/gzip.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/File/StripNondeterminism/handlers/gzip.pm b/lib/File/StripNondeterminism/handlers/gzip.pm
index e49c136..472952b 100644
--- a/lib/File/StripNondeterminism/handlers/gzip.pm
+++ b/lib/File/StripNondeterminism/handlers/gzip.pm
@@ -54,8 +54,10 @@ sub normalize {
 	my $new_flg = $flg;
 	$new_flg &= ~FNAME;	# Don't include filename
 	$new_flg &= ~FHCRC;	# Don't include header CRC (not all implementations support it)
-	# If there's no canonical time set, zero out the mtime (this is what `gzip -n` does):
-	$mtime = $File::StripNondeterminism::canonical_time // 0;
+	unless ($mtime == 0) {	# Don't set a deterministic timestamp if there wasn't already a timestamp
+		# If there's no canonical time set, zero out the mtime (this is what `gzip -n` does):
+		$mtime = $File::StripNondeterminism::canonical_time // 0;
+	}
 	# TODO: question: normalize some of the other fields, such as OS?
 
 	my $tempfile = File::Temp->new(DIR => dirname($filename));

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/strip-nondeterminism.git



More information about the Reproducible-commits mailing list