Skip to content

Commits on Source 5

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@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
......
......@@ -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');
}
......
......@@ -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/)) {
......