[Reportbug-commits] [reportbug] 02/04: 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 at moszumanska.debian.org
Thu Dec 31 02:48:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository reportbug.

commit d25681df1b4474821f6eee14fe9f6b45c219264d
Author: Sandro Tosi <morph at debian.org>
Date:   Wed Dec 30 23:34:40 2015 +0000

    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
---
 debian/changelog    | 6 +++++-
 reportbug/submit.py | 9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c70e264..6096900 100644
--- a/debian/changelog
+++ b/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 at debian.org>  Wed, 30 Dec 2015 19:39:57 +0000
+ -- Sandro Tosi <morph at debian.org>  Wed, 30 Dec 2015 23:28:27 +0000
 
 reportbug (6.6.5) unstable; urgency=medium
 
diff --git a/reportbug/submit.py b/reportbug/submit.py
index 8a42a4e..bdb18bf 100644
--- a/reportbug/submit.py
+++ b/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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git



More information about the Reportbug-commits mailing list