tags 302103 +patch
thanks

For reference: #302103: Silently terminates/exits with status 1 with no
error when no net connection available

On 07/10/20 21:51 -0400, Jerry Quinn said ...
> This bug is 2 years old.  What's happening with it?

Must've slipped through the cracks.  A follow-up reminder like this one
is always a good thing :-)

I am attaching a patch to fix this bug.

Giridhar

-- 
Y Giridhar Appaji Nag | http://www.appaji.net/
diff -Nur reportbug-3.39.old/debianbts.py reportbug-3.39/debianbts.py
--- reportbug-3.39.old/debianbts.py	2007-04-20 02:03:09.000000000 +0530
+++ reportbug-3.39/debianbts.py	2007-10-22 11:58:18.072694000 +0530
@@ -25,6 +25,7 @@
 # $Id: debianbts.py,v 1.24.2.12 2007/04/19 20:33:09 lawrencc Exp $
 
 import sgmllib, glob, os, re, reportbug, rfc822, time, urllib, checkversions
+from reportbug_exceptions import *
 from urlutils import open_url
 import sys
 
@@ -763,8 +764,12 @@
 
 def get_cgi_reports(package, system='debian', http_proxy='', archived=False,
                     source=False, version=None):
-    page = open_url(cgi_package_url(system, package, archived, source,
+    try:
+        page = open_url(cgi_package_url(system, package, archived, source,
                                     version=version), http_proxy)
+    except:
+        raise NoNetwork
+
     if not page:
         return (0, None, None)
 
@@ -810,12 +815,18 @@
                 http_proxy='', archived=False, source=False):
     if isinstance(package, basestring):
         if SYSTEMS[system].get('cgiroot'):
-            result = get_cgi_reports(package, system, http_proxy, archived,
+            try:
+                result = get_cgi_reports(package, system, http_proxy, archived,
                                      source, version=version)
+            except:
+                raise NoNetwork
             if result: return result
 
         url = package_url(system, package, mirrors, source)
-        page = open_url(url, http_proxy)
+        try:
+            page = open_url(url, http_proxy)
+        except:
+            raise NoNetwork
         if not page:
             return (0, None, None)
 
diff -Nur reportbug-3.39.old/querybts reportbug-3.39/querybts
--- reportbug-3.39.old/querybts	2006-08-26 07:37:09.000000000 +0530
+++ reportbug-3.39/querybts	2007-10-22 11:57:11.758506000 +0530
@@ -205,6 +205,8 @@
         ui.long_message('No bug reports found.\n')
     except NoReport:
         ui.long_message('Nothing new to report; exiting.\n')
+    except NoNetwork:
+        ui.long_message('Cannot connect to network.\n')
 
 if __name__ == '__main__':
     try:
diff -Nur reportbug-3.39.old/reportbug_ui_text.py reportbug-3.39/reportbug_ui_text.py
--- reportbug-3.39.old/reportbug_ui_text.py	2007-10-22 12:47:58.966577000 +0530
+++ reportbug-3.39/reportbug_ui_text.py	2007-10-22 13:04:33.061939000 +0530
@@ -505,8 +505,9 @@
         return browse_bugs(hierarchy, count, bugs, bts, queryonly,
                            mirrors, http_proxy, screen, title)
 
-    except IOError:
-        res = select_options('Unable to connect to BTS; continue', 'yN',
+    except (IOError, NoNetwork):
+        ewrite('Unable to connect to %s BTS; ', debianbts.SYSTEMS[bts]['name'])
+        res = select_options('continue', 'yN',
                              {'y': 'Keep going.',
                               'n': 'Abort.'})
         if res == 'n':
Binary files reportbug-3.39.old/reportbug_ui_text.pyc and reportbug-3.39/reportbug_ui_text.pyc differ

Attachment: signature.asc
Description: Digital signature

Reply via email to