Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package reportbug

This upload fixes 2 crashes (one of which pinged by a RT member)

unblock reportbug/7.1.6

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64
 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru reportbug-7.1.5/debian/changelog reportbug-7.1.6/debian/changelog
--- reportbug-7.1.5/debian/changelog    2017-02-12 12:07:18.000000000 -0500
+++ reportbug-7.1.6/debian/changelog    2017-04-18 21:12:02.000000000 -0400
@@ -1,3 +1,15 @@
+reportbug (7.1.6) unstable; urgency=medium
+
+  * reportbug/utils.py
+    - wrap every command execution in a helper function to (eventually) decode
+      the command output, this will prevent non-UTF-8 output to crash 
reportbug;
+      patch by Nis Martensen; Closes: #857794
+  * reportbug/submit.py
+    - handle text attachments in different encodings, currently making 
reportbug
+      crash; patch by Nis Martensen; Follow up for #848729
+
+ -- Sandro Tosi <mo...@debian.org>  Tue, 18 Apr 2017 21:12:02 -0400
+
 reportbug (7.1.5) unstable; urgency=medium
 
   * reportbug/utils.py
diff -Nru reportbug-7.1.5/reportbug/__init__.py 
reportbug-7.1.6/reportbug/__init__.py
--- reportbug-7.1.5/reportbug/__init__.py       2017-02-12 12:07:18.000000000 
-0500
+++ reportbug-7.1.6/reportbug/__init__.py       2017-04-18 21:12:02.000000000 
-0400
@@ -25,7 +25,7 @@
 __all__ = ['bugreport', 'utils', 'urlutils', 'checkbuildd', 'checkversions',
            'debbugs', 'exceptions', 'submit', 'tempfile']
 
-VERSION_NUMBER = "7.1.5"
+VERSION_NUMBER = "7.1.6"
 
 VERSION = "reportbug " + VERSION_NUMBER
 COPYRIGHT = VERSION + '\nCopyright (C) 1999-2008 Chris Lawrence 
<lawre...@debian.org>' + \
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/reportbug/__pycache__/__init__.cpython-35.pyc 
and 
/tmp/snN27qW4Zs/reportbug-7.1.6/reportbug/__pycache__/__init__.cpython-35.pyc 
differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/reportbug/__pycache__/utils.cpython-35.pyc and 
/tmp/snN27qW4Zs/reportbug-7.1.6/reportbug/__pycache__/utils.cpython-35.pyc 
differ
diff -Nru reportbug-7.1.5/reportbug/submit.py 
reportbug-7.1.6/reportbug/submit.py
--- reportbug-7.1.5/reportbug/submit.py 2017-02-12 12:07:18.000000000 -0500
+++ reportbug-7.1.6/reportbug/submit.py 2017-04-18 21:12:02.000000000 -0400
@@ -153,9 +153,15 @@
 
         maintype, subtype = ctype.split('/', 1)
         if maintype == 'text':
