Your message dated Sun, 24 May 2015 11:34:52 +0000
with message-id <e1ywuba-000110...@franck.debian.org>
and subject line Bug#777679: fixed in strip-nondeterminism 0.007-1
has caused the Debian Bug report #777679,
regarding Support for PNG files
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
777679: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777679
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: strip-nondeterminism
Version: 0.003-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: toolchain timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi,

A patch attached with initial support for overriding timestamps
in PNG files.

Possible limitations:

 * Other tEXt free-form formats; eg. "date:create" and "date:modify"
   are ImageMagick specific, apparently

 * Timestamps in compressed or "international" text chunks (zTXt/iTXt)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
From 79a50129221d10bccee38c5e4d8cd6c59e69fd02 Mon Sep 17 00:00:00 2001
From: Chris Lamb <la...@debian.org>
Date: Wed, 11 Feb 2015 12:24:49 +0000
Subject: [PATCH] Add initial support for PNG

---
 lib/File/StripNondeterminism.pm              |  6 +++
 lib/File/StripNondeterminism/handlers/png.pm | 81 ++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+)
 create mode 100644 lib/File/StripNondeterminism/handlers/png.pm

diff --git a/lib/File/StripNondeterminism.pm b/lib/File/StripNondeterminism.pm
index 8f4d4b7..8d17640 100644
--- a/lib/File/StripNondeterminism.pm
+++ b/lib/File/StripNondeterminism.pm
@@ -27,6 +27,7 @@ use File::StripNondeterminism::handlers::jar;
 use File::StripNondeterminism::handlers::javadoc;
 use File::StripNondeterminism::handlers::pe;
 use File::StripNondeterminism::handlers::pearregistry;
+use File::StripNondeterminism::handlers::png;
 use File::StripNondeterminism::handlers::javaproperties;
 use File::StripNondeterminism::handlers::zip;
 
