[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] autoconf: Properly quote logged command line
From: |
Eric Blake |
Subject: |
[PATCH 2/2] autoconf: Properly quote logged command line |
Date: |
Thu, 22 Dec 2016 11:17:02 -0600 |
We were previously logging the wrong command line if the user
invoked any argument with spaces, making it difficult to
re-invoke configure with the same complex arguments. To reproduce,
open any autoconf-using project and run:
$ ./configure FLAGS='foo bar' >/dev/null && grep -m1 /configure config.log
$ ./configure FLAGS=foo bar
Now we get the expected output:
$ ./configure 'FLAGS=foo bar'
(Okay, it would be prettier as FLAGS='foo bar' in the output, by
delaying the opening ' until after the first non-alphanumeric or =,
but that is more expensive to produce, and makes no difference to
shell parsing of the pasted line.)
* lib/autoconf/general.m4 (_AC_INIT_CONFIG_LOG): Use _AS_INVOCATION.
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Likewise.
Reported by Kevin Brubeck Unhammer <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
---
I wonder if it would also be worth updating these two logging points
to include the output of 'date' as a (rough) timestamp of when the
recorded invocation started.
lib/autoconf/general.m4 | 3 ++-
lib/autoconf/status.m4 | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index ef6285d..bac9fcd 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1183,6 +1183,7 @@ fi])dnl
m4_define([_AC_INIT_CONFIG_LOG],
[m4_divert_text([INIT_PREPARE],
[m4_define([AS_MESSAGE_LOG_FD], 5)dnl
+_AS_INVOCATION
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 +1192,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] address@hidden
+ $as_invocation
_ACEOF
exec AS_MESSAGE_LOG_FD>>config.log
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 308d3d8..f692b6d 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -1334,6 +1334,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
[#] Save the log message, to keep $[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
+_AS_INVOCATION
ac_log="
This file was extended by m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])dnl
$as_me[]m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]), which was
@@ -1343,7 +1344,7 @@ generated by m4_PACKAGE_STRING. Invocation command line
was
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $[0] address@hidden
+ $as_invocation
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
--
2.9.3