* [PATCH] trace: update qemu-trace-stap to Python 3
@ 2020-01-07 11:24 Stefan Hajnoczi
2020-01-07 11:50 ` Daniel P. Berrangé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2020-01-07 11:24 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel Berrange, Dr. David Alan Gilbert, Stefan Hajnoczi
qemu-trace-stap does not support Python 3 yet:
$ scripts/qemu-trace-stap list path/to/qemu-system-x86_64
Traceback (most recent call last):
File "scripts/qemu-trace-stap", line 175, in <module>
main()
File "scripts/qemu-trace-stap", line 171, in main
args.func(args)
File "scripts/qemu-trace-stap", line 118, in cmd_list
print_probes(args.verbose, "*")
File "scripts/qemu-trace-stap", line 114, in print_probes
if line.startswith(prefix):
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
Now that QEMU requires Python 3.5 or later we can switch to pure Python
3. Use Popen()'s universal_newlines=True argument to treat stdout as
text instead of binary.
Fixes: 62dd1048c0bd ("trace: add ability to do simple printf logging via systemtap")
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1787395
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
scripts/qemu-trace-stap | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/qemu-trace-stap b/scripts/qemu-trace-stap
index 91d1051cdc..90527eb974 100755
--- a/scripts/qemu-trace-stap
+++ b/scripts/qemu-trace-stap
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
# -*- python -*-
#
# Copyright (C) 2019 Red Hat, Inc
@@ -18,8 +18,6 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-from __future__ import print_function
-
import argparse
import copy
import os.path
@@ -104,7 +102,9 @@ def cmd_list(args):
if verbose:
print("Listing probes with name '%s'" % script)
proc = subprocess.Popen(["stap", "-l", script],
- stdout=subprocess.PIPE, env=tapset_env(tapsets))
+ stdout=subprocess.PIPE,
+ universal_newlines=True,
+ env=tapset_env(tapsets))
out, err = proc.communicate()
if proc.returncode != 0:
print("No probes found, are the tapsets installed in %s" % tapset_dir(args.binary))
--
2.24.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] trace: update qemu-trace-stap to Python 3
2020-01-07 11:24 [PATCH] trace: update qemu-trace-stap to Python 3 Stefan Hajnoczi
@ 2020-01-07 11:50 ` Daniel P. Berrangé
2020-01-07 12:19 ` no-reply
2020-01-07 17:01 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2020-01-07 11:50 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-devel, Dr. David Alan Gilbert
On Tue, Jan 07, 2020 at 11:24:38AM +0000, Stefan Hajnoczi wrote:
> qemu-trace-stap does not support Python 3 yet:
>
> $ scripts/qemu-trace-stap list path/to/qemu-system-x86_64
> Traceback (most recent call last):
> File "scripts/qemu-trace-stap", line 175, in <module>
> main()
> File "scripts/qemu-trace-stap", line 171, in main
> args.func(args)
> File "scripts/qemu-trace-stap", line 118, in cmd_list
> print_probes(args.verbose, "*")
> File "scripts/qemu-trace-stap", line 114, in print_probes
> if line.startswith(prefix):
> TypeError: startswith first arg must be bytes or a tuple of bytes, not str
>
> Now that QEMU requires Python 3.5 or later we can switch to pure Python
> 3. Use Popen()'s universal_newlines=True argument to treat stdout as
> text instead of binary.
>
> Fixes: 62dd1048c0bd ("trace: add ability to do simple printf logging via systemtap")
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1787395
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> scripts/qemu-trace-stap | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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] trace: update qemu-trace-stap to Python 3
2020-01-07 11:24 [PATCH] trace: update qemu-trace-stap to Python 3 Stefan Hajnoczi
2020-01-07 11:50 ` Daniel P. Berrangé
@ 2020-01-07 12:19 ` no-reply
2020-01-07 17:01 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: no-reply @ 2020-01-07 12:19 UTC (permalink / raw)
To: stefanha; +Cc: berrange, qemu-devel, stefanha, dgilbert
Patchew URL: https://patchew.org/QEMU/20200107112438.383958-1-stefanha@redhat.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
N/A. Internal error while reading log file
The full log is available at
http://patchew.org/logs/20200107112438.383958-1-stefanha@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] trace: update qemu-trace-stap to Python 3
2020-01-07 11:24 [PATCH] trace: update qemu-trace-stap to Python 3 Stefan Hajnoczi
2020-01-07 11:50 ` Daniel P. Berrangé
2020-01-07 12:19 ` no-reply
@ 2020-01-07 17:01 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2020-01-07 17:01 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel Berrange, Dr. David Alan Gilbert
[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]
On Tue, Jan 07, 2020 at 11:24:38AM +0000, Stefan Hajnoczi wrote:
> qemu-trace-stap does not support Python 3 yet:
>
> $ scripts/qemu-trace-stap list path/to/qemu-system-x86_64
> Traceback (most recent call last):
> File "scripts/qemu-trace-stap", line 175, in <module>
> main()
> File "scripts/qemu-trace-stap", line 171, in main
> args.func(args)
> File "scripts/qemu-trace-stap", line 118, in cmd_list
> print_probes(args.verbose, "*")
> File "scripts/qemu-trace-stap", line 114, in print_probes
> if line.startswith(prefix):
> TypeError: startswith first arg must be bytes or a tuple of bytes, not str
>
> Now that QEMU requires Python 3.5 or later we can switch to pure Python
> 3. Use Popen()'s universal_newlines=True argument to treat stdout as
> text instead of binary.
>
> Fixes: 62dd1048c0bd ("trace: add ability to do simple printf logging via systemtap")
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1787395
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> scripts/qemu-trace-stap | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Thanks, applied to my tracing tree:
https://github.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:[~2020-01-07 17:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 11:24 [PATCH] trace: update qemu-trace-stap to Python 3 Stefan Hajnoczi
2020-01-07 11:50 ` Daniel P. Berrangé
2020-01-07 12:19 ` no-reply
2020-01-07 17:01 ` Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.