All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: marcandre.lureau@redhat.com, berrange@redhat.com,
	peter.maydell@linaro.org
Subject: Re: [PATCH 1/3] configure: quote command line arguments in config.status
Date: Mon, 14 Sep 2020 14:17:10 -0500	[thread overview]
Message-ID: <2be1eaef-a823-5b0e-47a6-783c7e1aacb0@redhat.com> (raw)
In-Reply-To: <20200913100534.22084-2-pbonzini@redhat.com>

On 9/13/20 5:05 AM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   configure | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 53723ace57..beae010e39 100755
> --- a/configure
> +++ b/configure
> @@ -89,6 +89,10 @@ printf " '%s'" "$0" "$@" >> config.log
>   echo >> config.log
>   echo "#" >> config.log
>   
> +quote_sh() {
> +    printf "'%s'" "$(echo "$1" | sed "s,','\\',")"

This is unsafe if $1 starts with - or contains \.  Better is using 
printf.  It also eats any trailing newlines in $1, although that may be 
less of a concern.

> +}
> +
>   print_error() {
>       (echo
>       echo "ERROR: $1"
> @@ -8061,7 +8065,7 @@ preserve_env WINDRES
>   
>   printf "exec" >>config.status
>   for i in "$0" "$@"; do
> -  test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status
> +  test "$i" = --skip-meson || printf " %s" "$(quote_sh $i)" >>config.status

And this unquoted use of $i is wrong.

>   done
>   echo ' "$@"' >>config.status
>   chmod +x config.status
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2020-09-14 19:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 10:05 [RFC PATCH 0/3] Automatically convert configure options to meson build options Paolo Bonzini
2020-09-13 10:05 ` [PATCH 1/3] configure: quote command line arguments in config.status Paolo Bonzini
2020-09-14 19:17   ` Eric Blake [this message]
2020-09-13 10:05 ` [PATCH 2/3] configure: early test for Python Paolo Bonzini
2020-09-13 10:05 ` [PATCH 3/3] configure: automatically parse command line for meson -D options Paolo Bonzini
2020-09-14 19:20   ` Eric Blake
2020-09-13 10:15 ` [RFC PATCH 0/3] Automatically convert configure options to meson build options 罗勇刚(Yonggang Luo)
2020-09-13 13:57   ` Paolo Bonzini
2020-09-14  9:12 ` Daniel P. Berrangé
2020-09-14 10:49   ` Paolo Bonzini
2020-09-14  9:57 ` Stefan Hajnoczi
2020-09-14 10:00   ` 罗勇刚(Yonggang Luo)
2020-09-16 11:24     ` Stefan Hajnoczi
2020-09-14 10:27   ` Paolo Bonzini
2020-09-16 11:25     ` Stefan Hajnoczi
2020-09-16 13:15       ` Paolo Bonzini

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=2be1eaef-a823-5b0e-47a6-783c7e1aacb0@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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.