From 82f7cdadbbde10fa0b4ff11ce0311857258a08de Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Tue, 20 Jul 2010 08:06:16 -0600 Subject: [PATCH] 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. Signed-off-by: Eric Blake --- ChangeLog | 6 ++++++ lib/autoconf/status.m4 | 8 +++++++- tests/torture.at | 6 ++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bd7c15f8..1a620898 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-07-20 Eric Blake + 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 b9e70264..56190a42 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 e7f61ed1..ff059284 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