From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWNTI-0007Ts-RO for qemu-devel@nongnu.org; Tue, 23 Sep 2014 06:37:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWNTE-0001uF-FV for qemu-devel@nongnu.org; Tue, 23 Sep 2014 06:37:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWNTE-0001tQ-7B for qemu-devel@nongnu.org; Tue, 23 Sep 2014 06:37:20 -0400 From: Stefan Hajnoczi Date: Tue, 23 Sep 2014 11:37:06 +0100 Message-Id: <1411468626-20450-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2] trace: tighten up trace-events regex to fix bad parse List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Stefan Hajnoczi , Eric Auger Use \w for properties and trace event names since they are both drawn from [a-zA-Z0-9_] character sets. The .* for matching properties was too aggressive and caused the following failure with foo(int rc) "(this is a test)": Traceback (most recent call last): File "scripts/tracetool.py", line 139, in main(sys.argv) File "scripts/tracetool.py", line 134, in main binary=3Dbinary, probe_prefix=3Dprobe_prefix) File "scripts/tracetool/__init__.py", line 334, in generate events =3D _read_events(fevents) File "scripts/tracetool/__init__.py", line 262, in _read_events res.append(Event.build(line)) File "scripts/tracetool/__init__.py", line 225, in build return Event(name, props, fmt, args, arg_fmts) File "scripts/tracetool/__init__.py", line 185, in __init__ % ", ".join(unknown_props)) ValueError: Unknown properties: foo(int, rc) Cc: Llu=C3=ADs Vilanova Reported-by: Eric Auger Signed-off-by: Stefan Hajnoczi --- v2: * Fix regex to allow multiple properties [Llu=C3=ADs] scripts/tracetool/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.p= y index 36c789d..6ee6af7 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -140,8 +140,8 @@ class Event(object): The format strings for each argument. """ =20 - _CRE =3D re.compile("((?P.*)\s+)?" - "(?P[^(\s]+)" + _CRE =3D re.compile("((?P[\w\s]+)\s+)?" + "(?P\w+)" "\((?P[^)]*)\)" "\s*" "(?:(?:(?P\".+),)?\s*(?P\".+))?" --=20 1.9.3