From 74a413ff814a070dc9a5ca577ddd42099fad2605 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sat, 5 Sep 2020 18:12:48 -0700 Subject: automake: be robust against directories containing (). This change fixes https://bugs.gnu.org/14196. * m4/missing.m4 (AM_MISSING_HAS_RUN): always quote the invocation (not just if $am_aux_dir contains space or tab), in case $am_aux_dir contains () or other metachars not rejected by AM_SANITY_CHECK; quoting with '...' suggested by Jim Meyering. * t/man6.sh (HELP2MAN): adjust grep since missing value is quoted now. * t/am-missing-prog.sh: likewise. --- m4/missing.m4 | 7 +------ t/am-missing-prog.sh | 6 +++--- t/man6.sh | 10 ++++++---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/m4/missing.m4 b/m4/missing.m4 index 6f742fb20..14448bf18 100644 --- a/m4/missing.m4 +++ b/m4/missing.m4 @@ -21,12 +21,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then diff --git a/t/am-missing-prog.sh b/t/am-missing-prog.sh index df26b04fd..1a5cb7fa5 100644 --- a/t/am-missing-prog.sh +++ b/t/am-missing-prog.sh @@ -86,9 +86,9 @@ $AUTOMAKE $FGREP COMMAND Makefile.in Makefile # For debugging. -grep "^NO_SUCH_COMMAND = \${SHELL} .*/missing .*am-none-none" Makefile -grep "^MISMATCHED_COMMAND = \${SHELL} .*/missing .*am-exit-63" Makefile -grep "^COMMAND_FOUND = \${SHELL} .*/missing .*my-command" Makefile +grep "^NO_SUCH_COMMAND = \${SHELL} .*/missing.* .*am-none-none" Makefile +grep "^MISMATCHED_COMMAND = \${SHELL} .*/missing.* .*am-exit-63" Makefile +grep "^COMMAND_FOUND = \${SHELL} .*/missing.* .*my-command" Makefile grep '^OVERRIDDEN_COMMAND = am-overridden *$' Makefile $MAKE test1 test2 test3 test4 diff --git a/t/man6.sh b/t/man6.sh index c62c7d114..b354ec9ad 100644 --- a/t/man6.sh +++ b/t/man6.sh @@ -64,8 +64,10 @@ mkdir build cd build ../configure -# Sanity check. -grep '^HELP2MAN *=.*/missing help2man' Makefile +# Sanity check. The line we're matching looks like this: +# HELP2MAN = ${SHELL} '/am/checkout/t/man6.dir/missing' help2man +# so let's not try to match the exact intervening quote. +grep '^HELP2MAN *=.*/missing.* help2man' Makefile $MAKE $FGREP foobar ../foobar.1 @@ -83,8 +85,8 @@ cd .. rm -f *.1 # Remove leftover generated manpages. ./configure -# Sanity check. -grep '^HELP2MAN *=.*/missing help2man' Makefile +# Sanity check again, same as above. +grep '^HELP2MAN *=.*/missing.* help2man' Makefile $MAKE $FGREP foobar foobar.1 -- cgit v1.2.1