From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJlvN-0007UR-7D for qemu-devel@nongnu.org; Wed, 11 Sep 2013 11:01:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJlvH-0004jx-M3 for qemu-devel@nongnu.org; Wed, 11 Sep 2013 11:01:45 -0400 Date: Wed, 11 Sep 2013 16:01:37 +0100 From: Gabriel Kerneis Message-ID: <20130911150137.GC15227@kerneis.info> References: <1378906912-14015-1-git-send-email-gabriel@kerneis.info> <523077CE.6070303@redhat.com> <20130911144230.GA15227@kerneis.info> <523083EF.7050203@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <523083EF.7050203@redhat.com> Subject: Re: [Qemu-devel] [PATCH] Quote extra_cflags in config-host.mak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-trivial@nongnu.org, Peter Maydell , qemu-devel@nongnu.org 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