Received: from eggs.gnu.org ([208.118.235.92]:52491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWtZD-00056n-PU for qemu-devel@nongnu.org; Tue, 22 May 2012 14:12:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWtZB-0002Bz-AF for qemu-devel@nongnu.org; Tue, 22 May 2012 14:12:19 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:39410) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWtZA-00023v-Uz for qemu-devel@nongnu.org; Tue, 22 May 2012 14:12:17 -0400 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <1337702582-26368-1-git-send-email-stefanha@linux.vnet.ibm.com> <1337702582-26368-3-git-send-email-stefanha@linux.vnet.ibm.com> Date: Tue, 22 May 2012 20:06:48 +0200 In-Reply-To: <1337702582-26368-3-git-send-email-stefanha@linux.vnet.ibm.com> (Stefan Hajnoczi's message of "Tue, 22 May 2012 17:03:02 +0100") Message-ID: <87likk9jk7.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1.1 2/2] tracetool: allow parenthesis in trace-events format strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: qemu-devel@nongnu.org Stefan Hajnoczi writes: > 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 > Signed-off-by: Stefan Hajnoczi Reviewed-by: Llu=C3=ADs Vilanova > --- > 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. > """ =20 > - _CRE =3D re.compile("((?P.*)\s+)?(?P[^(\s]+)\((?P= [^)]*)\)\s*(?P\".*)?") > + _CRE =3D re.compile("((?P.*)\s+)?(?P[^\"(\s]+)\((?P[^)]*)\)\s*(?P\".*)?") =20 > _VALID_PROPS =3D set(["disable"]) =20 > --=20 > 1.7.10 --=20 "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth