qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Daniel P . Berrangé" <berrange@redhat.com>
Subject: Re: [PULL 1/1] trace: update qemu-trace-stap to Python 3
Date: Tue, 14 Jan 2020 14:00:46 +0100	[thread overview]
Message-ID: <1f902433-199a-178b-3968-86f23f67b2d9@redhat.com> (raw)
In-Reply-To: <20200114092918.117399-2-stefanha@redhat.com>

On 1/14/20 10:29 AM, 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>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Message-id: 20200107112438.383958-1-stefanha@redhat.com
> Message-Id: <20200107112438.383958-1-stefanha@redhat.com>

One Message-Id is enough ;)

> 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))
> 



  reply	other threads:[~2020-01-14 13:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14  9:29 [PULL 0/1] Tracing patches Stefan Hajnoczi
2020-01-14  9:29 ` [PULL 1/1] trace: update qemu-trace-stap to Python 3 Stefan Hajnoczi
2020-01-14 13:00   ` Philippe Mathieu-Daudé [this message]
2020-01-14 14:11 ` [PULL 0/1] Tracing patches Peter Maydell

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=1f902433-199a-178b-3968-86f23f67b2d9@redhat.com \
    --to=philmd@redhat.com \
    --cc=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).