All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: "Alex Bennée" <alex.bennee@linaro.org>, qemu-devel@nongnu.org
Cc: "Cornelia Huck" <cohuck@redhat.com>,
	"Thomas Huth" <th.huth+qemu@posteo.eu>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Peter Xu" <peterx@redhat.com>, "Warner Losh" <imp@bsdimp.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Kyle Evans" <kevans@freebsd.org>,
	"Keith Busch" <kbusch@kernel.org>,
	"Matthew Rosato" <mjrosato@linux.ibm.com>,
	"Eric Farman" <farman@linux.ibm.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Anders Roxell" <anders.roxell@linaro.org>,
	qemu-arm@nongnu.org, "Song Gao" <gaosong@loongson.cn>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	qemu-s390x@nongnu.org,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Brad Smith" <brad@comstyle.com>,
	"Brian Cain" <brian.cain@oss.qualcomm.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Yoshinori Sato" <yoshinori.sato@nifty.com>,
	"Klaus Jensen" <its@irrelevant.dk>,
	"John Snow" <jsnow@redhat.com>
Subject: Re: [PATCH v3 08/19] tests/guest-debug: convert gdb_cmd to an array
Date: Tue, 20 Oct 2026 13:21:23 +0200	[thread overview]
Message-ID: <91dcf5d8-f319-49d5-820b-fd6c4da8d08e@linux.ibm.com> (raw)
In-Reply-To: <20261019192704.3220373-9-alex.bennee@linaro.org>



On 10/19/26 21:26, Alex Bennée wrote:
> Passing a plain string to subprocess involves making sure the escaping
> is correct so the underlying shell doesn't get confused. This can be
> tricky to track across multiple  processes. To simplify this build the
> command as an array and execute gdb directly without involving the
> shell.
> 
> We add a mini-helper to make the log output a bit more copy and paste
> friendly.
> 
> Suggested-by: Ilya Leoshkevich <iii@linux.ibm.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   tests/guest-debug/run-test.py | 26 +++++++++++++++-----------
>   1 file changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py
> index 838c1c26971..e8b69f85cd1 100755
> --- a/tests/guest-debug/run-test.py
> +++ b/tests/guest-debug/run-test.py
> @@ -51,6 +51,10 @@ def log(output, msg):
>           print(msg)
>   
>   
> +def format_cmd(cmd):
> +    return " ".join(f'"{arg}"' if ' ' in arg else arg for arg in cmd)

I would use shlex.quote() here.
It doesn't do anything to strings that don't require quoting:

 >>> print(shlex.quote('aaa'))
aaa
 >>> print(shlex.quote('"aaa'))
'"aaa'

With that:

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>

[...]


  parent reply	other threads:[~2026-10-20 11:22 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 19:26 [PATCH v3 00/19] testing/next: functional testing updates for gdb (pre-PR) Alex Bennée
2026-10-19 19:26 ` [PATCH v3 01/19] tests/functional: test_acpi_bits requires TCG Alex Bennée
2026-10-20 22:49   ` Ilya Leoshkevich
2026-10-19 19:26 ` [PATCH v3 02/19] tests/tcg: fix buffer overflow in multiarch/linux/linux-sigrtminmax Alex Bennée
2026-10-19 19:26 ` [PATCH v3 03/19] .dir-locals: include QEMU code in PYTHONPATH Alex Bennée
2026-10-24 13:19   ` marcandre.lureau
2026-10-19 19:26 ` [PATCH v3 04/19] meson: move gdb detection into the top level build file Alex Bennée
2026-10-19 19:26 ` [PATCH v3 05/19] tests/functional: allow tuxrun tests to be passed "accel" Alex Bennée
2026-10-19 19:26 ` [PATCH v3 06/19] tests/functional: split x86_64 tuxrun into tcg and kvm run Alex Bennée
2026-10-19 19:26 ` [PATCH v3 07/19] tests/functional: update x86_64 tuxrun images Alex Bennée
2026-10-19 19:26 ` [PATCH v3 08/19] tests/guest-debug: convert gdb_cmd to an array Alex Bennée
2026-10-20  7:40   ` Thomas Huth
2026-10-20 11:21   ` Ilya Leoshkevich [this message]
2026-10-24 13:19   ` marcandre.lureau
2026-10-19 19:26 ` [PATCH v3 09/19] tests/guest-debug: convert cmd to an qemu_cmd array Alex Bennée
2026-10-20  7:43   ` Thomas Huth
2026-10-20 11:22   ` Ilya Leoshkevich
2026-10-24 13:19   ` marcandre.lureau
2026-10-19 19:26 ` [PATCH v3 10/19] tests/guest-debug: add --kargs option to run-test Alex Bennée
2026-10-20 11:23   ` Ilya Leoshkevich
2026-10-24 13:19   ` marcandre.lureau
2026-10-19 19:26 ` [PATCH v3 11/19] tests/guest-debug: add --symbols " Alex Bennée
2026-10-20 11:23   ` Ilya Leoshkevich
2026-10-24 13:19   ` marcandre.lureau
2026-10-19 19:26 ` [PATCH v3 12/19] tests/functional: teach tuxrun about launching gdb tests Alex Bennée
2026-10-20 22:53   ` Ilya Leoshkevich
2026-10-21 20:17   ` Ilya Leoshkevich
2026-10-21 20:50     ` Alex Bennée
2026-10-26 10:19       ` Ilya Leoshkevich
2026-10-24 13:19   ` marcandre.lureau
2026-10-19 19:26 ` [PATCH v3 13/19] tests/functional: add tuxrun kvm gdb test for x86_64 Alex Bennée
2026-10-19 19:26 ` [PATCH v3 14/19] tests/functional: split aarch64 tuxrun into tcg and kvm run Alex Bennée
2026-10-19 19:27 ` [PATCH v3 15/19] tests/functional: update arm64 tuxrun images Alex Bennée
2026-10-19 19:27 ` [PATCH v3 16/19] tests/functional: add tuxrun kvm gdb test for arm64 Alex Bennée
2026-10-19 19:27 ` [PATCH v3 17/19] tests/functional: split s390x tuxrun into tcg and kvm run Alex Bennée
2026-10-19 19:27 ` [PATCH v3 18/19] tests/functional: update s390x tuxrun images Alex Bennée
2026-10-19 19:27 ` [PATCH v3 19/19] tests/functional: add tuxrun kvm gdb test for s390x Alex Bennée
2026-10-20 22:46   ` Ilya Leoshkevich
2026-10-21  8:01     ` Alex Bennée

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=91dcf5d8-f319-49d5-820b-fd6c4da8d08e@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=alex.bennee@linaro.org \
    --cc=anders.roxell@linaro.org \
    --cc=anisinha@redhat.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=brad@comstyle.com \
    --cc=brian.cain@oss.qualcomm.com \
    --cc=cohuck@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=gaosong@loongson.cn \
    --cc=imp@bsdimp.com \
    --cc=its@irrelevant.dk \
    --cc=jsnow@redhat.com \
    --cc=kbusch@kernel.org \
    --cc=kevans@freebsd.org \
    --cc=laurent@vivier.eu \
    --cc=marcandre.lureau@redhat.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=philmd@oss.qualcomm.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=th.huth+qemu@posteo.eu \
    --cc=yoshinori.sato@nifty.com \
    --cc=zhao1.liu@intel.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 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.