apport-hackers team mailing list archive
-
apport-hackers team
-
Mailing list archive
-
Message #00107
[Merge] lp:~brian-murray/apport/pattern-parsing-unicode into lp:apport
Brian Murray has proposed merging lp:~brian-murray/apport/pattern-parsing-unicode into lp:apport.
Requested reviews:
Apport upstream developers (apport-hackers)
For more details, see:
https://code.launchpad.net/~brian-murray/apport/pattern-parsing-unicode/+merge/125047
I was trying to test some bugpatterns on quantal and they kept failing because _check_bug_patterns was returning None because of unicode in the patterns. This fixes that and adds a test for it.
For an example try './test-local 1051853'. test-local is from the ubuntu-bugpatterns bzr branch.
--
https://code.launchpad.net/~brian-murray/apport/pattern-parsing-unicode/+merge/125047
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/pattern-parsing-unicode into lp:apport.
=== modified file 'apport/report.py'
--- apport/report.py 2012-09-10 10:10:35 +0000
+++ apport/report.py 2012-09-18 20:51:31 +0000
@@ -153,7 +153,7 @@
def _check_bug_patterns(report, patterns):
try:
- dom = xml.dom.minidom.parseString(patterns)
+ dom = xml.dom.minidom.parseString(patterns.encode('UTF-8'))
except (ExpatError, UnicodeEncodeError):
return None
=== modified file 'test/test_report.py'
--- test/test_report.py 2012-09-10 10:10:35 +0000
+++ test/test_report.py 2012-09-18 20:51:31 +0000
@@ -762,6 +762,10 @@
<re key="SourcePackage">^bazaar$</re>
<re key="LogFile">AssertionError</re>
</pattern>
+ <pattern url="http://bugtracker.net/bugs/6">
+ <re key="Package">^update-notifier</re>
+ <re key="LogFile">AssertionError ‽</re>
+ </pattern>
</patterns>''')
patterns.flush()
@@ -790,6 +794,9 @@
pattern_url = 'file://' + patterns.name
+ # will return None if the patterns fail parsing
+ self.assertEqual(apport.report._check_bug_patterns(r_bash, pattern_url),
+ None)
# positive match cases
self.assertEqual(r_bash.search_bug_patterns(pattern_url),
'http://bugtracker.net/bugs/1')