Bug#907891: perl: MIME-Q (RFC2047 eMail header) encoding broken since post-stretch

Thorsten Glaser tg at mirbsd.de
Mon Sep 3 18:23:44 BST 2018


Package: perl
Version: 5.26.2-7
Severity: normal

(sid)$ printf '%s' 'Subject: UNNAMED PROJECT branch bnewplus updated. f9dfb215c29bc17b5ca12c0e8bb509aa4949787e' | perl -C7 -0777 -Mutf8 -MEncode -e "print encode('MIME-Q', <>);"; echo
=?UTF-8?Q?Subject=3A_UNNAMED_PROJECT_branch_bnewplus_updated=2E_f9dfb215c?=
 =?UTF-8?Q?29bc17b5ca12c0e8bb509aa4949787e?=

In stretch, this was… questionable, but still valid:

(stretch)$ printf '%s' 'Subject: UNNAMED PROJECT branch bnewplus updated. f9dfb215c29bc17b5ca12c0e8bb509aa4949787e' | perl -C7 -0777 -Mutf8 -MEncode -e "print encode('MIME-Q', <>);"; echo
Subject: =?UTF-8?Q?UNNAMED=20PROJECT=20branc?=
 =?UTF-8?Q?h=20bnewplus=20updated=2E=20f?= =?UTF-8?Q?9dfb215c29bc17b5ca12c?=
 =?UTF-8?Q?0e8bb509aa4949787e?=

In jessie, it recognised there was nothing to encode,
but still decided to wrap; unconventional but valid:

(jessie)$ printf '%s' 'Subject: UNNAMED PROJECT branch bnewplus updated. f9dfb215c29bc17b5ca12c0e8bb509aa4949787e' | perl -C7 -0777 -Mutf8 -MEncode -e "print encode('MIME-Q', <>);"; echo
Subject:
  UNNAMED PROJECT branch bnewplus updated. f9dfb215c29bc17b5ca12c0e8bb509aa4949787e

In MirBSD, this worked well:

(mirbsd)$ perl -v | sed /./q

This is perl, v5.8.8 built for i386-mirbsd
(mirbsd)$ printf '%s' 'Subject: UNNAMED PROJECT branch bnewplus updated. f9dfb215c29bc17b5ca12c0e8bb509aa4949787e' | perl -C7 -0777 -Mutf8 -MEncode -e "print encode('MIME-Q', <>);"; echo
Subject: UNNAMED PROJECT branch bnewplus updated.
  f9dfb215c29bc17b5ca12c0e8bb509aa4949787e

As I said in #879204, #879205, #787512, #881955, #787511,
#787513, #819155 (wow, is the list getting long), so far,
PHP seems to be the only ones getting it right (5 and 7.2):

(sid)$ printf '%s' 'Subject: UNNAMED PROJECT branch bnewplus updated. f9dfb215c29bc17b5ca12c0e8bb509aa4949787e' | php5 -r 'mb_internal_encoding("UTF-8"); echo mb_encode_mimeheader(file_get_contents("php://stdin"), "UTF-8", "Q", "\012");'; echo
Subject: UNNAMED PROJECT branch bnewplus updated.
 f9dfb215c29bc17b5ca12c0e8bb509aa4949787e
(sid)$ printf '%s' 'Subject: UNNAMED PROJECT branch bnewplus updated. f9dfb215c29bc17b5ca12c0e8bb509aa4949787e' | php7.2 -r 'mb_internal_encoding("UTF-8"); echo mb_encode_mimeheader(file_get_contents("php://stdin"), "UTF-8", "Q", "\012");'; echo
Subject: UNNAMED PROJECT branch bnewplus updated.
 f9dfb215c29bc17b5ca12c0e8bb509aa4949787e

This breaks my git post-receive-hook eMail sending script,
which uses the Perl way by default to encode the Subject
header (among others) as it’s the only one installed by
default, and people rightfully wish to avoid installing PHP.


-- System Information:
Debian Release: buster/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'buildd-unstable'), (500, 'unstable'), (100, 'experimental')
Architecture: x32 (x86_64)
Foreign Architectures: i386, amd64

Kernel: Linux 4.17.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/lksh
Init: sysvinit (via /sbin/init)

Versions of packages perl depends on:
ii  dpkg               1.19.0.5+b1
ii  libperl5.26        5.26.2-7
ii  perl-base          5.26.2-7
ii  perl-modules-5.26  5.26.2-7

Versions of packages perl recommends:
ii  netbase  5.4

Versions of packages perl suggests:
ii  libterm-readline-gnu-perl  1.35-4
ii  make                       4.2.1-1.2
ii  perl-doc                   5.26.2-7

-- no debconf information


More information about the Perl-maintainers mailing list