From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bvAdn-0006WA-Fm for qemu-devel@nongnu.org; Fri, 14 Oct 2016 18:07:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bvAdg-0005pr-5r for qemu-devel@nongnu.org; Fri, 14 Oct 2016 18:07:45 -0400 Received: from 5.mo179.mail-out.ovh.net ([46.105.43.140]:60192) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bvAdB-0005bE-Hj for qemu-devel@nongnu.org; Fri, 14 Oct 2016 18:07:40 -0400 Received: from player792.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 26B75FFA3F9 for ; Sat, 15 Oct 2016 00:06:05 +0200 (CEST) Date: Sat, 15 Oct 2016 00:06:00 +0200 From: Greg Kurz Message-ID: <20161015000600.1cc5d7a4@bahia> In-Reply-To: References: <147648037766.14770.15179642645810274907.stgit@bahia> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/sHznB6/FPD=wLl9pSQMdF3H"; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [PATCH] trace: fix group name generation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Stefan Hajnoczi , Peter Maydell --Sig_/sHznB6/FPD=wLl9pSQMdF3H Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 14 Oct 2016 16:31:01 -0500 Eric Blake wrote: > On 10/14/2016 04:26 PM, Greg Kurz wrote: > > Since commit "80dd5c4918ab trace: introduce a formal group name for tra= ce > > events", tracetool generates C variable names and macro definitions out > > of the path to the trace-events-all file. > >=20 > > The current code takes care of turning '/' and '-' characters into > > underscores so that the resulting names are valid C tokens. This is > > enough because these are the only illegal characters that appear in > > a relative path within the QEMU source tree. > >=20 > > Things are different for out of tree builds where the path may contain > > arbitrary character combinations, causing tracetool to generate invalid > > names. > > =20 >=20 > > This patch ensures that only letters [A-Za-z], digits [0-9] and undersc= ores > > are kept. All other characters are turned into underscores. Also, since= the > > first character of C symbol names cannot be a digit, an underscore is > > prepended to the group name. > >=20 > > Signed-off-by: Greg Kurz > > --- > > scripts/tracetool.py | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > >=20 > > diff --git a/scripts/tracetool.py b/scripts/tracetool.py > > index 629b2593c846..b81b834db924 100755 > > --- a/scripts/tracetool.py > > +++ b/scripts/tracetool.py > > @@ -70,7 +70,7 @@ def make_group_name(filename): > > =20 > > if dirname =3D=3D "": > > return "common" > > - return re.sub(r"/|-", "_", dirname) > > + return "_" + re.sub(r"[^\w]", "_", dirname) =20 >=20 > This STILL doesn't solve the complaint that the build is now dependent > on the location. Why can't we STRIP off any prefix prior to the in-tree > portion of the naming that we know is sane, instead of munging the > prefix but in the process creating source code that generates with > different lengths? >=20 Heh, because the complaint was about the build break :) > Ideally, compiling twice, once in directory 'a', and the second time in > directory 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa', should not make a noticeable > difference in the final size of the executable due to the difference in > lengths of the debugging symbols used to record the longer name of the > second directory being encoded into lots of macro names. >=20 You're right. I'm okay to look for a way to fix the symbol variable size issue, but I think this patch still makes sense as it makes tracetool less fragile in case we add a directory with an illegal character to the QEMU tree... and it fixes annoying build breaks (Paolo also hit this and asked to revert 80dd5c4918ab in another mail). Cc'ing Peter... --Sig_/sHznB6/FPD=wLl9pSQMdF3H Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlgBVsgACgkQAvw66wEB28JBZgCfT8Obs7B7wkdlXt38jjMSJNfI UjkAni3ujYFAOAozz4rQ8u+NAK4GcZhg =t2SR -----END PGP SIGNATURE----- --Sig_/sHznB6/FPD=wLl9pSQMdF3H--