Package: dpkg
Version: 1.18.10
Tags: patch

In jessie and earlier, dpkg-parsechangelog will parse an unfinalised
changelog.  Ie, one that looks like this:

   dpkg (1.18.11~0iwj1) UNRELEASED; urgency=medium

     * dpkg-parsechangelog: Tolerate, once more, unfinalised changelogs.
       Avoids:
         Can't call method "epoch" on an undefined value
         at /usr/share/perl5/Dpkg/Changelog.pm line 498.

    --

It would print something like this:

   dpkg-parsechangelog: warning:     debian/changelog(l23): badly formatted 
trailer line
   LINE:  --
   dpkg-parsechangelog: warning:     debian/changelog(l25): found start of 
entry where expected more change data or trailer
   LINE: chiark-utils (4.5.0~iwj4) unstable; urgency=medium
   dpkg-parsechangelog: warning:     debian/changelog(l25): found end of file 
where expected more change data or trailer

but it would exit with status zero and produce the necessary output.

IMO finalising changelogs early is poor practice (particularly when
using revision control systems like git).  Arguably some kind of force
option might be a useful safety catch.

But for now, I have just fixed the bug which causes the
apparently-intended fallback to not work.

Thanks,
Ian.

>From dd832d939be64011bba7e9a846fa52ea125fdc2d Mon Sep 17 00:00:00 2001
From: Ian Jackson <ijack...@chiark.greenend.org.uk>
Date: Sat, 5 Nov 2016 13:39:29 +0000
Subject: [PATCH] dpkg-parsechangelog: Tolerate, once more, unfinalised
 changelogs. Avoids: Can't call method "epoch" on an undefined value at
 /usr/share/perl5/Dpkg/Changelog.pm line 498.

Signed-off-by: Ian Jackson <ijack...@chiark.greenend.org.uk>
---
 debian/changelog          | 9 +++++++++
 scripts/Dpkg/Changelog.pm | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 695c55d..4ecaef2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+dpkg (1.18.11~0iwj1) UNRELEASED; urgency=medium
+
+  * dpkg-parsechangelog: Tolerate, once more, unfinalised changelogs.
+    Avoids:
+      Can't call method "epoch" on an undefined value
+      at /usr/share/perl5/Dpkg/Changelog.pm line 498.
+
+ -- Ian Jackson <ijack...@chiark.greenend.org.uk>  Sat, 05 Nov 2016 13:39:13 
+0000
+
 dpkg (1.18.10) unstable; urgency=medium
 
   [ Guillem Jover ]
diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index 0424db6..234c3db 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -495,7 +495,7 @@ sub _format_dpkg {
     $f->{Distribution} = join(' ', $src->get_distributions());
     $f->{Maintainer} = $src->get_maintainer() // '';
     $f->{Date} = $src->get_timestamp() // '';
-    $f->{Timestamp} = $src->get_timepiece->epoch // '';
+    $f->{Timestamp} = $src->get_timepiece && $src->get_timepiece->epoch // '';
     $f->{Changes} = $src->get_dpkg_changes();
 
     # handle optional fields
-- 
2.10.1

-- 
Ian Jackson <ijack...@chiark.greenend.org.uk>   These opinions are my own.

If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.

Reply via email to