Re: [PATCH 3/3] perf parse: Allow names to start with digits

From: Dominique Martinet
Date: Sun Apr 07 2024 - 08:38:41 EST


Dominique Martinet wrote on Sun, Apr 07, 2024 at 09:18:21PM +0900:
> diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
> index e86c45675e1d..41c30ff29783 100644
> --- a/tools/perf/util/parse-events.l
> +++ b/tools/perf/util/parse-events.l
> @@ -158,7 +158,7 @@ event [^,{}/]+
> num_dec [0-9]+
> num_hex 0x[a-fA-F0-9]{1,16}
> num_raw_hex [a-fA-F0-9]{1,16}
> -name [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]!\-]*
> +name [a-zA-Z0-9_*?\[\]][a-zA-Z0-9_*?.\[\]!\-]*

grmbl sorry I guess I didn't actually test this two years ago (?!), or
used it differently (commit message is weird and also needs fixing,
perf probe -e 9p:* does not make sense) or something changed but
that's not enough:

----
$ sudo ./perf trace -e 9p:9p_fid_ref
event syntax error: '9p:9p_fid_ref'
\___ parser error
Run 'perf list' for a list of valid events
----

Adding 0-9 to name_tag as well makes perf trace works.

I'm not sure what name_minus is for but I did't need to add that one in
my test.

That also highlights that the test I added isn't sufficient, if someone
familiar with the code could hint at a better place to test please tell!
Otherwise I'll have a look next weekend, I need to get back to my 9p
bugs now I've got a working perf command..

> name_tag [\'][a-zA-Z_*?\[\]][a-zA-Z0-9_*?\-,\.\[\]:=]*[\']
> name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]*
> drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)?
>

--
Dominique Martinet | Asmadeus