Package: release.debian.org
Severity: normal
Tags: bullseye
User: release.debian....@packages.debian.org
Usertags: pu

[ Reason ]
For a few days, dak started to use a quoted-printable transfer encoding.
This means that the Subject header can't be interpreted directly and
needs to be decoded first. This also means that the Content-Type header
has to be preserved when forwarding mails.

[ Impact ]
Packages don't get cleaned on the buildds, mails from dak that are
forwarded to the buildd maintainers (e.g. package rejection) are
mangled.

[ Tests ]
The code has been running on ppc64el-osuosl-01.d.o for a few days.

[ Risks ]
Code is rather simple and only touches 3 lines of code.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
* Buildd::Mail: support MIME encoded Subject: header

This decode the Subject: header using the Encode::from_to perl function,
which handle both base64 and quoted-printed, so should work even if dak
switch to base64.

* Buildd::Mail: also copy the Content-Type: header when forwarding mail

This makes sures that the Content-Type: header is forwarded with the
mail, otherwise the mail is not interpreted correctly by the admin's
mailer.

[ Other info ]
Given the changes where minimal, I have already uploaded the package to
the archive.
diff -Nru sbuild-0.81.2/debian/changelog sbuild-0.81.2+deb11u1/debian/changelog
--- sbuild-0.81.2/debian/changelog      2021-01-31 14:34:54.000000000 +0000
+++ sbuild-0.81.2+deb11u1/debian/changelog      2022-08-31 19:59:38.000000000 
+0000
@@ -1,3 +1,11 @@
+sbuild (0.81.2+deb11u1) bullseye; urgency=medium
+
+  [ Aurelien Jarno ]
+  * Buildd::Mail: support MIME encoded Subject: header
+  * Buildd::Mail: also copy the Content-Type: header when forwarding mail
+
+ -- Aurelien Jarno <aure...@debian.org>  Wed, 31 Aug 2022 21:59:38 +0200
+
 sbuild (0.81.2) unstable; urgency=medium
 
   * Package sbuild-qemu should be arch:all, not arch:amd64.
diff -Nru sbuild-0.81.2/lib/Buildd/Mail.pm 
sbuild-0.81.2+deb11u1/lib/Buildd/Mail.pm
--- sbuild-0.81.2/lib/Buildd/Mail.pm    2021-01-31 14:34:54.000000000 +0000
+++ sbuild-0.81.2+deb11u1/lib/Buildd/Mail.pm    2022-08-31 19:59:38.000000000 
+0000
@@ -34,6 +34,7 @@
 use File::Basename;
 use MIME::QuotedPrint;
 use MIME::Base64;
+use Encode;
 
 BEGIN {
     use Exporter ();
@@ -148,6 +149,7 @@
 
     goto forward_mail if !$self->get('Mail Header')->{'subject'};
     my $subject = $self->get('Mail Header')->{'subject'};
+    Encode::from_to($subject, "MIME-Header", "utf-8");
 
     if ($subject =~ /^Re: Log for \S+ build of (\S+)(?: on [\w-]+)? 
\(dist=(\S+)\)/i) {
        # reply to a build log
@@ -466,6 +468,7 @@
                      ($header->{'reply-to'} ? "Reply-To: 
$header->{'reply-to'}\n" : "").
                      ($header->{'in-reply-to'} ? "In-Reply-To: 
$header->{'in-reply-to'}\n" : "").
                      ($header->{'references'} ? "References: 
$header->{'references'}\n" : "").
+                     ($header->{'content-type'} ? "Content-Type: 
$header->{'content-type'}\n": "").
                      "Resent-From: $Buildd::gecos 
<$Buildd::username\@$Buildd::hostname>\n".
                      "Resent-To: " . $self->get_conf('ADMIN_MAIL') . "\n\n".
                      $self->get('Mail Body Text') );

Reply via email to