← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~brian-murray/apport/bug-1016380 into lp:apport

 

Brian Murray has proposed merging lp:~brian-murray/apport/bug-1016380 into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)
Related bugs:
  Bug #1016380 in apport (Ubuntu): "apport-gtk crashed with TypeError in _check_bug_pattern(): can't use a string pattern on a bytes-like object"
  https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1016380

For more details, see:
https://code.launchpad.net/~brian-murray/apport/bug-1016380/+merge/123365

All the bug patterns are strings so log files should be decoded so that the patterns won't crash on them.
-- 
https://code.launchpad.net/~brian-murray/apport/bug-1016380/+merge/123365
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/bug-1016380 into lp:apport.
=== modified file 'apport/report.py'
--- apport/report.py	2012-08-31 10:42:24 +0000
+++ apport/report.py	2012-09-07 20:53:24 +0000
@@ -137,7 +137,10 @@
                 regexp = c.childNodes[0].nodeValue
                 v = report[key]
                 if isinstance(v, problem_report.CompressedValue):
-                    v = v.get_value()
+                    v = v.get_value().decode('UTF-8')
+                    regexp = regexp.encode('UTF-8')
+                elif isinstance(v, bytes):
+                    v = v.get_value().decode('UTF-8')
                     regexp = regexp.encode('UTF-8')
                 try:
                     re_c = re.compile(regexp)