[Reportbug-maint] Bug#579894: reportbug: replace use of rfc822 module with email.utils due to quoting bug in rfc822

Paul \ TBBle\\ Hampson Paul.Hampson at Pobox.com
Sun May 2 03:45:55 UTC 2010

Package: reportbug
Version: 4.12.1
Severity: wishlist

While looking harder into why my name was not coming through correctly in
bug reports, I discovered that the problem stems from using the deprecated
rfc822 module for parsing email addresses instead of the replacement email

Specifically, the bug is visible here:
Python 2.5.5 (r255:77872, Apr 21 2010, 08:40:04) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rfc822
>>> rfc822.dump_address_pair( ( 'Paul "TBBle" Hampson', 'Paul.Hampson at Pobox.com' ) )
'"Paul "TBBle" Hampson" <Paul.Hampson at Pobox.com>'
>>> rfc822.parseaddr( rfc822.dump_address_pair( ( 'Paul "TBBle" Hampson', 'Paul.Hampson at Pobox.com' ) ) )
('Paul  TBBle  Hampson', 'Paul.Hampson at Pobox.com')

>>> import email.utils
>>> email.utils.formataddr( ( 'Paul "TBBle" Hampson', 'Paul.Hampson at Pobox.com' ) )
'"Paul \\"TBBle\\" Hampson" <Paul.Hampson at Pobox.com>'
>>> email.utils.parseaddr( email.utils.formataddr( ( 'Paul "TBBle" Hampson', 'Paul.Hampson at Pobox.com' ) ) )
('Paul "TBBle" Hampson', 'Paul.Hampson at Pobox.com')

The bug in rfc822 is that dump_address_pair is supposed to be the inverse of parseaddr, but does not
perform the neccessary quoting which parseaddr will unquote.

>From a look at the upstream bugtracker [1], they're not interested in fixing this in the rfc822 module,
which was deprecated in Python 2.3.

The only uses of rfc822 in reportbug that I can see are for address parsing, for which email.utils
appears to provide equivalents (as above, plus rfc822.AddressList looks like it can be replaced with

This bug can be worked around by pre-quoting the strings in the config file, as can be seen in my
..reportbugrc below.

[1] http://bugs.python.org/issue494034

-- Package-specific info:
** Environment settings:
DEBEMAIL="paulh at microforte.com"

** /home/tbble/.reportbugrc:
reportbug_version "4.12.1"
mode standard
ui text
realname 'Paul \\"TBBle\\" Hampson'
email "Paul.Hampson at Pobox.com"
smtphost "smtp.gmail.com:587"
smtpuser "TBBleTBBle at gmail.com"

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages reportbug depends on:
ii  apt                    Advanced front-end for dpkg
ii  python                        2.5.4-9    An interactive high-level object-o
ii  python-reportbug              4.12.1     Python modules for interacting wit

reportbug recommends no packages.

Versions of packages reportbug suggests:
ii  debconf-utils        1.5.32              debconf utilities
ii  debsums              2.0.48              tool for verification of installed
pn  dlocate              <none>              (no description available)
pn  emacs22-bin-common | <none>              (no description available)
ii  file                 5.04-2              Determines file type using "magic"
ii  gnupg                1.4.10-3            GNU privacy guard - a free PGP rep
ii  python-gtk2          2.17.0-2            Python bindings for the GTK+ widge
pn  python-gtkspell      <none>              (no description available)
pn  python-urwid         <none>              (no description available)
pn  python-vte           <none>              (no description available)
ii  ssmtp [mail-transpor 2.64-4              extremely simple MTA to get mail o
ii  xdg-utils            1.0.2+cvs20100307-1 desktop integration utilities from

-- no debconf information

More information about the Reportbug-maint mailing list