[Reproducible-commits] [dpkg] 75/90: Dpkg::Changelog::Entry::Debian: Only warn on invalid week days
Jérémy Bobbio
lunar at moszumanska.debian.org
Sat Aug 29 18:26:19 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit afef8fbf76e4d87ea8ab824370507f5017a4818e
Author: Guillem Jover <guillem at debian.org>
Date: Wed Aug 5 21:27:41 2015 +0200
Dpkg::Changelog::Entry::Debian: Only warn on invalid week days
Regression introduced in commit 7a71b4b78e8a81158c45073dee05b0d1cc46b71c.
The previous implementation using Date::Parse ignored invalid week
days, and the new one using Time::Piece is strict, so we get fatal
errors. Validate the week day ourselves, emit a warning in case of
an invalid value, and ignore it when passing the value to strptime
from Time::Piece.
Reported-by: Jakub Wilk <jwilk at debian.org>
---
debian/changelog | 6 ++++++
scripts/Dpkg/Changelog/Entry/Debian.pm | 15 ++++++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f8e44f6..96ada21 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,11 @@
dpkg (1.18.3) UNRELEASED; urgency=low
+ [ Guillem Jover ]
+ * Perl modules:
+ - Only warn on invalid week days instead of aborting in
+ Dpkg::Changelog::Entry::Debian. Regression introduced in dpkg 1.18.2.
+ Reported by Jakub Wilk <jwilk at debian.org>.
+
[ Updated programs translations ]
* Catalan (Jordi Mallach).
diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm
index e1d0b33..d813912 100644
--- a/scripts/Dpkg/Changelog/Entry/Debian.pm
+++ b/scripts/Dpkg/Changelog/Entry/Debian.pm
@@ -64,7 +64,9 @@ our $regex_header = qr/^(\w$name_chars*) \(([^\(\) \t]+)\)((?:\s+$name_chars+)+)
# The matched content is the maintainer name ($1), its email ($2),
# some blanks ($3) and the timestamp ($4).
-our $regex_trailer = qr/^ \-\- (.*) <(.*)>( ?)((\w+\,\s*)?\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4})\s*$/o;
+our $regex_trailer = qr/^ \-\- (.*) <(.*)>( ?)(((\w+)\,\s*)?(\d{1,2}\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}))\s*$/o;
+
+my %week_day = map { $_ => 1 } qw(Mon Tue Wed Thu Fri Sat Sun);
## use critic
@@ -165,12 +167,15 @@ sub check_trailer {
push @errors, g_('badly formatted trailer line');
}
- my $fmt = '';
- $fmt .= '%a, ' if defined $5;
- $fmt .= '%d %b %Y %T %z';
+ # Validate the week day. Date::Parse used to ignore it, but Time::Piece
+ # is much more strict and it does not gracefully handle bogus values.
+ if (defined $5 and not exists $week_day{$6}) {
+ push @errors, sprintf(g_('ignoring invalid week day \'%s\''), $6);
+ }
+ # Ignore the week day ('%a, '), as we have validated it above.
local $ENV{LC_ALL} = 'C';
- unless (defined Time::Piece->strptime($4, $fmt)) {
+ unless (defined Time::Piece->strptime($7, '%d %b %Y %T %z')) {
push @errors, sprintf(g_("couldn't parse date %s"), $4);
}
} else {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list