* [PATCH] scripts: improve error from qemu-trace-stap on missing 'stap'
@ 2024-12-06 11:45 Daniel P. Berrangé
2024-12-06 14:40 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2024-12-06 11:45 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Hajnoczi, Mads Ynddal, Daniel P. Berrangé
If the 'stap' binary is missing in $PATH, a huge trace is thrown
$ qemu-trace-stap list /usr/bin/qemu-system-x86_64
Traceback (most recent call last):
File "/usr/bin/qemu-trace-stap", line 169, in <module>
main()
File "/usr/bin/qemu-trace-stap", line 165, in main
args.func(args)
File "/usr/bin/qemu-trace-stap", line 83, in cmd_run
subprocess.call(stapargs)
File "/usr/lib64/python3.12/subprocess.py", line 389, in call
with Popen(*popenargs, **kwargs) as p:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/subprocess.py", line 1026, in {}init{}
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib64/python3.12/subprocess.py", line 1955, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'stap'
With this change the user now gets
$ qemu-trace-stap list /usr/bin/qemu-system-x86_64
Unable to find 'stap' in $PATH
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
scripts/qemu-trace-stap | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/qemu-trace-stap b/scripts/qemu-trace-stap
index eb6e951ff2..e983460ee7 100755
--- a/scripts/qemu-trace-stap
+++ b/scripts/qemu-trace-stap
@@ -56,6 +56,7 @@ def tapset_dir(binary):
def cmd_run(args):
+ stap = which("stap")
prefix = probe_prefix(args.binary)
tapsets = tapset_dir(args.binary)
@@ -76,7 +77,7 @@ def cmd_run(args):
# We request an 8MB buffer, since the stap default 1MB buffer
# can be easily overflowed by frequently firing QEMU traces
- stapargs = ["stap", "-s", "8", "-I", tapsets ]
+ stapargs = [stap, "-s", "8", "-I", tapsets ]
if args.pid is not None:
stapargs.extend(["-x", args.pid])
stapargs.extend(["-e", script])
@@ -84,6 +85,7 @@ def cmd_run(args):
def cmd_list(args):
+ stap = which("stap")
tapsets = tapset_dir(args.binary)
if args.verbose:
@@ -96,7 +98,7 @@ def cmd_list(args):
if verbose:
print("Listing probes with name '%s'" % script)
- proc = subprocess.Popen(["stap", "-I", tapsets, "-l", script],
+ proc = subprocess.Popen([stap, "-I", tapsets, "-l", script],
stdout=subprocess.PIPE,
universal_newlines=True)
out, err = proc.communicate()
--
2.46.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] scripts: improve error from qemu-trace-stap on missing 'stap'
2024-12-06 11:45 [PATCH] scripts: improve error from qemu-trace-stap on missing 'stap' Daniel P. Berrangé
@ 2024-12-06 14:40 ` Philippe Mathieu-Daudé
2025-02-12 9:30 ` Daniel P. Berrangé
2025-02-12 15:06 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-12-06 14:40 UTC (permalink / raw)
To: Daniel P. Berrangé, qemu-devel; +Cc: Stefan Hajnoczi, Mads Ynddal
On 6/12/24 12:45, Daniel P. Berrangé wrote:
> If the 'stap' binary is missing in $PATH, a huge trace is thrown
>
> $ qemu-trace-stap list /usr/bin/qemu-system-x86_64
> Traceback (most recent call last):
> File "/usr/bin/qemu-trace-stap", line 169, in <module>
> main()
> File "/usr/bin/qemu-trace-stap", line 165, in main
> args.func(args)
> File "/usr/bin/qemu-trace-stap", line 83, in cmd_run
> subprocess.call(stapargs)
> File "/usr/lib64/python3.12/subprocess.py", line 389, in call
> with Popen(*popenargs, **kwargs) as p:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/usr/lib64/python3.12/subprocess.py", line 1026, in {}init{}
> self._execute_child(args, executable, preexec_fn, close_fds,
> File "/usr/lib64/python3.12/subprocess.py", line 1955, in _execute_child
> raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory: 'stap'
>
> With this change the user now gets
>
> $ qemu-trace-stap list /usr/bin/qemu-system-x86_64
> Unable to find 'stap' in $PATH
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> scripts/qemu-trace-stap | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] scripts: improve error from qemu-trace-stap on missing 'stap'
2024-12-06 11:45 [PATCH] scripts: improve error from qemu-trace-stap on missing 'stap' Daniel P. Berrangé
2024-12-06 14:40 ` Philippe Mathieu-Daudé
@ 2025-02-12 9:30 ` Daniel P. Berrangé
2025-02-12 15:06 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2025-02-12 9:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Hajnoczi, Mads Ynddal
Hi Stefan,
Are you ok with queuing this patch ?
On Fri, Dec 06, 2024 at 11:45:24AM +0000, Daniel P. Berrangé wrote:
> If the 'stap' binary is missing in $PATH, a huge trace is thrown
>
> $ qemu-trace-stap list /usr/bin/qemu-system-x86_64
> Traceback (most recent call last):
> File "/usr/bin/qemu-trace-stap", line 169, in <module>
> main()
> File "/usr/bin/qemu-trace-stap", line 165, in main
> args.func(args)
> File "/usr/bin/qemu-trace-stap", line 83, in cmd_run
> subprocess.call(stapargs)
> File "/usr/lib64/python3.12/subprocess.py", line 389, in call
> with Popen(*popenargs, **kwargs) as p:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/usr/lib64/python3.12/subprocess.py", line 1026, in {}init{}
> self._execute_child(args, executable, preexec_fn, close_fds,
> File "/usr/lib64/python3.12/subprocess.py", line 1955, in _execute_child
> raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory: 'stap'
>
> With this change the user now gets
>
> $ qemu-trace-stap list /usr/bin/qemu-system-x86_64
> Unable to find 'stap' in $PATH
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> scripts/qemu-trace-stap | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/qemu-trace-stap b/scripts/qemu-trace-stap
> index eb6e951ff2..e983460ee7 100755
> --- a/scripts/qemu-trace-stap
> +++ b/scripts/qemu-trace-stap
> @@ -56,6 +56,7 @@ def tapset_dir(binary):
>
>
> def cmd_run(args):
> + stap = which("stap")
> prefix = probe_prefix(args.binary)
> tapsets = tapset_dir(args.binary)
>
> @@ -76,7 +77,7 @@ def cmd_run(args):
>
> # We request an 8MB buffer, since the stap default 1MB buffer
> # can be easily overflowed by frequently firing QEMU traces
> - stapargs = ["stap", "-s", "8", "-I", tapsets ]
> + stapargs = [stap, "-s", "8", "-I", tapsets ]
> if args.pid is not None:
> stapargs.extend(["-x", args.pid])
> stapargs.extend(["-e", script])
> @@ -84,6 +85,7 @@ def cmd_run(args):
>
>
> def cmd_list(args):
> + stap = which("stap")
> tapsets = tapset_dir(args.binary)
>
> if args.verbose:
> @@ -96,7 +98,7 @@ def cmd_list(args):
>
> if verbose:
> print("Listing probes with name '%s'" % script)
> - proc = subprocess.Popen(["stap", "-I", tapsets, "-l", script],
> + proc = subprocess.Popen([stap, "-I", tapsets, "-l", script],
> stdout=subprocess.PIPE,
> universal_newlines=True)
> out, err = proc.communicate()
> --
> 2.46.0
>
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] scripts: improve error from qemu-trace-stap on missing 'stap'
2024-12-06 11:45 [PATCH] scripts: improve error from qemu-trace-stap on missing 'stap' Daniel P. Berrangé
2024-12-06 14:40 ` Philippe Mathieu-Daudé
2025-02-12 9:30 ` Daniel P. Berrangé
@ 2025-02-12 15:06 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2025-02-12 15:06 UTC (permalink / raw)
To: Daniel P. Berrangé; +Cc: qemu-devel, Mads Ynddal
[-- Attachment #1: Type: text/plain, Size: 1367 bytes --]
On Fri, Dec 06, 2024 at 11:45:24AM +0000, Daniel P. Berrangé wrote:
> If the 'stap' binary is missing in $PATH, a huge trace is thrown
>
> $ qemu-trace-stap list /usr/bin/qemu-system-x86_64
> Traceback (most recent call last):
> File "/usr/bin/qemu-trace-stap", line 169, in <module>
> main()
> File "/usr/bin/qemu-trace-stap", line 165, in main
> args.func(args)
> File "/usr/bin/qemu-trace-stap", line 83, in cmd_run
> subprocess.call(stapargs)
> File "/usr/lib64/python3.12/subprocess.py", line 389, in call
> with Popen(*popenargs, **kwargs) as p:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/usr/lib64/python3.12/subprocess.py", line 1026, in {}init{}
> self._execute_child(args, executable, preexec_fn, close_fds,
> File "/usr/lib64/python3.12/subprocess.py", line 1955, in _execute_child
> raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory: 'stap'
>
> With this change the user now gets
>
> $ qemu-trace-stap list /usr/bin/qemu-system-x86_64
> Unable to find 'stap' in $PATH
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> scripts/qemu-trace-stap | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Thanks, applied to my tracing tree:
https://gitlab.com/stefanha/qemu/commits/tracing
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-12 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 11:45 [PATCH] scripts: improve error from qemu-trace-stap on missing 'stap' Daniel P. Berrangé
2024-12-06 14:40 ` Philippe Mathieu-Daudé
2025-02-12 9:30 ` Daniel P. Berrangé
2025-02-12 15:06 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).