[Git][reproducible-builds/strip-nondeterminism][debian] 6 commits: Ignore encrypted .zip files as we can never normalise them. (Closes: #852207)
Chris Lamb
gitlab at salsa.debian.org
Wed Dec 19 13:24:29 CET 2018
Chris Lamb pushed to branch debian at Reproducible Builds / strip-nondeterminism
Commits:
8acd30b7 by Chris Lamb at 2018-12-19T12:23:28Z
Ignore encrypted .zip files as we can never normalise them. (Closes: #852207)
- - - - -
15b5ca0e by Chris Lamb at 2018-12-19T12:23:28Z
Drop .ar handler; binutils is reproducible. (Closes: #781262, #843811)
- - - - -
d4f7816d by Chris Lamb at 2018-12-19T12:23:28Z
Remove javaproperties handler after Emmanuel Bourg's patch was released in openjdk-11 11.0.1+13-3. (Closes: #914289)
- - - - -
1c3d9cc5 by Chris Lamb at 2018-12-19T12:23:28Z
Release version 1.0.0
- - - - -
a53af6cc by Chris Lamb at 2018-12-19T12:23:29Z
Update debian/copyright to drop reference to ar.pm.
- - - - -
c347198b by Chris Lamb at 2018-12-19T12:23:29Z
Update changelog for 1.0.0-1 release
- - - - -
18 changed files:
- debian/changelog
- debian/copyright
- lib/File/StripNondeterminism.pm
- − lib/File/StripNondeterminism/handlers/ar.pm
- lib/File/StripNondeterminism/handlers/jar.pm
- − lib/File/StripNondeterminism/handlers/javaproperties.pm
- lib/File/StripNondeterminism/handlers/zip.pm
- − t/fixtures/ar/one.a.in
- − t/fixtures/ar/one.a.out
- − t/fixtures/javaproperties/configuration.properties.in
- − t/fixtures/javaproperties/configuration.properties.out
- − t/fixtures/javaproperties/pom.properties.in
- − t/fixtures/javaproperties/pom.properties.out
- − t/fixtures/javaproperties/version.properties.in
- − t/fixtures/javaproperties/version.properties.out
- + t/fixtures/zip/encrypted.zip.in
- + t/fixtures/zip/encrypted.zip.out
- − t/javaproperties.t
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+strip-nondeterminism (1.0.0-1) unstable; urgency=medium
+
+ * Ignore encrypted .zip files as we can never normalise them.
+ (Closes: #852207)
+ * Drop .ar handler; binutils is reproducible. (Closes: #781262, #843811)
+ - Update debian/copyright to drop reference to ar.pm.
+ * Remove javaproperties handler after Emmanuel Bourg's patch was released in
+ openjdk-11 11.0.1+13-3. (Closes: #914289)
+
+ -- Chris Lamb <lamby at debian.org> Thu, 06 Dec 2018 18:13:32 +0100
+
strip-nondeterminism (0.45.0-1) unstable; urgency=medium
* Move to SemVer <https://semver.org/> versioning scheme.
=====================================
debian/copyright
=====================================
@@ -7,11 +7,6 @@ Copyright: Copyright (C) 2014 Andrew Ayer
Copyright (C) 2017 Chris Lamb
License: GPL-3+
-Files: lib/File/StripNondeterminism/handlers/ar.pm
-Copyright: Copyright (C) 2014 Jérémy Bobbio <lunar at debian.org>
- Copyright (C) 2014 Niko Tyni <ntyni at debian.org>
-License: GPL-3+
-
License: GPL-3+
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
=====================================
lib/File/StripNondeterminism.pm
=====================================
@@ -25,7 +25,7 @@ use POSIX qw(tzset);
our($VERSION, $canonical_time, $clamp_time);
-$VERSION = '0.45.0'; # <https://semver.org/>
+$VERSION = '1.0.0'; # <https://semver.org/>
sub init() {
$ENV{'TZ'} = 'UTC';
@@ -47,10 +47,6 @@ sub get_normalizer_for_file($) {
return undef if -d $_; # Skip directories
- # ar
- if (m/\.a$/ && _get_file_type($_) =~ m/ar archive/) {
- return _handler('ar');
- }
# cpio
if (m/\.cpio$/ && _get_file_type($_) =~ m/cpio archive/) {
return _handler('cpio');
@@ -93,15 +89,6 @@ sub get_normalizer_for_file($) {
if (m/\.png$/ && _get_file_type($_) =~ m/PNG image data/) {
return _handler('png');
}
- # pom.properties, version.properties
- if (m/\.properties$/) {
- # Loading the handler forces the load of the javaproperties package as well
- my $handler = _handler('javaproperties');
- return $handler
- if
- File::StripNondeterminism::handlers::javaproperties::is_java_properties_file(
- $_);
- }
# zip
if (m/\.(zip|pk3|epub|whl|xpi|htb|zhfst|par)$/
&& _get_file_type($_) =~ m/Zip archive data|EPUB document/) {
@@ -112,7 +99,6 @@ sub get_normalizer_for_file($) {
our %HANDLER_CACHE;
our %KNOWN_HANDLERS = (
- ar => 1,
bflt => 1,
cpio => 1,
gettext => 1,
=====================================
lib/File/StripNondeterminism/handlers/ar.pm deleted
=====================================
@@ -1,98 +0,0 @@
-# Copyright © 2014 Jérémy Bobbio <lunar at debian.org>
-# Copyright © 2014 Niko Tyni <ntyni at debian.org>
-#
-# This program 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.
-#
-# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Some code borrowed from ArFile
-# Copyright (C) 2007 Stefano Zacchiroli <zack at debian.org>
-# Copyright (C) 2007 Filippo Giunchedi <filippo at debian.org>
-
-package File::StripNondeterminism::handlers::ar;
-
-use strict;
-use warnings;
-
-use Fcntl q/SEEK_SET/;
-
-use File::StripNondeterminism;
-
-sub normalize {
- my ($file) = @_;
-
- my $GLOBAL_HEADER = "!<arch>\n";
- my $GLOBAL_HEADER_LENGTH = length $GLOBAL_HEADER;
-
- my $FILE_HEADER_LENGTH = 60;
- my $FILE_MAGIC = "`\n";
-
- my $buf;
-
- open(my $fh, '+<', $file)
- or die("failed to open $file for read+write: $!");
-
- read $fh, $buf, $GLOBAL_HEADER_LENGTH;
- return 0 if $buf ne $GLOBAL_HEADER;
-
- while (1) {
- my $file_header_start = tell $fh;
- my $count = read $fh, $buf, $FILE_HEADER_LENGTH;
- die "reading $file failed: $!" if !defined $count;
- last if $count == 0;
-
- # http://en.wikipedia.org/wiki/Ar_(Unix)
- #from to Name Format
- #0 15 File name ASCII
- #16 27 File modification date Decimal
- #28 33 Owner ID Decimal
- #34 39 Group ID Decimal
- #40 47 File mode Octal
- #48 57 File size in bytes Decimal
- #58 59 File magic \140\012
-
- die "Incorrect header length"
- if length $buf != $FILE_HEADER_LENGTH;
- die "Incorrect file magic"
- if substr($buf, 58, length($FILE_MAGIC)) ne $FILE_MAGIC;
-
- my $file_mode = oct(substr($buf, 40, 8));
- my $file_size = substr($buf, 48, 10);
-
- die "Incorrect file size"
- if $file_size < 1;
-
- seek $fh, $file_header_start + 16, SEEK_SET;
-
- # mtime
- syswrite $fh,
- sprintf("%-12d", $File::StripNondeterminism::canonical_time // 0);
- # owner
- syswrite $fh, sprintf("%-6d", 0);
- # group
- syswrite $fh, sprintf("%-6d", 0);
- # file mode
- syswrite $fh,
- sprintf("%-8o", ($file_mode & oct(100)) ? oct(755) : oct(644));
-
- # move to next member
- my $padding = $file_size % 2;
- seek $fh,
- $file_header_start + $FILE_HEADER_LENGTH + $file_size + $padding,
- SEEK_SET;
-
- }
-
- return 1;
-}
-
-1;
=====================================
lib/File/StripNondeterminism/handlers/jar.pm
=====================================
@@ -27,7 +27,6 @@ use Archive::Zip;
use File::Basename;
use File::StripNondeterminism::handlers::zip;
use File::StripNondeterminism::handlers::javadoc;
-use File::StripNondeterminism::handlers::javaproperties;
use File::Temp;
sub _jar_filename_cmp($$) {
@@ -82,16 +81,6 @@ sub _jar_normalize_member($$) {
} elsif ($member->fileName() eq 'META-INF/MANIFEST.MF') {
File::StripNondeterminism::handlers::zip::normalize_member($member,
\&_jar_normalize_manifest);
- } elsif (
- $member->fileName() =~ /(pom|version)\.properties$/
- &&File::StripNondeterminism::handlers::javaproperties::is_java_properties_header(
- File::StripNondeterminism::handlers::zip::peek_member(
- $member, 1024
- ))
- ) {
- # maven header should be within first 1kb of file
- File::StripNondeterminism::handlers::zip::normalize_member($member,
- \&File::StripNondeterminism::handlers::javaproperties::normalize);
} elsif ($member->fileName() =~ /\.clj$/) {
# Clojure considers the .class file to be stale if it shares
# the same timestamp of the .clj. We thus adjust the timestamps
=====================================
lib/File/StripNondeterminism/handlers/javaproperties.pm deleted
=====================================
@@ -1,85 +0,0 @@
-#
-# Copyright 2014 Chris West (Faux)
-# Copyright 2016 Chris Lamb <lamby at 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::javaproperties;
-
-use strict;
-use warnings;
-
-use File::StripNondeterminism::Common qw(copy_data);
-use File::Temp;
-use File::Basename;
-
-sub is_java_properties_header($) {
- my ($contents) = @_;
- return $contents
- =~ /#Generated by( Apache)? Maven|#Build Number for ANT|#Generated by org.apache.felix.bundleplugin|#POM properties|#.* runtime configuration/;
-}
-
-sub is_java_properties_file($) {
- my ($filename) = @_;
-
- # If this is a java properties file, '#Generated by Maven', '#Build
- # Number for ANT', or other similar build-tool comment headers should
- # appear in first 1kb
- my $fh;
- my $str;
- return
- open($fh, '<', $filename)
- && read($fh, $str, 1024)
- && is_java_properties_header($str);
-}
-
-sub normalize {
- my ($filename) = @_;
-
- open(my $fh, '<', $filename)
- or die "Unable to open $filename for reading: $!";
- my $tempfile = File::Temp->new(DIR => dirname($filename));
-
- # Strip the generation date comment, which contains a timestamp. It
- # should appear within first 10 lines.
- while (defined(my $line = <$fh>) && $. <= 10) {
- # Yes, there really is no comma here
- if ($line
- =~ /^#\w{3} \w{3} \d{2} \d{2}:\d{2}:\d{2} \w{3,4}([+-]\d{2}:\d{2})? \d{4}\s*$/
- ) {
- $line = '';
- print $tempfile $line;
-
- # Copy through rest of file
- my $bytes_read;
- my $buf;
- while ($bytes_read = read($fh, $buf, 4096)) {
- print $tempfile $buf;
- }
- defined($bytes_read) or die "$filename: read failed: $!";
-
- $tempfile->close;
- copy_data($tempfile->filename, $filename)
- or die "$filename: unable to overwrite: copy_data: $!";
- return 1;
- }
- print $tempfile $line;
- }
-
- return 0;
-}
-
-1;
=====================================
lib/File/StripNondeterminism/handlers/zip.pm
=====================================
@@ -197,6 +197,10 @@ sub normalize {
my @filenames = sort $filename_cmp $zip->memberNames();
for my $filename (@filenames) {
my $member = $zip->removeMember($filename);
+ if ($member->isEncrypted()) {
+ warn "strip-nondeterminism: $zip_filename: ignoring encrypted zip file\n";
+ return 0;
+ }
$zip->addMember($member);
# member_normalizer returns the timestamp to use.
my $timestamp = exists $options{member_normalizer}
=====================================
t/fixtures/ar/one.a.in deleted
=====================================
@@ -1,32 +0,0 @@
-!<arch>
-afile/ 1425249797 501 501 100600 1136 `
-cerebral atrophy, n:
- The phenomena which occurs as brain cells become weak and sick, and
-impair the brain's performance. An abundance of these "bad" cells can cause
-symptoms related to senility, apathy, depression, and overall poor academic
-performance. A certain small number of brain cells will deteriorate due to
-everday activity, but large amounts are weakened by intense mental effort
-and the assimilation of difficult concepts. Many college students become
-victims of this dread disorder due to poor habits such as overstudying.
-
-cerebral darwinism, n:
- The theory that the effects of cerebral atrophy can be reversed
-through the purging action of heavy alcohol consumption. Large amounts of
-alcohol cause many brain cells to perish due to oxygen deprivation. Through
-the process of natural selection, the weak and sick brain cells will die
-first, leaving only the healthy cells. This wonderful process leaves the
-imbiber with a healthier, more vibrant brain, and increases mental capacity.
-Thus, the devastating effects of cerebral atrophy are reversed, and academic
-performance actually increases beyond previous levels.
-bfile/ 1425249797 501 501 100644 80 `
-take forceful action:
- Do something that should have been done a long time ago.
-cfile/ 1425249797 501 501 100775 39 `
-Don't Worry, Be Happy.
- -- Meher Baba
-
-dfile/ 1425249797 501 501 100664 256 `
-"Well, well, well! Well if it isn't fat stinking billy goat Billy Boy in
-poison! How art thou, thou globby bottle of cheap stinking chip oil? Come
-and get one in the yarbles, if ya have any yarble, ya eunuch jelly thou!"
- -- Alex in "Clockwork Orange"
=====================================
t/fixtures/ar/one.a.out deleted
=====================================
@@ -1,32 +0,0 @@
-!<arch>
-afile/ 1423159771 0 0 644 1136 `
-cerebral atrophy, n:
- The phenomena which occurs as brain cells become weak and sick, and
-impair the brain's performance. An abundance of these "bad" cells can cause
-symptoms related to senility, apathy, depression, and overall poor academic
-performance. A certain small number of brain cells will deteriorate due to
-everday activity, but large amounts are weakened by intense mental effort
-and the assimilation of difficult concepts. Many college students become
-victims of this dread disorder due to poor habits such as overstudying.
-
-cerebral darwinism, n:
- The theory that the effects of cerebral atrophy can be reversed
-through the purging action of heavy alcohol consumption. Large amounts of
-alcohol cause many brain cells to perish due to oxygen deprivation. Through
-the process of natural selection, the weak and sick brain cells will die
-first, leaving only the healthy cells. This wonderful process leaves the
-imbiber with a healthier, more vibrant brain, and increases mental capacity.
-Thus, the devastating effects of cerebral atrophy are reversed, and academic
-performance actually increases beyond previous levels.
-bfile/ 1423159771 0 0 644 80 `
-take forceful action:
- Do something that should have been done a long time ago.
-cfile/ 1423159771 0 0 755 39 `
-Don't Worry, Be Happy.
- -- Meher Baba
-
-dfile/ 1423159771 0 0 644 256 `
-"Well, well, well! Well if it isn't fat stinking billy goat Billy Boy in
-poison! How art thou, thou globby bottle of cheap stinking chip oil? Come
-and get one in the yarbles, if ya have any yarble, ya eunuch jelly thou!"
- -- Alex in "Clockwork Orange"
=====================================
t/fixtures/javaproperties/configuration.properties.in deleted
=====================================
@@ -1,4 +0,0 @@
-#DITA-OT runtime configuration
-#Tue May 22 16:35:53 UTC 2012
-print_transtypes=pdf2;pdf;legacypdf;odt
-supported_image_extensions=.bmp;.svg;.png;.tif;.jpg;.gif;.jpeg;.tiff;.eps
=====================================
t/fixtures/javaproperties/configuration.properties.out deleted
=====================================
@@ -1,3 +0,0 @@
-#DITA-OT runtime configuration
-print_transtypes=pdf2;pdf;legacypdf;odt
-supported_image_extensions=.bmp;.svg;.png;.tif;.jpg;.gif;.jpeg;.tiff;.eps
=====================================
t/fixtures/javaproperties/pom.properties.in deleted
=====================================
@@ -1,3 +0,0 @@
-#Generated by Maven
-#Mon Oct 27 09:12:51 UTC 2014
-version=2.4
=====================================
t/fixtures/javaproperties/pom.properties.out deleted
=====================================
@@ -1,2 +0,0 @@
-#Generated by Maven
-version=2.4
=====================================
t/fixtures/javaproperties/version.properties.in deleted
=====================================
@@ -1,3 +0,0 @@
-#Build Number for ANT. Do not edit!
-#Wed Feb 04 03:46:03 UTC 2015
-build.number=125
=====================================
t/fixtures/javaproperties/version.properties.out deleted
=====================================
@@ -1,2 +0,0 @@
-#Build Number for ANT. Do not edit!
-build.number=125
=====================================
t/fixtures/zip/encrypted.zip.in
=====================================
Binary files /dev/null and b/t/fixtures/zip/encrypted.zip.in differ
=====================================
t/fixtures/zip/encrypted.zip.out
=====================================
@@ -0,0 +1 @@
+encrypted.zip.in
\ No newline at end of file
=====================================
t/javaproperties.t deleted
=====================================
@@ -1,72 +0,0 @@
-#!perl
-
-#
-# Copyright 2014 Chris West (Faux)
-# Copyright 2015 Andrew Ayer
-#
-# 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/>.
-#
-
-use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
-use File::Temp 'tempdir';
-use Test::More tests => 2;
-use File::StripNondeterminism;
-use strict;
-use warnings;
-
-File::StripNondeterminism::init();
-
-my $dir = tempdir( CLEANUP => 1 );
-my $path;
-my $fh;
-my $normalizer;
-
-sub normalise {
- my $path = shift(@_);
-
- $normalizer = File::StripNondeterminism::get_normalizer_for_file($path);
- isnt(undef, $normalizer);
- $normalizer->($path);
-}
-#
-# felix bundle pom.properties
-#
-
-$path = "$dir/foo.jar";
-my $zip = Archive::Zip->new();
-$zip->addString(<<'ORIGINAL'
-#Generated by org.apache.felix.bundleplugin
-#Mon Aug 10 07:12:44 GMT-12:00 2015
-version=1.5
-ORIGINAL
-, 'pom.properties');
-
-unless ($zip->writeToFileNamed($path) == AZ_OK) {
- die("couldn't write test zip");
-}
-
-normalise($path);
-
-my $afterzip = Archive::Zip->new();
-unless ( $afterzip->read($path) == AZ_OK ) {
- die("couldn't read test zip");
-}
-
-is($afterzip->memberNamed('pom.properties')->contents(), <<'EXPECTED'
-#Generated by org.apache.felix.bundleplugin
-version=1.5
-EXPECTED
-);
View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/compare/330a9a4207e76c319b41a5e6198d6b5d359b3aa4...c347198b76e827dde7367633f062c8c871640f52
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/strip-nondeterminism/compare/330a9a4207e76c319b41a5e6198d6b5d359b3aa4...c347198b76e827dde7367633f062c8c871640f52
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/20181219/3ffa8c07/attachment.html>
More information about the rb-commits
mailing list