]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
fix quoting
authorDaniel Colascione <dancol@dancol.org>
Sun, 4 Mar 2018 21:28:23 +0000 (13:28 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 20 Mar 2018 03:19:46 +0000 (20:19 -0700)
NEWS
lib/autoconf/general.m4
lib/autoconf/status.m4

diff --git a/NEWS b/NEWS
index 7c165351ac7bb62d0759c2ccb2a86c5a904ab31e..efade5852e68b026f8e4bc38021f70a6eb93b44a 100644 (file)
--- 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'
index 8a64b1de90bb45f0fdcc2eae57f5859394716bcb..5fde689b01315328f2caad39d3e662ad0e32611b 100644 (file)
@@ -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
index 30a8a60c4a58dd5f4d668eda388c091abcfd3fe2..c7d0ad0e4eb425297f62f69ac0e07e8eb62212cf 100644 (file)
@@ -1431,8 +1431,12 @@ m4_if(m4_index(m4_defn([AC_PACKAGE_NAME]), [GNU ]), [0], [
 General help using GNU software: <https://www.gnu.org/gethelp/>.])])"
 
 _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])