[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: config.log claims invocation is FLAGS=foo bar when really FLAGS='foo
From: |
Eric Blake |
Subject: |
Re: config.log claims invocation is FLAGS=foo bar when really FLAGS='foo bar' |
Date: |
Fri, 4 Nov 2016 08:53:46 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
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
signature.asc
Description: OpenPGP digital signature