[Reproducible-commits] [dpkg] 18/61: Dpkg::Changelog::Entry::Debian: Do not abort on Time::Piece parse errors
Jérémy Bobbio
lunar at moszumanska.debian.org
Mon Sep 21 09:56:06 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 f2471e8f413d86b2f483c1fc73daac7967ab0b68
Author: Guillem Jover <guillem at debian.org>
Date: Tue Aug 18 15:52:28 2015 +0200
Dpkg::Changelog::Entry::Debian: Do not abort on Time::Piece parse errors
The Date::Parse str2time() function returns undef on parse errors, but
Time::Piece strptime() aborts, so to preserve the previous behavior we
need to trap any such errors, and handle them ourselves, as the caller
might want to warn instead.
Closes: #795936
---
debian/changelog | 3 +++
scripts/Dpkg/Changelog/Entry/Debian.pm | 8 +++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ddbba64..14b82c1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,9 @@ dpkg (1.18.3) UNRELEASED; urgency=low
Reported by Jakub Wilk <jwilk at debian.org>.
- Do not warn when removing an empty subdirectory on source package
extraction in Dpkg::Source::Package::V2. Closes: #796671
+ - Do not abort on parse errors from Time::Piece->strptime() for the
+ changelog trailer date, just queue them so that the caller can decide
+ if they should be warnings or actual errors. Closes: #795936
* Test suite:
- Get the reference build flags from dpkg-buildflags.pl, instead of
hardcoding them, which might not match depending on the architecture.
diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm
index d813912..a851b6f 100644
--- a/scripts/Dpkg/Changelog/Entry/Debian.pm
+++ b/scripts/Dpkg/Changelog/Entry/Debian.pm
@@ -175,9 +175,11 @@ sub check_trailer {
# Ignore the week day ('%a, '), as we have validated it above.
local $ENV{LC_ALL} = 'C';
- unless (defined Time::Piece->strptime($7, '%d %b %Y %T %z')) {
- push @errors, sprintf(g_("couldn't parse date %s"), $4);
- }
+ eval {
+ Time::Piece->strptime($7, '%d %b %Y %T %z');
+ } or do {
+ push @errors, sprintf(g_("cannot parse non-comformant date '%s'"), $7);
+ };
} else {
push @errors, g_("the trailer doesn't match the expected regex");
}
--
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