[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
shell quoting fixes
From: |
Paul Eggert |
Subject: |
shell quoting fixes |
Date: |
Thu, 18 May 2006 19:59:07 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
I installed this, which should be self-explanatory:
2006-05-18 Paul Eggert <address@hidden>
* lib/autoconf/functions.m4 (AC_REPLACE_FNMATCH, AC_FUNC_FNMATCH_GNU):
Quote some uses of shell variables if they might suffer unexpected
globbing. This doesn't fix all instances of quoting problems that
I found, just the easy ones that look safe.
* lib/autoconf/general.m4 (_AC_INIT_SRCDIR, _AC_INIT_HELP):
(AC_CONFIG_AUX_DIR, AC_CONFIG_AUX_DIR_DEFAULT, AC_CONFIG_AUX_DIRS):
(AC_CANONICAL_BUILD, AC_CANONICAL_HOST, AC_CANONICAL_TARGET):
(AC_CACHE_LOAD, AC_CACHE_SAVE): Likewise.
* lib/autoconf/libs.m4 (_AC_PATH_X_XMKMF, _AC_PATH_X_DIRECT): Likewise.
* lib/autoconf/specific.m4 (AC_SYS_LONG_FILE_NAMES): Likewise.
* lib/autoconf/status.m4 (_AC_OUTPUT_LINK, _AC_OUTPUT_SUBDIRS):
Likewise.
* lib/autotest/general.m4 (_AC_INIT_PARSE_ARGS): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_DETECT_BETTER_SHELL): Likewise.
Index: lib/autoconf/functions.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/functions.m4,v
retrieving revision 1.99
diff -p -u -r1.99 functions.m4
--- lib/autoconf/functions.m4 24 Apr 2006 06:51:53 -0000 1.99
+++ lib/autoconf/functions.m4 18 May 2006 22:38:13 -0000
@@ -557,7 +557,7 @@ AC_DEFINE(fnmatch, rpl_fnmatch,
AN_FUNCTION([fnmatch], [AC_REPLACE_FNMATCH])
AC_DEFUN([AC_REPLACE_FNMATCH],
[_AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_works],
- [rm -f $ac_config_libobj_dir/fnmatch.h],
+ [rm -f "$ac_config_libobj_dir/fnmatch.h"],
[_AC_LIBOBJ_FNMATCH])
])# AC_REPLACE_FNMATCH
@@ -567,7 +567,7 @@ AC_DEFUN([AC_REPLACE_FNMATCH],
AC_DEFUN([AC_FUNC_FNMATCH_GNU],
[AC_REQUIRE([AC_GNU_SOURCE])
_AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
- [rm -f $ac_config_libobj_dir/fnmatch.h],
+ [rm -f "$ac_config_libobj_dir/fnmatch.h"],
[_AC_LIBOBJ_FNMATCH])
])# AC_FUNC_FNMATCH_GNU
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.916
diff -p -u -r1.916 general.m4
--- lib/autoconf/general.m4 6 May 2006 05:52:28 -0000 1.916
+++ lib/autoconf/general.m4 18 May 2006 22:38:14 -0000
@@ -503,7 +503,7 @@ if test ! -r "$srcdir/$ac_unique_file";
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
- cd $srcdir && test -r "./$ac_unique_file" || AC_MSG_ERROR([$ac_msg])
+ cd "$srcdir" && test -r "./$ac_unique_file" || AC_MSG_ERROR([$ac_msg])
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1058,16 +1058,16 @@ fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d $ac_dir || continue
+ test -d "$ac_dir" || continue
_AC_SRCDIRS(["$ac_dir"])
- cd $ac_dir || { ac_status=$?; continue; }
+ cd "$ac_dir" || { ac_status=$?; continue; }
# Check for guested configure.
- if test -f $ac_srcdir/configure.gnu; then
+ if test -f "$ac_srcdir/configure.gnu"; then
echo &&
- $SHELL $ac_srcdir/configure.gnu --help=recursive
- elif test -f $ac_srcdir/configure; then
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
echo &&
- $SHELL $ac_srcdir/configure --help=recursive
+ $SHELL "$ac_srcdir/configure" --help=recursive
else
AC_MSG_WARN([no configuration information is in $ac_dir])
fi || ac_status=$?
@@ -1564,7 +1564,7 @@ rm -f conftest.sed
# in directory DIR. These are auxiliary files used in configuration.
# DIR can be either absolute or relative to $srcdir.
AC_DEFUN([AC_CONFIG_AUX_DIR],
-[AC_CONFIG_AUX_DIRS($1 $srcdir/$1)])
+[AC_CONFIG_AUX_DIRS($1 "$srcdir"/$1)])
# AC_CONFIG_AUX_DIR_DEFAULT
@@ -1572,7 +1572,7 @@ AC_DEFUN([AC_CONFIG_AUX_DIR],
# The default is `$srcdir' or `$srcdir/..' or `$srcdir/../..'.
# There's no need to call this macro explicitly; just AC_REQUIRE it.
AC_DEFUN([AC_CONFIG_AUX_DIR_DEFAULT],
-[AC_CONFIG_AUX_DIRS($srcdir $srcdir/.. $srcdir/../..)])
+[AC_CONFIG_AUX_DIRS("$srcdir" "$srcdir/.." "$srcdir/../..")])
# AC_CONFIG_AUX_DIRS(DIR ...)
@@ -1584,15 +1584,15 @@ AC_DEFUN([AC_CONFIG_AUX_DIR_DEFAULT],
AC_DEFUN([AC_CONFIG_AUX_DIRS],
[ac_aux_dir=
for ac_dir in $1; do
- if test -f $ac_dir/install-sh; then
+ if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
- elif test -f $ac_dir/install.sh; then
+ elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
- elif test -f $ac_dir/shtool; then
+ elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
@@ -1601,9 +1601,6 @@ done
if test -z "$ac_aux_dir"; then
AC_MSG_ERROR([cannot find install-sh or install.sh in $1])
fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
])# AC_CONFIG_AUX_DIRS
@@ -1692,17 +1689,17 @@ m4_divert_once([HELP_CANON],
System types:
--build=BUILD configure for building on BUILD [guessed]]])dnl
# Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
- AC_MSG_ERROR([cannot run $ac_config_sub])
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ AC_MSG_ERROR([cannot run $SHELL $ac_aux_dir/config.sub])
AC_CACHE_CHECK([build system type], [ac_cv_build],
[ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
- ac_build_alias=`$ac_config_guess`
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
AC_MSG_ERROR([cannot guess build type; you must specify one])
-ac_cv_build=`$ac_config_sub $ac_build_alias` ||
- AC_MSG_ERROR([$ac_config_sub $ac_build_alias failed])
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $ac_build_alias failed])
])
_AC_CANONICAL_SPLIT(build)
])# AC_CANONICAL_BUILD
@@ -1718,8 +1715,8 @@ AC_CACHE_CHECK([host system type], [ac_c
[if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
- ac_cv_host=`$ac_config_sub $host_alias` ||
- AC_MSG_ERROR([$ac_config_sub $host_alias failed])
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $host_alias failed])
fi
])
_AC_CANONICAL_SPLIT([host])
@@ -1737,8 +1734,8 @@ AC_CACHE_CHECK([target system type], [ac
[if test "x$target_alias" = x; then
ac_cv_target=$ac_cv_host
else
- ac_cv_target=`$ac_config_sub $target_alias` ||
- AC_MSG_ERROR([$ac_config_sub $target_alias failed])
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ AC_MSG_ERROR([$SHELL $ac_aux_dir/config.sub $target_alias failed])
fi
])
_AC_CANONICAL_SPLIT([target])
@@ -1802,8 +1799,8 @@ m4_define([AC_CACHE_LOAD],
if test -f "$cache_file"; then
AC_MSG_NOTICE([loading cache $cache_file])
case $cache_file in
- [[\\/]]* | ?:[[\\/]]* ) . $cache_file;;
- *) . ./$cache_file;;
+ [[\\/]]* | ?:[[\\/]]* ) . "$cache_file";;
+ *) . "./$cache_file";;
esac
fi
else
@@ -1886,8 +1883,8 @@ _AC_CACHE_DUMP() |
t end
s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
:end'] >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
- if test -w $cache_file; then
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
test "x$cache_file" != "x/dev/null" &&
AC_MSG_NOTICE([updating cache $cache_file])
cat confcache >$cache_file
Index: lib/autoconf/libs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/libs.m4,v
retrieving revision 1.15
diff -p -u -r1.15 libs.m4
--- lib/autoconf/libs.m4 22 Feb 2006 19:37:40 -0000 1.15
+++ lib/autoconf/libs.m4 18 May 2006 22:38:14 -0000
@@ -199,8 +199,8 @@ _ACEOF
eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
for ac_extension in a so sl; do
- if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
- test -f $ac_im_libdir/libX11.$ac_extension; then
+ if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
+ test -f "$ac_im_libdir/libX11.$ac_extension"; then
ac_im_usrlibdir=$ac_im_libdir; break
fi
done
@@ -294,7 +294,7 @@ for ac_dir in `echo "$ac_x_includes $ac_
do
# Don't even attempt the hair of trying to link an X program!
for ac_extension in a so sl; do
- if test -r $ac_dir/libXt.$ac_extension; then
+ if test -r "$ac_dir/libXt.$ac_extension"; then
ac_x_libraries=$ac_dir
break 2
fi
Index: lib/autoconf/specific.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/specific.m4,v
retrieving revision 1.366
diff -p -u -r1.366 specific.m4
--- lib/autoconf/specific.m4 8 Apr 2006 21:46:04 -0000 1.366
+++ lib/autoconf/specific.m4 18 May 2006 22:38:14 -0000
@@ -221,15 +221,15 @@ else
ac_tmpdirs='/tmp /var/tmp /usr/tmp'
fi
for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do
- test -d $ac_dir || continue
- test -w $ac_dir || continue # It is less confusing to not echo anything here.
+ test -d "$ac_dir" || continue
+ test -w "$ac_dir" || continue # It is less confusing to not echo anything
here.
ac_xdir=$ac_dir/cf$$
- (umask 077 && mkdir $ac_xdir 2>/dev/null) || continue
+ (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue
ac_tf1=$ac_xdir/conftest9012345
ac_tf2=$ac_xdir/conftest9012346
- touch $ac_tf1 2>/dev/null && test -f $ac_tf1 && test ! -f $ac_tf2 ||
+ touch "$ac_tf1" 2>/dev/null && test -f "$ac_tf1" && test ! -f "$ac_tf2" ||
ac_cv_sys_long_file_names=no
- rm -f -r $ac_xdir 2>/dev/null
+ rm -f -r "$ac_xdir" 2>/dev/null
test $ac_cv_sys_long_file_names = no && break
done])
if test $ac_cv_sys_long_file_names = yes; then
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.100
diff -p -u -r1.100 status.m4
--- lib/autoconf/status.m4 13 May 2006 09:54:51 -0000 1.100
+++ lib/autoconf/status.m4 18 May 2006 22:38:14 -0000
@@ -776,19 +776,19 @@ m4_define([_AC_OUTPUT_LINK],
AC_MSG_NOTICE([linking $srcdir/$ac_source to $ac_file])
- if test ! -r $srcdir/$ac_source; then
+ if test ! -r "$srcdir/$ac_source"; then
AC_MSG_ERROR([$srcdir/$ac_source: file not found])
fi
- rm -f $ac_file
+ rm -f "$ac_file"
# Try a relative symlink, then a hard link, then a copy.
case $srcdir in
[[\\/$]]* | ?:[[\\/]]* ) ac_rel_source=$srcdir/$ac_source ;;
*) ac_rel_source=$ac_top_build_prefix$srcdir/$ac_source ;;
esac
- ln -s $ac_rel_source $ac_file 2>/dev/null ||
- ln $srcdir/$ac_source $ac_file 2>/dev/null ||
- cp -p $srcdir/$ac_source $ac_file ||
+ ln -s "$ac_rel_source" "$ac_file" 2>/dev/null ||
+ ln "$srcdir/$ac_source" "$ac_file" 2>/dev/null ||
+ cp -p "$srcdir/$ac_source" "$ac_file" ||
AC_MSG_ERROR([cannot link or copy $srcdir/$ac_source to $ac_file])
])# _AC_OUTPUT_LINK
@@ -964,7 +964,7 @@ if test "$no_recursion" != yes; then
# Do not complain, so a configure script can configure whichever
# parts of a large source tree are present.
- test -d $srcdir/$ac_dir || continue
+ test -d "$srcdir/$ac_dir" || continue
ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
_AS_ECHO_LOG([$ac_msg])
@@ -972,15 +972,16 @@ if test "$no_recursion" != yes; then
AS_MKDIR_P(["$ac_dir"])
_AC_SRCDIRS(["$ac_dir"])
- cd $ac_dir
+ cd "$ac_dir"
# Check for guested configure; otherwise get Cygnus style configure.
- if test -f $ac_srcdir/configure.gnu; then
+ if test -f "$ac_srcdir/configure.gnu"; then
ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'"
- elif test -f $ac_srcdir/configure; then
+ elif test -f "$ac_srcdir/configure"; then
ac_sub_configure="$SHELL '$ac_srcdir/configure'"
- elif test -f $ac_srcdir/configure.in; then
- ac_sub_configure=$ac_configure
+ elif test -f "$ac_srcdir/configure.in"; then
+ # This should be Cygnus configure.
+ ac_sub_configure="$SHELL '$ac_aux_dir/configure'"
else
AC_MSG_WARN([no configuration information is in $ac_dir])
ac_sub_configure=
@@ -998,7 +999,7 @@ if test "$no_recursion" != yes; then
AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args
--cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
# The eval makes quoting arguments work.
eval "$ac_sub_configure $ac_sub_configure_args \
- --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" ||
+ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
fi
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.211
diff -p -u -r1.211 general.m4
--- lib/autotest/general.m4 17 Apr 2006 06:10:51 -0000 1.211
+++ lib/autotest/general.m4 18 May 2006 22:38:14 -0000
@@ -650,11 +650,11 @@ AS_BOX(m4_defn([AT_TESTSUITE_NAME])[.])
for at_program in : $at_tested
do
test "$at_program" = : && continue
- _AS_PATH_WALK([$PATH], [test -f $as_dir/$at_program && break])
- if test -f $as_dir/$at_program; then
+ _AS_PATH_WALK([$PATH], [test -f "$as_dir/$at_program" && break])
+ if test -f "$as_dir/$at_program"; then
{
echo "$at_srcdir/AT_LINE: $as_dir/$at_program --version"
- $as_dir/$at_program --version
+ "$as_dir/$at_program" --version
echo
} >&AS_MESSAGE_LOG_FD 2>&1
else
@@ -717,9 +717,9 @@ do
# Create a fresh directory for the next test group, and enter.
at_group_dir=$at_suite_dir/$at_group_normalized
at_group_log=$at_group_dir/$as_me.log
- if test -d $at_group_dir; then
- find $at_group_dir -type d ! -perm -700 -exec chmod u+rwx \{\} \;
- rm -fr $at_group_dir
+ if test -d "$at_group_dir"; then
+ find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
+ rm -fr "$at_group_dir"
fi
# Be tolerant if the above `rm' was not able to remove the directory.
AS_MKDIR_P([$at_group_dir])
@@ -815,9 +815,9 @@ _ATEOF
# Cleanup the group directory, unless the user wants the files.
if $at_debug_p ; then
_AT_CREATE_DEBUGGING_SCRIPT
- elif test -d $at_group_dir; then
- find $at_group_dir -type d ! -perm -700 -exec chmod u+rwx \{\} \;
- rm -fr $at_group_dir
+ elif test -d "$at_group_dir"; then
+ find "$at_group_dir" -type d ! -perm -700 -exec chmod u+rwx \{\} \;
+ rm -fr "$at_group_dir"
fi
;;
*)
Index: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.186
diff -p -u -r1.186 m4sh.m4
--- lib/m4sugar/m4sh.m4 13 May 2006 09:54:51 -0000 1.186
+++ lib/m4sugar/m4sh.m4 18 May 2006 22:38:15 -0000
@@ -238,12 +238,12 @@ if test "x$CONFIG_SHELL" = x; then
for as_shell in $as_candidate_shells $SHELL; do
# Try only shells which exist, to save several forks.
- AS_IF([test -f $as_shell &&
+ AS_IF([test -f "$as_shell" &&
_AS_RUN([_AS_DETECT_REQUIRED_BODY],
- [($as_shell) 2> /dev/null])],
+ [("$as_shell") 2> /dev/null])],
[CONFIG_SHELL=$as_shell
as_have_required=yes
- AS_IF([_AS_RUN([_AS_DETECT_SUGGESTED_BODY], [$as_shell 2>
/dev/null])],
+ AS_IF([_AS_RUN([_AS_DETECT_SUGGESTED_BODY], ["$as_shell" 2>
/dev/null])],
[break])])
done
- shell quoting fixes,
Paul Eggert <=