public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Nick Alcock <nick.alcock@oracle.com>
To: Kris Van Hees via DTrace-devel <dtrace-devel@oss.oracle.com>
Cc: dtrace@lists.linux.dev, Kris Van Hees <kris.van.hees@oracle.com>
Subject: Re: [DTrace-devel] [PATCH 2/3] usdt parser: handle encoded hyphens
Date: Tue, 15 Jul 2025 15:21:23 +0100	[thread overview]
Message-ID: <87ple1sffg.fsf@esperi.org.uk> (raw)
In-Reply-To: <SJ0PR10MB5672B6C002E022B838F4E832C278A@SJ0PR10MB5672.namprd10.prod.outlook.com> (Kris Van Hees via DTrace-devel's message of "Tue, 24 Jun 2025 17:40:25 -0400")

On 24 Jun 2025, Kris Van Hees via DTrace-devel outgrape:

> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>

How did I miss this case? And yes, no probe with embedded hyphens will
work without this (such as foo-entry above): they'll show up, but as
e.g. foo__entry instead.

You could probably make the test fail by explicitly naming one of those
hyphenated probes in the D script: right now, the script just uses
wildcards, which will catch everything whether the de-double-underscore
code kicks in or not.

> ---
>  libcommon/usdt_parser_notes.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/libcommon/usdt_parser_notes.c b/libcommon/usdt_parser_notes.c
> index fb57f119..d3d744fb 100644
> --- a/libcommon/usdt_parser_notes.c
> +++ b/libcommon/usdt_parser_notes.c
> @@ -471,6 +471,23 @@ parse_usdt_note(int out, dof_helper_t *dhp, usdt_data_t *data,
>  	}
>  	prbt.off = off;
>  
> +	/*
> +	 * If the probe name has encoded hyphens, perform in-place changing
> +	 * from "__" into "-".
> +	 */
> +	if (strstr(prbt.prb, "__") != NULL) {
> +		char		*q;
> +		const char	*s = prbt.prb, *e = p;
> +
> +		for (q = (char *)s; s < e; s++, q++) {
> +			if (s[0] == '_' && s[1] == '_') {
> +				*q = '-';
> +				s++;
> +			} else if (s > q)
> +				*q = *s;
> +		}
> +	}
> +

This seems OK to me. I mean, fairly horrible, but C string handling *is*
fairly horrible. :)

-- 
NULL && (void)

      parent reply	other threads:[~2025-07-15 14:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 21:40 [PATCH 2/3] usdt parser: handle encoded hyphens Kris Van Hees
2025-06-30 21:53 ` [DTrace-devel] " Eugene Loh
2025-06-30 23:07   ` Kris Van Hees
2025-07-15 14:21 ` Nick Alcock [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ple1sffg.fsf@esperi.org.uk \
    --to=nick.alcock@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=kris.van.hees@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox