[PATCH v2] scripts: dtrace2systemtap: Fix argument name extraction regex to avoid '*' in names
From: Peter Krempa <pkrempa@redhat.com> When commit d249170bf609d2c modified the arguments of 'virNetTLSContextNew' which has a systemtap probe defined the 'dtrace2systemtap' script was no longer to correctly generate the definitions for it. First problem which stemmed from mis-detecting the string array argumment as string, which would use 'user_string' to extract it was fixed in cb33103c4afbce681. After that the generated probe is still not correct because it doesn't strip all the '*' from pointers and thus for double pointers it generates the following invalid definition: probe libvirt.rpc.tls_context_new = process("/usr/lib64/libvirt.so").mark("rpc_tls_context_new") { ctxt = $arg1; cacert = user_string($arg2); cacrl = user_string($arg3); *cert = $arg4; *keys = $arg5; sanityCheckCert = $arg6; requireValidCert = $arg7; isServer = $arg8; } Leading to the following failure: # stap -ve 'probe oneshot {exit()}' parse error: expected literal string or number saw: operator '*' at /usr/share/systemtap/tapset/libvirt_probes-64.stp:204:3 source: *cert = $arg4; ^ 1 parse error. To address the issue the regex extracting the arguments needs to optionally match any number of '*' instead of just one. Resolves: https://issues.redhat.com/browse/RHEL-153832 Fixes: cb33103c4afbce68134be112ecc5d0251e542650 Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- scripts/dtrace2systemtap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dtrace2systemtap.py b/scripts/dtrace2systemtap.py index 361dab1075..12fc390bcd 100755 --- a/scripts/dtrace2systemtap.py +++ b/scripts/dtrace2systemtap.py @@ -127,7 +127,7 @@ for file in filelist: if re.match(r'''.*char\s\*[^\*].*''', arg) is not None: isstr = True - m = re.search(r'''^.*\s\*?(\S+)$''', arg) + m = re.search(r'''^.*\s\**(\S+)$''', arg) if m is not None: arg = m.group(1) else: -- 2.53.0
On Wed, Mar 11, 2026 at 10:01:47 +0100, Peter Krempa wrote:
From: Peter Krempa <pkrempa@redhat.com>
When commit d249170bf609d2c modified the arguments of 'virNetTLSContextNew' which has a systemtap probe defined the 'dtrace2systemtap' script was no longer to correctly generate the definitions for it.
First problem which stemmed from mis-detecting the string array argumment as string, which would use 'user_string' to extract it was fixed in cb33103c4afbce681.
After that the generated probe is still not correct because it doesn't strip all the '*' from pointers and thus for double pointers it generates the following invalid definition:
probe libvirt.rpc.tls_context_new = process("/usr/lib64/libvirt.so").mark("rpc_tls_context_new") { ctxt = $arg1; cacert = user_string($arg2); cacrl = user_string($arg3); *cert = $arg4; *keys = $arg5; sanityCheckCert = $arg6; requireValidCert = $arg7; isServer = $arg8; }
Leading to the following failure:
# stap -ve 'probe oneshot {exit()}' parse error: expected literal string or number saw: operator '*' at /usr/share/systemtap/tapset/libvirt_probes-64.stp:204:3 source: *cert = $arg4; ^ 1 parse error.
To address the issue the regex extracting the arguments needs to optionally match any number of '*' instead of just one.
Resolves: https://issues.redhat.com/browse/RHEL-153832 Fixes: cb33103c4afbce68134be112ecc5d0251e542650 Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- scripts/dtrace2systemtap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/dtrace2systemtap.py b/scripts/dtrace2systemtap.py index 361dab1075..12fc390bcd 100755 --- a/scripts/dtrace2systemtap.py +++ b/scripts/dtrace2systemtap.py @@ -127,7 +127,7 @@ for file in filelist: if re.match(r'''.*char\s\*[^\*].*''', arg) is not None: isstr = True
- m = re.search(r'''^.*\s\*?(\S+)$''', arg) + m = re.search(r'''^.*\s\**(\S+)$''', arg) if m is not None: arg = m.group(1) else: -- 2.53.0
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
participants (2)
-
Jiri Denemark -
Peter Krempa