Browse Source

in paranoid mode, handle the case when the pager exists without having processed all the text we are sending and it generates a SIGPIPE; Closes: #777010, #686922

http://stackoverflow.com/a/180152
master
Sandro Tosi 6 years ago
parent
commit
d25681df1b
  1. 6
      debian/changelog
  2. 9
      reportbug/submit.py

6
debian/changelog

@ -9,8 +9,12 @@ reportbug (6.6.6) UNRELEASED; urgency=medium
how release.d.o is using this information; Closes: #804504
* bin/reportbug
- rephrase slightly the orphan check warning; Closes: #544624
* reportbug/submit.py
- in paranoid mode, handle the case when the pager exists without having
processed all the text we are sending and it generates a SIGPIPE;
Closes: #777010, #686922
-- Sandro Tosi <morph@debian.org> Wed, 30 Dec 2015 19:39:57 +0000
-- Sandro Tosi <morph@debian.org> Wed, 30 Dec 2015 23:28:27 +0000
reportbug (6.6.5) unstable; urgency=medium

9
reportbug/submit.py

@ -44,6 +44,7 @@ from exceptions import (
)
import ui.text_ui as ui
from utils import get_email_addr
import errno
quietly = False
@ -311,7 +312,13 @@ def send_report(body, attachments, mua, fromaddr, sendto, ccaddr, bccaddr,
message = message.as_string()
if paranoid and not (template or printonly):
pager = os.environ.get('PAGER', 'sensible-pager')
os.popen(pager, 'w').write(message)
try:
os.popen(pager, 'w').write(message)
except Exception, e:
# if the PAGER exits before all the text has been sent,
# it'd send a SIGPIPE, so crash only if that's not the case
if e.errno != errno.EPIPE:
raise e
if not ui.yes_no('Does your report seem satisfactory', 'Yes, send it.',
'No, don\'t send it.'):
smtphost = mta = None

Loading…
Cancel
Save