[Reproducible-commits] [strip-nondeterminism] 03/05: Add timestamp clamping support to gzip handler

Andrew Ayer agwa at andrewayer.name
Wed Jun 8 04:50:02 UTC 2016


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

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

commit 835de36071d397d320b6d77a43c010bfd27c8881
Author: Andrew Ayer <agwa at andrewayer.name>
Date:   Tue Jun 23 10:25:32 2015 -0700

    Add timestamp clamping support to gzip handler
---
 lib/File/StripNondeterminism/handlers/gzip.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/File/StripNondeterminism/handlers/gzip.pm b/lib/File/StripNondeterminism/handlers/gzip.pm
index 472952b..3126911 100644
--- a/lib/File/StripNondeterminism/handlers/gzip.pm
+++ b/lib/File/StripNondeterminism/handlers/gzip.pm
@@ -54,9 +54,9 @@ 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)
-	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;
+	my $canonical_time = $File::StripNondeterminism::canonical_time // 0; # gzip treats 0 as "no timestamp"
+	if (!$File::StripNondeterminism::clamp_time || $mtime > $canonical_time) {
+		$mtime = $canonical_time;
 	}
 	# TODO: question: normalize some of the other fields, such as OS?
 

-- 
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