[Git][reproducible-builds/strip-nondeterminism][debian] 5 commits: Support timestamp clamping of "tIME" chunks in .png files. (Closes: #7)

Chris Lamb gitlab at salsa.debian.org
Sun Jul 7 14:49:17 UTC 2019



Chris Lamb pushed to branch debian at Reproducible Builds / strip-nondeterminism


Commits:
849f8516 by Chris Lamb at 2019-06-27T09:55:46Z
Support timestamp clamping of "tIME" chunks in .png files. (Closes: #7)

- - - - -
6a40d5db by Chris Lamb at 2019-07-03T12:03:09Z
Identify data files from the COmmon Data Access (CODA) framework as being .zip files.

- - - - -
fd76a540 by Chris Lamb at 2019-07-07T14:43:27Z
Release version 1.2.0

- - - - -
6ee146e6 by Chris Lamb at 2019-07-07T14:43:43Z
Merge tag '1.2.0' into debian

Release version 1.2.0

* tag '1.2.0':
  Release version 1.2.0
  Identify data files from the COmmon Data Access (CODA) framework as being .zip files.
  Support timestamp clamping of "tIME" chunks in .png files. (Closes: #7)

- - - - -
8be5038e by Chris Lamb at 2019-07-07T14:46:20Z
Update changelog for 1.2.0-1 release

- - - - -


5 changed files:

- debian/changelog
- lib/File/StripNondeterminism.pm
- lib/File/StripNondeterminism/handlers/png.pm
- + t/fixtures/png/bug_931039.png.in
- + t/fixtures/png/bug_931039.png.out


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,13 @@
+strip-nondeterminism (1.2.0-1) unstable; urgency=medium
+
+  * Upload to unstable now that buster has been released.
+  * Support timestamp clamping of "tIME" chunks in .png files.
+    (Closes: #931039)
+  * Identify data files from the COmmon Data Access (CODA) framework
+    as being .zip files.
+
+ -- Chris Lamb <lamby at debian.org>  Sun, 07 Jul 2019 11:45:14 -0300
+
 strip-nondeterminism (1.1.3-1) experimental; urgency=medium
 
   * Workaround Archive::Zip's incorrect handling of the localExtraField field


=====================================
lib/File/StripNondeterminism.pm
=====================================
@@ -25,7 +25,7 @@ use POSIX qw(tzset);
 
 our($VERSION, $canonical_time, $clamp_time);
 
-$VERSION = '1.1.3'; # <https://semver.org/>
+$VERSION = '1.2.0'; # <https://semver.org/>
 
 sub init() {
 	$ENV{'TZ'} = 'UTC';
@@ -90,7 +90,7 @@ sub get_normalizer_for_file($) {
 		return _handler('png');
 	}
 	# zip
-	if (m/\.(zip|pk3|epub|whl|xpi|htb|zhfst|par)$/
+	if (m/\.(zip|pk3|epub|whl|xpi|htb|zhfst|par|codadef)$/
 		&& _get_file_type($_) =~ m/Zip archive data|EPUB document/) {
 		return _handler('zip');
 	}


=====================================
lib/File/StripNondeterminism/handlers/png.pm
=====================================
@@ -29,6 +29,7 @@ use File::StripNondeterminism::Common qw(copy_data);
 use File::Basename qw/dirname/;
 use POSIX qw/strftime/;
 use List::Util qw/min/;
+use Time::Local qw/timegm/;
 
 sub crc($) {
 	my ($data) = @_;
@@ -47,6 +48,12 @@ sub time_chunk($) {
 		pack('nCCCCC', 1900+$year, $mon+1, $mday, $hour, $min, $sec));
 }
 
+sub parse_time_chunk($) {
+	my ($data) = @_;
+	my ($year, $mon, $mday, $hour, $min, $sec) = unpack('nCCCCC', $data);
+	return timegm($sec, $min, $hour, $mday, $mon, $year);
+}
+
 sub text_chunk($$) {
 	my ($keyword, $data) = @_;
 	return chunk('tEXt', pack('Z*a*', $keyword, $data));
@@ -103,9 +110,12 @@ sub _normalize {
 			}
 
 			if ($type eq "tIME") {
-				print $tempfile time_chunk($canonical_time)
-				  if defined($canonical_time);
 				$modified = 1;
+				next if not defined $canonical_time;
+				my $timestamp = $canonical_time;
+				$timestamp = min($timestamp, parse_time_chunk($data))
+					if $File::StripNondeterminism::clamp_time;
+				print $tempfile time_chunk($timestamp);
 				next;
 			} elsif (($type =~ /[tiz]EXt/)
 				&& ($data =~ /^(date:[^\0]+|Creation Time)\0/)) {


=====================================
t/fixtures/png/bug_931039.png.in
=====================================
Binary files /dev/null and b/t/fixtures/png/bug_931039.png.in differ


=====================================
t/fixtures/png/bug_931039.png.out
=====================================
Binary files /dev/null and b/t/fixtures/png/bug_931039.png.out differ



View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/compare/6b532938556dabae5d17be902d3332a8034adf60...8be5038ef27c3046bc8a68179c3ad591008d5543

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/compare/6b532938556dabae5d17be902d3332a8034adf60...8be5038ef27c3046bc8a68179c3ad591008d5543
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20190707/6f2bf988/attachment.html>


More information about the rb-commits mailing list