[Reportbug-maint] Bug#529251: doesn't detect errors returned by the mailer (mutt)

Carl Chenet chaica at ohmytux.com
Sun Aug 2 15:07:26 UTC 2009


Package: reportbug
Version: 4.5
Severity: normal
Tags: patch

Hi,

Here is a patch to allow the user using a mua exiting with error to be warned and to re-edit the message before trying to resend it. The user also can choose to simpy exit.
Bye,
Carl Chenet


-- Package-specific info:
** Environment settings:
DEBEMAIL="chaica at ohmytux.com"
DEBFULLNAME="Carl Chenet"
INTERFACE="text"

** /home/chaica/.reportbugrc:
reportbug_version "4.5"
mode novice
ui text
smtphost "smtp.free.fr"

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

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

reportbug recommends no packages.

Versions of packages reportbug suggests:
pn  debconf-utils                 <none>     (no description available)
ii  debsums                       2.0.44     verification of installed package 
pn  dlocate                       <none>     (no description available)
ii  exim4                         4.69-9     metapackage to ease Exim MTA (v4) 
ii  exim4-daemon-light [mail-tran 4.69-9     lightweight Exim MTA (v4) daemon
ii  file                          5.00-1     Determines file type using "magic"
ii  gnupg                         1.4.9-4    GNU privacy guard - a free PGP rep
pn  python-gnome2-extras          <none>     (no description available)
pn  python-gtk2                   <none>     (no description available)
pn  python-urwid                  <none>     (no description available)
pn  python-vte                    <none>     (no description available)

-- no debconf information
-------------- next part --------------
>From 6757073f006798ab325d2f91ea40f5015afdd3b0 Mon Sep 17 00:00:00 2001
From: chaica <chaica at ohmytux.com>
Date: Sun, 2 Aug 2009 17:01:29 +0200
Subject: [PATCH] detect errors returned by the mailer

---
 reportbug/submit.py     |   22 +++++++++++++++++++++-
 reportbug/ui/text_ui.py |    3 ++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/reportbug/submit.py b/reportbug/submit.py
index de74950..b04cfb8 100644
--- a/reportbug/submit.py
+++ b/reportbug/submit.py
@@ -435,7 +435,27 @@ def send_report(body, attachments, mua, fromaddr, sendto, ccaddr, bccaddr,
         ewrite("Spawning %s...\n", bit or mua)
         if '%s' not in mua:
             mua += ' %s'
-        ui.system(mua % commands.mkarg(filename)[1:])
+        returnvalue = 0
+        succeeded = False
+        while not succeeded:
+            returnvalue = ui.system(mua % commands.mkarg(filename)[1:])
+            if returnvalue != 0:
+                ewrite("Mutt users should be aware it is mandatory to edit the draft before sending.\n")
+                mtitle = 'Sending the report has failed; What now?'
+                mopts = 'Eq'
+                moptsdesc = {'e' : 'Edit the message.',
+                'q' : 'Quit reportbug;Will save your report for a next use.'}
+                x = ui.select_options(mtitle, mopts, moptsdesc)
+                if x == 'q':
+                    failed = True
+                    fh, msgname = TempFile(prefix=tfprefix)
+                    fh.write(message)
+                    fh.close()
+                    ewrite('Original write failed, wrote bug report to %s\n', msgname)
+                    succeeded = True
+            else:
+                succeeded = True
+
     elif not failed and (using_sendmail or smtphost):
         if kudos:
             ewrite('\nMessage sent to: %s\n', sendto)
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index 450d7c3..a632db8 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -74,7 +74,8 @@ def system(cmdline):
         x = os.getcwd()
     except OSError:
         os.chdir('/')
-    os.system(cmdline)
+    returnvalue = os.system(cmdline)
+    return returnvalue
 
 def indent_wrap_text(text, starttext='', indent=0, linelen=None):
     """Wrapper for textwrap.fill to the existing API."""
-- 
1.6.2.3



More information about the Reportbug-maint mailing list