[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 6.0-92-g4dd95e6

Sandro Tosi morph at debian.org
Sun Dec 4 22:07:45 UTC 2011


The following commit has been merged in the master branch:
commit 85ba1b3a63c8bb59e8c92f6f448bfc70afa87796
Author: Sandro Tosi <morph at debian.org>
Date:   Sun Dec 4 18:24:48 2011 +0100

    don't generate a traceback in case of checking for versions of non-existing packages (or if rmadison doesn't return anything); thanks to Jérémy Lal for the report; Closes: #649649

diff --git a/debian/changelog b/debian/changelog
index ec78cf7..42a6288 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,8 +11,12 @@ reportbug (6.3.1) UNRELEASED; urgency=low
   * reportbug/debbugs.py
     - added new ftp archive sections: 'education', 'introspection' and
       'metapackages' as per msgid:<87iplw8px9.fsf at lennier.ganneff.de>
+  * reportbug/checkversions.py
+    - don't generate a traceback in case of checking for versions of
+      non-existing packages (or if rmadison doesn't return anything); thanks to
+      Jérémy Lal for the report; Closes: #649649
 
- -- Sandro Tosi <morph at debian.org>  Sun, 04 Dec 2011 16:48:58 +0100
+ -- Sandro Tosi <morph at debian.org>  Sun, 04 Dec 2011 18:22:53 +0100
 
 reportbug (6.3) unstable; urgency=low
 
diff --git a/reportbug/checkversions.py b/reportbug/checkversions.py
index 7da73ad..d3ee949 100644
--- a/reportbug/checkversions.py
+++ b/reportbug/checkversions.py
@@ -122,6 +122,9 @@ def get_versions_available(package, timeout, dists=None, http_proxy=None, arch='
     versions = {}
     for line in content.split('\n'):
         l = line.split('|')
+        # skip lines not having the right number of fields
+        if len(l) != 4:
+            continue
         # map suites name (returned by madison) to dist name
         dist = utils.SUITES2DISTS.get(l[2], '')
         if dist in dists:
diff --git a/test/test_checkversions.py b/test/test_checkversions.py
index 883e44e..3188a13 100644
--- a/test/test_checkversions.py
+++ b/test/test_checkversions.py
@@ -39,3 +39,9 @@ class TestVersionAvailable(unittest2.TestCase):
         # check stable version is lower than unstable
         chk = checkversions.compare_versions(vers['stable'], vers['unstable'])
         self.assertEqual(chk, 1)
+
+    @attr('network') #marking the test as using network
+    def test_bts649649(self):
+        # checking for non-existing package should not generate a traceback
+        vers = checkversions.get_versions_available('blablabla', 60)
+        self.assertEqual(vers, {})

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list