[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCHv2] Another empty argument through expr workaround.
From: |
Eric Blake |
Subject: |
[PATCHv2] Another empty argument through expr workaround. |
Date: |
Tue, 20 Jul 2010 08:53:52 -0600 |
* lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Detect empty
arguments. Reject empty file argument.
* tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
Check for missing argument.
Signed-off-by: Eric Blake <address@hidden>
---
This time, I tested that 'make -C tests maintainer-check' failed
the new torture.at tests without the first hunk of status.m4
in place (it tried to instantiate 0.in, given the expr issue).
ChangeLog | 7 +++++++
lib/autoconf/status.m4 | 8 +++++++-
tests/torture.at | 6 ++++++
3 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bd7c15f..8e0ebe0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2010-07-20 Eric Blake <address@hidden>
+ Another empty argument through expr workaround.
+ * lib/autoconf/status.m4 (_AC_OUTPUT_CONFIG_STATUS): Detect empty
+ arguments. Reject empty file argument.
+ * tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS):
+ Check for missing argument.
+
Also reject ' and newline from AC_INIT strings.
* lib/autoconf/general.m4 (_AC_INIT_LITERAL): Reject a couple more
problematic characters.
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index b9e7026..414af8a 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -1464,11 +1464,16 @@ ac_need_defaults=:
while test $[#] != 0
do
case $[1] in
- --*=*)
+ --*=?*)
ac_option=`expr "X$[1]" : 'X\([[^=]]*\)='`
ac_optarg=`expr "X$[1]" : 'X[[^=]]*=\(.*\)'`
ac_shift=:
;;
+ --*=)
+ ac_option=`expr "X$[1]" : 'X\([[^=]]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
*)
ac_option=$[1]
ac_optarg=$[2]
@@ -1491,6 +1496,7 @@ m4_ifdef([_AC_SEEN_CONFIG(FILES)], [dnl
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`AS_ECHO(["$ac_optarg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') AC_MSG_ERROR([missing file argument])
esac
AS_VAR_APPEND([CONFIG_FILES], [" '$ac_optarg'"])
ac_need_defaults=false;;
diff --git a/tests/torture.at b/tests/torture.at
index e7f61ed..ff05928 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -276,6 +276,12 @@ if test -w /dev/full && test -c /dev/full; then
[1], [ignore], [ignore])
fi
+# Validate that --file requires an argument
+AT_CHECK([./config.status --file], [1], [ignore], [stderr])
+AT_CHECK([grep 'missing file argument' stderr], [0], [ignore])
+AT_CHECK([./config.status --file=], [1], [ignore], [stderr])
+AT_CHECK([grep 'missing file argument' stderr], [0], [ignore])
+
# Create a header
AT_CHECK_CONFIG_CREATION_NOWRITE(header)
# Create a header on stdout
--
1.7.1.1