bug patterns need to escape parentheses

Bug #845730 reported by Brian Murray
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Apport
Invalid
Undecided
Unassigned
apport (Ubuntu)
Invalid
Low
Unassigned

Bug Description

We've discovered that when writing bug patterns it isn't necessary to escape parens "()" in the Title and OriginalTitle key of bug patterns. For example:

<pattern url="https://launchpad.net/bugs/832745">
<re key="Package">^update-manager </re>
<re key="OriginalTitle">update-manager crashed with TypeError in confirmChanges\(\)</re>
<re key="Traceback">TypeError: glib.markup_escape_text\(\) takes at most 1 argument \(2 given\)</re>
</pattern>

The pattern above matches when used with test-local from the bugpatterns branch (rev 329) and so does:

<pattern url="https://launchpad.net/bugs/832745">
<re key="Package">^update-manager </re>
<re key="OriginalTitle">update-manager crashed with TypeError in confirmChanges()</re>
<re key="Traceback">TypeError: glib.markup_escape_text\(\) takes at most 1 argument \(2 given\)</re>
</pattern>

However, if one were to remove the escaping of parens in the Traceback key of the pattern the pattern would not match. This makes little sense and inspecting the code of both test-local and the "_check_bug_pattern" function of apport/report.py gives no indication why this might be.

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: apport 1.22.1-0ubuntu2
ProcVersionSignature: Ubuntu 3.0.0-10.16-generic 3.0.4
Uname: Linux 3.0.0-10-generic x86_64
ApportLog:

ApportVersion: 1.22.1-0ubuntu2
Architecture: amd64
CheckboxSubmission: fee5e196cb921cbd36888f428b38b488
CheckboxSystem: 2a6f54df59af338184485e85cbcf0d32
Date: Fri Sep 9 08:26:57 2011
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/zsh
SourcePackage: apport
UpgradeStatus: Upgraded to oneiric on 2011-09-06 (2 days ago)

Revision history for this message
Brian Murray (brian-murray) wrote :
Changed in apport (Ubuntu):
status: New → Confirmed
summary: - TItle and OriginalTitle field of bugpatterns behaves oddly
+ Title and OriginalTitle field of bugpatterns behaves oddly
Revision history for this message
Brian Murray (brian-murray) wrote :

Oh bug 832745 is actually a bad test with test-local as it doesn't have an OriginalTitle - you'll want to use a duplicate like bug 845654 to really test the pattern.

Changed in apport (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Martin Pitt (pitti) wrote :

Right, all matches in bug patterns are regular expressions, and '(', ')', '+', '?' etc. are magic characters in regexps and thus need to be escaped. As I don't want to restrict the power of regexps there, I'm afraid it needs to stay as it is.

summary: - Title and OriginalTitle field of bugpatterns behaves oddly
+ bug patterns need to escape parentheses
Changed in apport (Ubuntu):
importance: Medium → Low
status: Confirmed → Invalid
Changed in apport:
status: New → Invalid
Revision history for this message
Brian Murray (brian-murray) wrote :

My point was that the parens don't need to be escaped if they appear in the OriginalTItle re.

Revision history for this message
Brian Murray (brian-murray) wrote :

This is actually because the pattern in () in the OriginalTitle is empty and so because it has no criteria it matches.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.