Package: dpkg-dev
Version: 1.19.7
Severity: normal
Tags: patch

Dear Maintainer,

A couple of people have been uploading .changes file to mentors without
a Date field.

Mentors doing a validation of the changes against mandatory fields
defined in the policy, discards such files and fails the upload.

While the problem always seems to come from a bad formatted changelog, I
don't think dpkg-genchanges should output a file without a Date field.

Please consider applying the attached patch that will add the Date field
even if dpkg-genchanges fails to parse the changelog.

Thanks you for your consideration,

Best,
--
Baptiste BEAUPLAT - lyknode
From 33cd8af37cb541d2d9dd66721f1524a2fcad0bfe Mon Sep 17 00:00:00 2001
From: Baptiste BEAUPLAT <lykn...@cilg.org>
Date: Thu, 9 Apr 2020 21:42:29 +0200
Subject: [PATCH] Recreate Date field when extraction failed from d/changelog.

When dpkg-genchanges fails to parse the date in d/changelog, it creates
and empty field named Date. That field is then skipped on output,
producing a policy non-compliant changes.

This commit checks for empty value and replace them by the current
date/time.
---
 scripts/dpkg-genchanges.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index e643fe664..2ac24691c 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -460,7 +460,7 @@ info($origsrcmsg);
 
 $fields->{'Format'} = $substvars->get('Format');
 
-if (!defined($fields->{'Date'})) {
+if (!defined($fields->{'Date'}) or $fields->{'Date'} eq '') {
     setlocale(LC_TIME, 'C');
     $fields->{'Date'} = POSIX::strftime('%a, %d %b %Y %T %z', localtime);
     setlocale(LC_TIME, '');
-- 
2.26.0.rc2


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to