-            fp = open(attachment, 'rU')
-            part = MIMEText(fp.read())
-            fp.close()
+            try:
+                with open(attachment, 'rU') as fp:
+                    part = MIMEText(fp.read())
+            except UnicodeDecodeError:
+                fp = open(attachment, 'rb')
+                part = MIMEBase(maintype, subtype)
+                part.set_payload(fp.read())
+                fp.close()
+                email.encoders.encode_base64(part)
         elif maintype == 'message':
             fp = open(attachment, 'rb')
             part = MIMEMessage(email.message_from_file(fp),
diff -Nru reportbug-7.1.5/reportbug/utils.py reportbug-7.1.6/reportbug/utils.py
--- reportbug-7.1.5/reportbug/utils.py  2017-02-12 12:07:18.000000000 -0500
+++ reportbug-7.1.6/reportbug/utils.py  2017-04-18 21:12:02.000000000 -0400
@@ -180,6 +180,13 @@
     return (pipe, use_dlocate)
 
 
+def get_command_output(cmd):
+    use_shell = False
+    if isinstance(cmd, str) and ' ' in cmd:
+        use_shell = True
+    return subprocess.run(cmd, shell=use_shell, 
stdout=subprocess.PIPE).stdout.decode(errors='backslashreplace')
+
+
 def query_dpkg_for(filename, use_dlocate=True):
     try:
         x = os.getcwd()
@@ -353,10 +360,10 @@
 
     packarg = pipes.quote(package)
     if avail:
-        output = subprocess.getoutput(
+        output = get_command_output(
             "COLUMNS=79 dpkg --print-avail %s 2>/dev/null" % packarg)
     else:
-        output = subprocess.getoutput(
+        output = get_command_output(
             "COLUMNS=79 dpkg --status %s 2>/dev/null" % packarg)
 
     for line in output.split(os.linesep):
@@ -511,7 +518,7 @@
 
 
 def available_package_description(package):
-    data = subprocess.getoutput('apt-cache show ' + pipes.quote(package))
+    data = get_command_output('apt-cache show ' + pipes.quote(package))
     descre = re.compile('^Description(?:-.*)?: (.*)$')
     for line in data.split('\n'):
         m = descre.match(line)
@@ -523,7 +530,7 @@
 def get_source_name(package):
     packages = []
 
-    data = subprocess.getoutput('apt-cache showsrc ' + pipes.quote(package))
+    data = get_command_output('apt-cache showsrc ' + pipes.quote(package))
     packre = re.compile(r'^Package: (.*)$')
     for line in data.split('\n'):
         m = packre.match(line)
@@ -537,7 +544,7 @@
     retlist = []
     found = {}
 
-    data = subprocess.getoutput('apt-cache showsrc ' + pipes.quote(package))
+    data = get_command_output('apt-cache showsrc ' + pipes.quote(package))
     binre = re.compile(r'^Binary: (.*)$')
     for line in data.split('\n'):
         m = binre.match(line)
@@ -704,7 +711,7 @@
             confinfo[filename] = msg
             continue
 
-        filemd5 = subprocess.getoutput('md5sum ' + 
pipes.quote(filename)).split()[0]
+        filemd5 = get_command_output('md5sum ' + 
pipes.quote(filename)).split()[0]
         if filemd5 == md5sum:
             continue
 
@@ -732,7 +739,7 @@
 def get_debian_release_info():
     debvers = debinfo = verfile = warn = ''
     dists = []
-    output = subprocess.getoutput('apt-cache policy 2>/dev/null')
+    output = get_command_output('apt-cache policy 2>/dev/null')
     if output:
         mre = re.compile('\s+(\d+)\s+.*$\s+release\s.*o=(Ubuntu|Debian|Debian 
Ports),a=([^,]+),', re.MULTILINE)
         found = {}
@@ -776,11 +783,11 @@
 
 
 def lsb_release_info():
-    return subprocess.getoutput('lsb_release -a 2>/dev/null') + '\n'
+    return get_command_output('lsb_release -a 2>/dev/null') + '\n'
 
 
 def get_arch():
-    arch = subprocess.getoutput('COLUMNS=79 dpkg --print-architecture 
2>/dev/null')
+    arch = get_command_output('COLUMNS=79 dpkg --print-architecture 
2>/dev/null')
     if not arch:
         un = os.uname()
         arch = un[4]
@@ -791,7 +798,7 @@
 
 
 def get_multiarch():
-    out = subprocess.getoutput('COLUMNS=79 dpkg --print-foreign-architectures 
2>/dev/null')
+    out = get_command_output('COLUMNS=79 dpkg --print-foreign-architectures 
2>/dev/null')
     return ', '.join(out.splitlines())
 
 
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/__init__.cpython-35.pyc and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/__init__.cpython-35.pyc differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_bugreport.cpython-35.pyc 
and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_bugreport.cpython-35.pyc 
differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_checkbuildd.cpython-35.pyc
 and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_checkbuildd.cpython-35.pyc
 differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_checkversions.cpython-35.pyc
 and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_checkversions.cpython-35.pyc
 differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_debbugs.cpython-35.pyc 
and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_debbugs.cpython-35.pyc 
differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_exception.cpython-35.pyc 
and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_exception.cpython-35.pyc 
differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_hiermatch.cpython-35.pyc 
and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_hiermatch.cpython-35.pyc 
differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_tempfiles.cpython-35.pyc 
and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_tempfiles.cpython-35.pyc 
differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_ui.cpython-35.pyc and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_ui.cpython-35.pyc differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_ui_gtk2.cpython-35.pyc 
and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_ui_gtk2.cpython-35.pyc 
differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_urlutils.cpython-35.pyc 
and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_urlutils.cpython-35.pyc 
differ
Binary files 
/tmp/1bRAXcxzCa/reportbug-7.1.5/test/__pycache__/test_utils.cpython-35.pyc and 
/tmp/snN27qW4Zs/reportbug-7.1.6/test/__pycache__/test_utils.cpython-35.pyc 
differ

Reply via email to