From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VST3X-0004aO-1F for qemu-devel@nongnu.org; Sat, 05 Oct 2013 10:42:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VST3R-00083T-FL for qemu-devel@nongnu.org; Sat, 05 Oct 2013 10:42:06 -0400 Received: from wanbli.kerneis.info ([2001:41d0:8:38ad::1]:40514) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VST3R-00082t-68 for qemu-devel@nongnu.org; Sat, 05 Oct 2013 10:42:01 -0400 From: Gabriel Kerneis Date: Sat, 5 Oct 2013 15:41:32 +0100 Message-Id: <1380984092-18502-1-git-send-email-gabriel@kerneis.info> Subject: [Qemu-devel] [PATCH] config-host.mak: escape configure arguments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, Gabriel Kerneis Escape single quotes and newlines when writing configure arguments to config-host.mak. This is necessary to allow correct regeneration by re-executing configure in a shell when config-host.mak becomes out-of-date. Signed-off-by: Gabriel Kerneis --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 23dbaaf..fba7c1f 100755 --- a/configure +++ b/configure @@ -3769,7 +3769,11 @@ echo "# Automatically generated by configure - do not modify" >config-all-disas. echo "# Automatically generated by configure - do not modify" > $config_host_mak printf "# Configured with:" >> $config_host_mak -printf " '%s'" "$0" "$@" >> $config_host_mak +for arg in "$0" "$@"; do + # join each arg on a single line, escaping newlines and single quotes + quoted_arg=$(echo "$arg" | sed ":a;N;s/\n/\\\\n/;ba" | sed "s/'/'\\\\''/g") + printf " '%s'" "$quoted_arg" +done >> $config_host_mak echo >> $config_host_mak echo all: >> $config_host_mak -- 1.8.4.rc3