[Reportbug-maint] Bug#864598: python-reportbug: logic error in send_report()

g1 g1pi at libero.it
Sun Jun 11 10:13:43 UTC 2017

Package: python-reportbug
Version: 6.6.3
Severity: normal

The condition 

    elif outfile or not ((mta and os.path.exists(mta)) or smtphost):

in /usr/lib/python2.7/dist-packages/reportbug/submit.py (line 315) is true
also if outfile is None and mta is set to a non-existent path.

The following line 

    msgname = os.path.expanduser(outfile) or ('/var/tmp/%s.bug' % package)

triggers an exception when os.path.expanduser is called with outfile=None
as its argument.

e.g., with .reportbugrc containing 

    reportbug_version "6.6.3"
    mode standard
    ui text
    realname "john smith"
    email "john.smith at example.com"
    mta "~/bin/mta-wrapper"

submitting bug reports fails with

    Traceback (most recent call last):
      File "/usr/bin/reportbug", line 2211, in <module>
      File "/usr/bin/reportbug", line 1081, in main
	return iface.user_interface()
      File "/usr/bin/reportbug", line 2203, in user_interface
      File "/usr/lib/python2.7/dist-packages/reportbug/submit.py", line 316, in send_report
	elif outfile or not ((mta and os.path.exists(mta)) or smtphost):
      File "/usr/lib/python2.7/posixpath.py", line 261, in expanduser
	if not path.startswith('~'):


- mta is true
- os.path.exists(mta) is false (tilde expansion is not performed before testing)
- smtphost is false

so the block is entered with outfile=None

Best regards,

-- System Information:
Debian Release: 8.8
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.16.0-4-586
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages python-reportbug depends on:
ii  apt     
ii  python-debian     0.1.27
ii  python-debianbts  1.12
pn  python:any        <none>

python-reportbug recommends no packages.

Versions of packages python-reportbug suggests:
ii  reportbug  6.6.3

-- no debconf information

More information about the Reportbug-maint mailing list