qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Quote extra_cflags in config-host.mak


From: Gabriel Kerneis
Subject: Re: [Qemu-devel] [PATCH] Quote extra_cflags in config-host.mak
Date: Wed, 11 Sep 2013 16:01:37 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Sep 11, 2013 at 04:53:35PM +0200, Paolo Bonzini wrote:
> Oh, then it's this line in configure that has to be changed to do proper
> quoting.
> 
> printf "# Configured with:" >> $config_host_mak
> printf " '%s'" "$0" "$@" >> $config_host_mak

No, this line has absolutely nothing to do with it. It's purely a
comment that is not executed later. The line that has to be fixed is
really the line starting with "extra_cflags=" in config-host.mak (well,
at least in my experience - my patch does not touch the first line, at
it still solves the issue).

> Something like
> 
> for arg in "$0" "$@"; do
>    quoted_arg=$(echo "$i" | sed 's/[$\\"]/\\&/g')
>    printf ' "%s"' "$quoted_arg"
> done >> $config_host_mak

But we could indeed apply that escaping mechanism to extra_cflags (or
maybe to every variable that is printed to config-host.mk). That's what
I meant when I refered to the following bashism:

printf "extra_cflags=%q\n" "$extra_cflags"

Unfortunately, %q is not portable and we probably need something along
the lines of your proposal above (note that it doesn't handle "("
though, which is precisely the one causing an issue in my example).

-- 
Gabriel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]