@@ -73,6 +74,10 @@ sub get_normalizer_for_file {
 	if (m/\.(exe|dll|cpl|ocx|sys|scr|drv|efi|fon)/ && _get_file_type($_) =~ m/PE32.? executable/) {
 		return \&File::StripNondeterminism::handlers::pe::normalize;
 	}
+	# PNG
+	if (m/\.png$/ && _get_file_type($_) =~ m/PNG image data/) {
+		return \&File::StripNondeterminism::handlers::png::normalize;
+	}
 	# pom.properties, version.properties
 	if (m/(pom|version)\.properties$/ && File::StripNondeterminism::handlers::javaproperties::is_java_properties_file($_)) {
 		return \&File::StripNondeterminism::handlers::javaproperties::normalize;
@@ -92,6 +97,7 @@ sub get_normalizer_by_name {
 	return \&File::StripNondeterminism::handlers::javadoc::normalize if $_ eq 'javadoc';
 	return \&File::StripNondeterminism::handlers::pe::normalize if $_ eq 'pe';
 	return \&File::StripNondeterminism::handlers::pearregistry::normalize if $_ eq 'pearregistry';
+	return \&File::StripNondeterminism::handlers::png::normalize if $_ eq 'png';
 	return \&File::StripNondeterminism::handlers::javaproperties::normalize if $_ eq 'javaproperties';
 	return \&File::StripNondeterminism::handlers::zip::normalize if $_ eq 'zip';
 	return undef;
diff --git a/lib/File/StripNondeterminism/handlers/png.pm b/lib/File/StripNondeterminism/handlers/png.pm
new file mode 100644
index 0000000..2b300b3
--- /dev/null
+++ b/lib/File/StripNondeterminism/handlers/png.pm
@@ -0,0 +1,81 @@
+#
+# Copyright 2015 Chris Lamb <la...@debian.org>
+#
+# This file is part of strip-nondeterminism.
+#
+# strip-nondeterminism is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# strip-nondeterminism is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with strip-nondeterminism.  If not, see <http://www.gnu.org/licenses/>.
+#
+package File::StripNondeterminism::handlers::png;
+
+use strict;
+use warnings;
+
+use Fcntl qw/:seek/;
+use POSIX qw/strftime/;
+use Digest::CRC qw/crc32/;
+
+sub normalize {
+	my ($filename) = @_;
+
+	my $buffer = "";
+	my $canonical_time = $File::StripNondeterminism::canonical_time // 0;
+
+	open PNG, '+<', $filename
+		|| die "Could not open '$filename' for reading: $!";
+
+	# Check magic
+	read PNG, $buffer, 8;
+	$buffer eq "\x89PNG\r\n\x1a\n"
+		|| die "'$filename' does not appear to be a PNG file";
+
+	while (1) {
+		read PNG, $buffer, 8;
+		last if length($buffer) < 8;
+
+		# Parse chunk header
+		my ($len, $type) = unpack('Na4', $buffer);
+
+		if ($type eq "tIME") {
+			my $val = pack('nC5', $canonical_time);
+			print PNG $val;
+			print PNG pack('N', crc32($type . $val));
+		} elsif ($type eq "tEXt") {
+			# Read entire field
+			read PNG, $buffer, $len + 4;
+
+			# Split contents by null byte
+			if (my ($tag) = $buffer =~ /^(date:[^\0]+)/) {
+				# Join with new timestamp
+				my $val = "$tag\0". strftime("%Y-%m-%dT%H:%M:%S%z",
+					gmtime($canonical_time));
+
+				# +0100 (%z) -> +01:00
+				$val =~ s/(?<=[+-]\d\d)(?=\d\d$)/:/;
+
+				# Seek backwards as we already read the field
+				seek PNG, -($len + 4), SEEK_CUR;
+
+				print PNG $val;
+				print PNG pack('N', crc32($type . $val));
+			}
+		} else {
+			# Skip chunk data and CRC
+			seek PNG, $len + 4, SEEK_CUR;
+		}
+	}
+
+	close PNG;
+}
+
+1;
-- 
2.1.0


--- End Message ---
--- Begin Message ---
Source: strip-nondeterminism
Source-Version: 0.007-1

We believe that the bug you reported is fixed in the latest version of
strip-nondeterminism, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 777...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Holger Levsen <hol...@debian.org> (supplier of updated strip-nondeterminism 
package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sun, 24 May 2015 13:09:58 +0200
Source: strip-nondeterminism
Binary: libfile-stripnondeterminism-perl strip-nondeterminism 
dh-strip-nondeterminism
Architecture: source all
Version: 0.007-1
Distribution: unstable
Urgency: medium
Maintainer: Reproducible builds folks 
<reproducible-builds@lists.alioth.debian.org>
Changed-By: Holger Levsen <hol...@debian.org>
Description:
 dh-strip-nondeterminism - debhelper add-on to strip non-determinism from files
 libfile-stripnondeterminism-perl - Perl module for stripping non-determinism 
from files
 strip-nondeterminism - tool for stripping non-determinism from files
Closes: 777679
Changes:
 strip-nondeterminism (0.007-1) unstable; urgency=medium
 .
   [ Reiner Herrmann ]
   * Improve detection of pom.properties files
 .
   [ Holger Levsen ]
   * Add myself to uploaders.
 .
 strip-nondeterminism (0.006-1) unstable; urgency=low
 .
   * New upstream release.
     - Strip timestamp from Java version.properties files
     - two more javaproperties signatures
     - set timezone to UTC before normalizing to get reproducible timestamps
     - ar handler: preserve execute bit when normalizing permissions
     - Add test case for ar handler
     - Improve detection of timestamps in pom.properties files
     - Add a PNG handler (Closes: #777679)
Checksums-Sha1:
 03f23466f9e3ed8a65813d022b46a6a338ac4814 2260 strip-nondeterminism_0.007-1.dsc
 34da433f31769b0486cc1b5e712b24b4684521e9 21924 
strip-nondeterminism_0.007.orig.tar.xz
 95d321d73cee2e8655b54c3c7c3ae3db6b69aa83 3240 
strip-nondeterminism_0.007-1.debian.tar.xz
 47f2ebb6879cd2873022714330d6b6566c09588b 6870 
dh-strip-nondeterminism_0.007-1_all.deb
 8bea87d44308a631c67a93567db129f03ae07137 9818 
libfile-stripnondeterminism-perl_0.007-1_all.deb
 087ffa2ca922e1f4a07d273d09818860f8c19241 6890 
strip-nondeterminism_0.007-1_all.deb
Checksums-Sha256:
 ec4bbea997b7fd7922f858991743b240c02a63f44c87a042a2f8393fbf3eaf4f 2260 
strip-nondeterminism_0.007-1.dsc
 a47172137b891e40a84cc075895c3925f873993a3ed59c15938998d5e13bce2c 21924 
strip-nondeterminism_0.007.orig.tar.xz
 bbd4652c99367a20ec9b054ff199ca65cffebcf7fdd40368e1174811ec7dce75 3240 
strip-nondeterminism_0.007-1.debian.tar.xz
 cf622345afaf4b5257ff0a8762d26ca46039f46f85e5c6e84508a7e665ce27f4 6870 
dh-strip-nondeterminism_0.007-1_all.deb
 f1dd8c2cdd32faa05111b544a1c730beb82ff40762a9a8447ce91693abcb256c 9818 
libfile-stripnondeterminism-perl_0.007-1_all.deb
 d13675f24ceb162a7a29c5a9e190d242a7999fb14423e93b4fcb270dda22e7c4 6890 
strip-nondeterminism_0.007-1_all.deb
Files:
 91502be284447028978bafe99c8055f7 2260 perl optional 
strip-nondeterminism_0.007-1.dsc
 22d07802acf3d85c28b8b2244b4fb5f6 21924 perl optional 
strip-nondeterminism_0.007.orig.tar.xz
 8fcb3a7ebe18646608cf3acd875431f4 3240 perl optional 
strip-nondeterminism_0.007-1.debian.tar.xz
 5e0d3e3258e35a03254e3305cbbab4d3 6870 perl optional 
dh-strip-nondeterminism_0.007-1_all.deb
 7ba1bf46bbc8503b1b87164a98d49486 9818 perl optional 
libfile-stripnondeterminism-perl_0.007-1_all.deb
 d6b588b05c8bce9781bff65508ad3e5a 6890 perl optional 
strip-nondeterminism_0.007-1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIVAwUBVWGz7wkauFYGmqocAQpqFhAAnjRXsPWGnsWaVX0d6FlEKclZeUHncC23
IfhsEQAmezbGvbjk204BIc1/1G1EhCzLB0B3xFyA084+b1FbjavcfvzWH9JGgnw7
vu3zBHcrXqER2QI4n5L6x3OwOuQjGeR+p8Y2mknKcg5w3AA8iZKuSxUXwQ4U27yB
i2C72aAWN9oirytfNpg4SJ/u04U4xXWgpJP4UBelWKGq+6Xz73cmJmR9mfzgadag
04x/W4EAbxNU2h9EhMgC/Y0xfbVfU80YfasKz0x1mDY43yDcHkA2nPqrkm2leViU
oNkfETWqBT3PEbvkzlUBfacQOA6ZEcokjfUfKFRiarxcM6pg/yFhAd7lFuLiqFhV
xOOnzbqBS0qbvay1ILI35rux/p/0Y/Kkw51EL9J/tKtM5i2q2I3sIupiu1GVoWvA
N8CRlk4Qz+lE0gqK01JIhfkmmCI8ConkDx7A1HyUxAMHMAHVZ6KviagHe2KTzWCz
vJXMNSiSC2t52VkO5wenEqt/NxIa6tZynCGJCw2FByoKSugdNhnLOyG8Qvopt6Xy
vwGpc/idZ0nvmUNJ4Dn/WUCelGKHMvh8mZeWocVV7zS3XiVEVD0Qu6AOgYdCQjF1
QmFGeWTYCrSCvOErL0vZPsvpvhZysJ3fY4c/3HAcC5xnzEnLpGlwj9YxexA2EjDR
G6timRU4Mx8=
=PC2B
-----END PGP SIGNATURE-----

--- End Message ---
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to