From f0aa3cc07ab2d8118ba5aa294a67f2422ee83c79 Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Sun, 4 Mar 2018 13:28:23 -0800 Subject: [PATCH] fix quoting --- NEWS | 3 +++ lib/autoconf/general.m4 | 15 ++++++++++++++- lib/autoconf/status.m4 | 6 +++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 7c165351..efade585 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ GNU Autoconf NEWS - User visible changes. * Noteworthy changes in release ?.? (????-??-??) [?] +** config.log properly escapes arguments in the header comment; + config.status --config output is now quoted in a more readable fashion + ** Configure scripts now support a '--runstatedir' option, which defaults to '${localstatedir}/run', and which can be used to place per-process temporary runtime files (such as pid files) into '/run' diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 8a64b1de..5fde689b 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1183,6 +1183,19 @@ fi])dnl m4_define([_AC_INIT_CONFIG_LOG], [m4_divert_text([INIT_PREPARE], [m4_define([AS_MESSAGE_LOG_FD], 5)dnl +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`AS_ECHO(["$ac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;; + esac + AS_VAR_APPEND([ac_configure_args_raw], [" '$ac_arg'"]) +done +ac_safe_unquote="[[a-zA-Z0-9_=\/,-]]" +ac_configure_args_raw=`dnl +AS_ECHO(["${ac_configure_args_raw} "]) |dnl +sed "s/'\($ac_safe_unquote$ac_safe_unquote*\)' /\1 /g; s/ $//"` cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -1191,7 +1204,7 @@ It was created by m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])dnl $as_me[]m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]), which was generated by m4_PACKAGE_STRING. Invocation command line was - $ $[0] $[@] + $ $[0]$ac_configure_args_raw _ACEOF exec AS_MESSAGE_LOG_FD>>config.log diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 30a8a60c..c7d0ad0e 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -1431,8 +1431,12 @@ m4_if(m4_index(m4_defn([AC_PACKAGE_NAME]), [GNU ]), [0], [ General help using GNU software: .])])" _ACEOF +ac_cs_config=`dnl +AS_ECHO(["${ac_configure_args} "]) |dnl +sed --posix "s/'\($ac_safe_unquote$ac_safe_unquote*\)' /\1 /g; s/ $//"` +ac_cs_config_escaped=`AS_ECHO(["$ac_cs_config"]) | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`AS_ECHO(["$ac_configure_args"]) | sed 's/^ //; s/[[\\""\`\$]]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.status[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -- 2.11.4.GIT