]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
lib: use list of unsafe chars, not safe ones
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 20 Mar 2018 03:19:01 +0000 (20:19 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 20 Mar 2018 03:19:46 +0000 (20:19 -0700)
* lib/autoconf/general.m4 (_AC_INIT_CONFIG_LOG):
Rely on list of unsafe chars instead of list of safe ones.
This corresponds more closely to POSIX and should result
in less quoting.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS):
Adjust to this change.
x

lib/autoconf/general.m4
lib/autoconf/status.m4

index 5fde689b01315328f2caad39d3e662ad0e32611b..58f7a64c41cf7c73e0f56b4ef30cf859d2aec799 100644 (file)
@@ -1192,10 +1192,18 @@ do
   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/ $//"`
+
+case $ac_configure_args_raw in
+  *$as_nl*)
+    ac_safe_unquote= ;;
+  *)
+    ac_unsafe_z='|&;<>()$`\\"*?@<:@ '' ' # This string ends in space, tab.
+    ac_unsafe_a="$ac_unsafe_z#~"
+    ac_safe_unquote="s/ '\\([[^$ac_unsafe_a]][[^$ac_unsafe_z]]*\\)'/ \\1/g"
+    ac_configure_args_raw=`dnl
+      AS_ECHO(["$ac_configure_args_raw"]) | sed "$ac_safe_unquote"`;;
+esac
+
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
index c7d0ad0e4eb425297f62f69ac0e07e8eb62212cf..69465bd0e2d44166a9573d94f47e2a79340ae7ed 100644 (file)
@@ -1431,9 +1431,7 @@ 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=`AS_ECHO(["$ac_configure_args"]) | sed "$ac_safe_unquote"`
 ac_cs_config_escaped=`AS_ECHO(["$ac_cs_config"]) | sed "s/^ //; s/'/'\\\\\\\\''/g"`
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'