control: tags 857013 patch

Thanks Michal for finding and reporting this bug!
>From 9d8f610dedbd831961ed2d30d96782c569c60d5c Mon Sep 17 00:00:00 2001
From: Nis Martensen <nis.marten...@web.de>
Date: Sat, 22 Apr 2017 11:43:19 +0200
Subject: [PATCH 2/2] utils.py: Fix IndexError: list index out of range

re.findall() called with a regexp containing groups will return a list
of tuples. In our case: a list containing zero or exactly one tuple.

Since we are storing the result in a list anyway, simply add the two
lists and do not try to extract an element first. If re.findall()
returns an empty list, this does nothing and will no longer crash.
---
 reportbug/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/reportbug/utils.py b/reportbug/utils.py
index 2a5bea1..e3084bb 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -376,7 +376,7 @@ def get_package_status(package, avail=False):
                 confmode = False
             else:
                 # re is used to identify also conffiles with spaces in the name
-                conffiles = conffiles + [re.findall(r' (.+) ([0-9a-f]+).*$', line)[0]]
+                conffiles += re.findall(r' (.+) ([0-9a-f]+).*$', line)
 
         if versionre.match(line):
             (crud, pkgversion) = line.split(": ", 1)
-- 
2.1.4

_______________________________________________
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reportbug-maint

Reply via email to