The regular expression used to parse ./trace-events fails on the
following input:

  test_paren(int n) "(%d)"

The problem is that the regular expression uses greedy matching and '"'
becomes the name of the event while 'test_paren(int n) ' becomes the
properties of the event.

Prevent greedy matching from going too far by explicitly saying the name
cannot have a '"'.  This forces the regular expression engine to
backtrack to the desired match.

Reported-by: Bob Breuer <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
---
 scripts/tracetool/__init__.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 175df08..148f553 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -120,7 +120,7 @@ class Event(object):
         The event arguments.
     """
 
-    _CRE = 
re.compile("((?P<props>.*)\s+)?(?P<name>[^(\s]+)\((?P<args>[^)]*)\)\s*(?P<fmt>\".*)?")
+    _CRE = 
re.compile("((?P<props>.*)\s+)?(?P<name>[^\"(\s]+)\((?P<args>[^)]*)\)\s*(?P<fmt>\".*)?")
 
     _VALID_PROPS = set(["disable"])
 
-- 
1.7.10


Reply via email to