Hi!

On Sun, 2026-03-08 at 20:30:02 +0000, Ian Jackson wrote:
> See previous bugs
> 
>  #843248  dpkg-parsechangelog intolerant of unfinalised changelogs
>  #849081  dpkg-deb rejects building with unfinalised changeslog
> 
> Perhaps there could be a test case ?
> 
> (We would have spotted this in our Salsa CI of dgit.git but our CI
> uses testing so it has only broken just now.)

Because this was unintentional, I've prepared a minimal change to
solve this for now, which I'll include in 1.23.8. Change attached.
But…

On Sun, 2026-03-08 at 20:25:21 +0000, Ian Jackson wrote:
> Consider the changelog below.
> 
> This is an "unfinalised changelog".  We use this in dgit.git.  It has
> the benefit of retaining the release name in the intro line, so that
> it is not possible to accidentally retarget to the wrong release.  It
> also avoids having a (wrong) date which needs to be updated.

…while I understand the supposed benefits, this comes with negative
drawbacks. One is that the generated .changes does not contain the
Changed-By field anymore (a field which is currently not marked as
required, but I think that's wrong). It means we cannot enforce failures
for invalid syntax for the changelog (as specified both by
deb-changelog(5) and Debian Policy, "must" clauses), which means any
code that has to deal with changelog files needs to be lenient and
accept invalid stuff, complicating the overall ecosystem.

Because the final distribution is specified (instead of the
convention of using UNRELEASED), such builds could end up being
uploaded into a queue or a repo. I think ideally we'd have a key/value
designating the final target distribution in cases it's not obvious
from the previous entry, something like this made up example (but with
a better key name probably):

  source (10.0-1) UNRELEASED; urgency=medium, targets-dist=unstable

For the argument that the date (or even maintainer) information is
wrong, I'd say that easily applies as well to the version, and if the
changelog is being used to build actual packages in the interim, then
there should be something in place. Even though the date could be
synthetized at build time (from the current time) and the maintainer
could be tried to be extracted from DEBFULLNAME/DEBEMAIL or the current
user (or required to be specified with -e), that would still not remove
the problem of letting through invalid syntax that everything else then
needs to cope with. (Also the maintainer could be set to something
that denotes this is a CI build.)

I think that looking at the trailer as containing wrong information is
the wrong way to look into it (given the above), because if one in
addition for example fills in the actual change contents out of git
at release/finalization time, then the entire entry is also wrong or
incomplete until fully finalized, and any such entry is just an interim
placeholder, in which case I'm not seeing what's wrong with having the
person (or some placeholder name) and initial date this was initialized
as such placeholder information.

So I would like to consider how to move into eventually deprecating
this (I'd say unusual and problematic) workflow by adding support to
the common workflow by improving its metadata tracking (such as the
intended dist, or perhaps reverse that and use the actual target dist
but mark it as finalized=no, or whatever).

Thanks,
Guillem
diff --git i/scripts/dpkg-buildpackage.pl w/scripts/dpkg-buildpackage.pl
index 3c8c9ec41..554270c2d 100755
--- i/scripts/dpkg-buildpackage.pl
+++ w/scripts/dpkg-buildpackage.pl
@@ -559,7 +559,7 @@ if ($changedby) {
     $maintainer = $changedby;
 } elsif ($maint) {
     $maintainer = $maint;
-} else {
+} elsif (length $changelog->{maintainer}) {
     my $email = mustsetvar($changelog->{maintainer}, g_('source changed by'));
     eval {
         my $addr = Dpkg::Email::Address->new($email);
diff --git i/scripts/dpkg-genchanges.pl w/scripts/dpkg-genchanges.pl
index 09b88b4be..2b249ae4e 100755
--- i/scripts/dpkg-genchanges.pl
+++ w/scripts/dpkg-genchanges.pl
@@ -439,8 +439,10 @@ foreach my $f (keys %{$changelog}) {
     if ($f eq 'Source') {
         set_source_name($v);
     } elsif ($f eq 'Maintainer') {
-        my $addr = Dpkg::Email::Address->new($v);
-        $fields->{'Changed-By'} = $addr->as_string();
+        if (length $v) {
+            my $addr = Dpkg::Email::Address->new($v);
+            $fields->{'Changed-By'} = $addr->as_string();
+        }
     } else {
         field_transfer_single($changelog, $fields, $f);
     }

Reply via email to