- Package:
- pkg-perl-tools
- Source:
- pkg-perl-tools
- Submitter:
- Edmund Lodewijks
- Date:
- 2026-08-31 10:23:02 UTC
- Severity:
- normal
Dear Maintainer,
While creating thirteen ITP messages over the last week, I noticed that
`dpt gen-itp` emits a `From:` header in which the encoded-word covers the
entire address, and not just the display name:
From: =?UTF-8?B?RWRtdW5kIExvZGV3aWprcyA8ZWRtdW5kQHByb3RlYW1haWwuY29tPg==?=
There is no address left that can be parsed. RFC 2047 section 5 permits an
encoded-word in the _phrase_ of an address, but nowhere inside an `addr-spec`.
scripts/gen-itp:57
say 'From: ' . encode("MIME-Header", $changelog->{Maintainer});
A second problem appears with a non-ASCII name. $changelog->{Maintainer} is a
byte string, so encode() re-encodes it as though it were characters:
$ perl -MEncode -e 'print encode("MIME-Header", "Jörg Müller <j@example.org>")'
=?UTF-8?B?SsODwrZyZyBNw4PCvGxsZXIgPGpAZXhhbXBsZS5vcmc+?=
which decodes to "Jörg Müller <j@example.org>". The Owner: field at line 79
already does decode('UTF-8', ...) on the same string.
Pure-ASCII names are encoded, too. Though that is legal, it makes the header
unreadable for no benefit, if you were to inspect headers, say, on disk.
The attached patch adds `mime_encode_address()`, which splits the phrase from
the `angle-addr`, decodes to characters, and encodes the phrase only when it is
not ASCII. An ASCII phrase containing RFC 5322 specials (dot, comma, colon, etc)
is quoted, rather than encoded, for the same reason of raw-message-readability
as above.
Results:
Edmund Lodewijks <edmund@proteamail.com> unchanged
Jörg Müller <j@example.org> =?UTF-8?B?SsO2cmcgTcO8bGxlcg==?= <j@example.org>
Foo Bar Jr., Ltd <a@b.com> "Foo Bar Jr., Ltd" <a@b.com>
gregoa@debian.org unchanged
<solo@example.com> unchanged
Checked with perl -c.
Kind regards,
Edmund Lodewijks
Hello, Bug #1146308 in pkg-perl-tools reported by you has been fixed in the Git repository and is awaiting an upload. You can see the commit message below and you can check the diff of the fix at: https://salsa.debian.org/perl-team/modules/packages/pkg-perl-tools/-/commit/64c179b3ebf0650479954289a4e114ba6857cea8 ------------------------------------------------------------------------ gen-itp: encode only the display name in the From: header encode("MIME-Header", ...) was applied to the whole `Maintainer` string. This caused two issues. 1. The encoded-word swallows the `angle-addr`, so the generated `From:` line carries no address any parser can see. RFC 2047 section 5 allows an encoded-word in the `phrase` of an address, but nowhere inside an `addr-spec`, precisely because MTAs do not decode MIME before routing emails. 2. The `Maintainer` string is bytes, so `encode()` treats each byte as a character and a non-ASCII name comes out double-encoded: "Jörg" becomes "Jörg". (Note that the `Owner:` field four lines below already decodes it first.) Pure-ASCII names were encoded too, which is legal but leaves the header unreadable for no gain (you can't just read an email on disk anymore, if you wanted to do that). This patch adds `mime_encode_address()`, which: - splits the phrase from the `angle-addr`, - decodes to characters, and - encodes the phrase only when it is not ASCII. - an ASCII phrase containing RFC 5322 specials (dot, comma, colon...) is quoted instead, to keep it readable for the human eye (again, in case you check the raw email). The thirteen ITPs I generated between 2026-08-26 and 2026-08-31 all had to have their From: corrected by hand before I could send them. Closes: #1146308 ------------------------------------------------------------------------ (this message was generated automatically) -- Greetings https://bugs.debian.org/1146308