[Reportbug-maint] Bug#849586: reportbug incorrectly short-circuits From address escaping with non-ASCII characters
Russ Allbery
rra at debian.org
Wed Dec 28 22:53:17 UTC 2016
Package: reportbug
Version: 7.1.1
Severity: important
According to a thread on debian-devel, reportbug generated a From header
looking like:
From: =?utf-8?b?VG9tYXMgTWFydGnFoWl1cyA8dG9tYXNAcHVnYS52ZHUubHQ+?=
I believe the problem may have been introduced in the Python 3 port.
reportbug.utils.get_user_id contains the following code, which knows
about correct From header formatting using email.utils.formataddr:
if re.match(r'[\w\s]+$', realname):
return '%s <%s>' % (realname, email)
addr = email.utils.formataddr((realname, email))
I suspect this worked fine in Python 2, since this regex doesn't use
the UNICODE flag. However, in Python 3, I believe regexes are str
types by default and therefore Unicode by default, so this will match
non-ASCII characters, short-circuit this logic, and never call
formataddr.
I'm not sure the original motivation for the short-circuit here, but
I suspect just removing the re.match conditional and unconditionally
calling email.utils.formataddr will produce the correct behavior.
-- Package-specific info:
** Environment settings:
EDITOR="vi"
PAGER="less"
VISUAL="vi"
DEBEMAIL="rra at debian.org"
DEBFULLNAME="Russ Allbery"
INTERFACE="text"
** /home/eagle/.reportbugrc:
reportbug_version "6.4.4"
mode expert
ui text
no-cc
header "X-Debbugs-CC: rra at debian.org"
smtphost reportbug.debian.org
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (990, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.8.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages reportbug depends on:
ii apt 1.4~beta2
ii python3-reportbug 7.1.1
pn python3:any <none>
reportbug recommends no packages.
Versions of packages reportbug suggests:
pn claws-mail <none>
ii debconf-utils 1.5.59
pn debsums <none>
pn dlocate <none>
ii emacs24-bin-common 24.5+1-7.1
ii file 1:5.29-2
ii gir1.2-gtk-3.0 3.22.5-1
pn gir1.2-vte-2.91 <none>
ii gnupg 2.1.17-2
ii postfix [mail-transport-agent] 3.1.3-6
ii python3-gi 3.22.0-2
pn python3-gtkspellcheck <none>
pn python3-urwid <none>
ii xdg-utils 1.1.1-1
-- no debconf information
More information about the Reportbug-maint
mailing list