On 11/04/2016 05:51 AM, Kevin Brubeck Unhammer wrote:
> Tested with GNU Autoconf 2.69.
> 
> To reproduce, open any autoconf-using project and run:
> 
> $ ./configure FLAGS='foo bar' >/dev/null && grep -m1 /configure config.log
>   $ ./configure FLAGS=foo bar
> 
> Expected output:
>   $ ./configure "FLAGS='foo bar'"

Thanks for the report.  The same problem also exists when config.status
reports its invocation line.

> 
> 
> I know the shell interprets the quotes etc., but it's possible to work
> around that; e.g.
> 
> C=''
> for i in "$@"; do
>     i=$(echo "$i" | sed 's/\\/\\\\/g; s/\"/\\\"/g')
>     C="$C \"$i\""
> done
> echo "$C"

That works (although we'd want to tweak it to not pollute outside the
autoconf namespace), but adds a number of forks to what is otherwise a
fork-free output of "$@".  It's probably possible to optimize for the
common case of arguments that don't need shell quoting to reduce some of
the cost.  Since both lib/autoconf/general.m4 and lib/autoconf/status.m4
output an invocation line, it's probably worth factoring out a common
helper macro, probably to lib/m4sugar/m4sh.m4; would you like to try
your hand at a patch? If not, I can probably do it.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to