diff options
author | Ralf Wildenhues <Ralf.Wildenhues@gmx.de> | 2007-11-30 12:14:57 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2007-11-30 12:14:57 +0100 |
commit | 0db207c66c8b992f4c123c6a25f3cb1809ec4149 (patch) | |
tree | 3ec0294efce27ba341a7a2ec7b7255529aa6b808 | |
parent | d7ed3bcb8dd785f1404d6f68f53c6b5668ac56f8 (diff) | |
download | coreutils-0db207c66c8b992f4c123c6a25f3cb1809ec4149.tar.xz |
Add quotes to protect against white space in build dir name.
* tests/check.mk (TESTS_ENVIRONMENT): Quote $(abs_srcdir).
* tests/chmod/setgid: Quote absolute names.
* tests/misc/help-version: Likewise.
* tests/misc/pwd-unreadable-parent: Likewise.
* tests/rmdir/ignore: Likewise.
* tests/test-lib.sh: Likewise.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | tests/check.mk | 2 | ||||
-rwxr-xr-x | tests/chmod/setgid | 4 | ||||
-rwxr-xr-x | tests/misc/help-version | 14 | ||||
-rwxr-xr-x | tests/misc/pwd-unreadable-parent | 2 | ||||
-rwxr-xr-x | tests/rmdir/ignore | 10 | ||||
-rw-r--r-- | tests/test-lib.sh | 4 |
7 files changed, 26 insertions, 18 deletions
@@ -1,5 +1,13 @@ 2007-11-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + Add quotes to protect against white space in build dir name. + * tests/check.mk (TESTS_ENVIRONMENT): Quote $(abs_srcdir). + * tests/chmod/setgid: Quote absolute names. + * tests/misc/help-version: Likewise. + * tests/misc/pwd-unreadable-parent: Likewise. + * tests/rmdir/ignore: Likewise. + * tests/test-lib.sh: Likewise. + Define `tst', for CU_TEST_NAME. * build-aux/check.mk (am__check_pre): Set `tst', for CU_TEST_NAME in tests/check.mk. diff --git a/tests/check.mk b/tests/check.mk index c33aa8922..63f11e449 100644 --- a/tests/check.mk +++ b/tests/check.mk @@ -43,7 +43,7 @@ TESTS_ENVIRONMENT = \ srcdir='$(srcdir)' \ top_srcdir='$(top_srcdir)' \ CONFIG_HEADER='$(CONFIG_HEADER)' \ - CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \ + CU_TEST_NAME=`basename '$(abs_srcdir)'`,$$tst \ EGREP='$(EGREP)' \ EXEEXT='$(EXEEXT)' \ MAKE=$(MAKE) \ diff --git a/tests/chmod/setgid b/tests/chmod/setgid index 0c583f274..a91c6a581 100755 --- a/tests/chmod/setgid +++ b/tests/chmod/setgid @@ -30,7 +30,7 @@ test=$abs_top_builddir/src/test umask 0 mkdir d || framework_failure -chmod g+s d 2> /dev/null && $test -g d || +chmod g+s d 2> /dev/null && "$test" -g d || { # This is required because on some systems (at least NetBSD 1.4.2A), # it may happen that when you create a directory, its group isn't one @@ -44,7 +44,7 @@ chmod g+s d 2> /dev/null && $test -g d || } # "chmod g+s d" does nothing on some NFS file systems. -$test -g d || { +"$test" -g d || { echo 1>&2 "$0: cannot create setgid directories," \ "so can't run this test" exit 77 diff --git a/tests/misc/help-version b/tests/misc/help-version index 6da675f38..6c1565dcd 100755 --- a/tests/misc/help-version +++ b/tests/misc/help-version @@ -75,9 +75,9 @@ for lang in C fr da; do # false fails even when invoked with --help or --version. if test $i = false; then - env LC_MESSAGES=$lang $abs_top_builddir/src/$i --help \ + env LC_MESSAGES=$lang "$abs_top_builddir/src/$i" --help \ >/dev/null && fail=1 - env LC_MESSAGES=$lang $abs_top_builddir/src/$i --version \ + env LC_MESSAGES=$lang "$abs_top_builddir/src/$i" --version \ >/dev/null && fail=1 continue fi @@ -86,8 +86,8 @@ for lang in C fr da; do test $i = install && i=ginstall # Make sure they exit successfully, under normal conditions. - $abs_top_builddir/src/$i --help > h-$i || fail=1 - $abs_top_builddir/src/$i --version >/dev/null || fail=1 + "$abs_top_builddir/src/$i" --help > h-$i || fail=1 + "$abs_top_builddir/src/$i" --version >/dev/null || fail=1 # Make sure they mention the bug-reporting address in --help output. grep "$PACKAGE_BUGREPORT" h-$i > /dev/null || fail=1 @@ -95,8 +95,8 @@ for lang in C fr da; do # Make sure they fail upon `disk full' error. if test -w /dev/full && test -c /dev/full; then - $abs_top_builddir/src/$i --help >/dev/full 2>/dev/null && fail=1 - $abs_top_builddir/src/$i --version >/dev/full 2>/dev/null && fail=1 + "$abs_top_builddir/src/$i" --help >/dev/full 2>/dev/null && fail=1 + "$abs_top_builddir/src/$i" --version >/dev/full 2>/dev/null && fail=1 status=$? test $i = [ && prog=lbracket || prog=$i eval "expected=\$expected_failure_status_$prog" @@ -213,7 +213,7 @@ for i in $built_programs; do # echo ================== $i test $i = [ && prog=lbracket || prog=$i eval "args=\$${prog}_args" - if $abs_top_builddir/src/$i $args < $tmp_in > $tmp_out; then + if "$abs_top_builddir/src/$i" $args < $tmp_in > $tmp_out; then : # ok else echo FAIL: $i diff --git a/tests/misc/pwd-unreadable-parent b/tests/misc/pwd-unreadable-parent index 57557c673..f3ff874d8 100755 --- a/tests/misc/pwd-unreadable-parent +++ b/tests/misc/pwd-unreadable-parent @@ -47,7 +47,7 @@ chmod a=x .. || framework_failure pwd_exe="$abs_top_builddir/src/pwd" fail=0 -$pwd_exe > exp || fail=1 +"$pwd_exe" > exp || fail=1 readlink -ev . > out || fail=1 compare out exp || fail=1 diff --git a/tests/rmdir/ignore b/tests/rmdir/ignore index 6ad89577c..bb3f62f2e 100755 --- a/tests/rmdir/ignore +++ b/tests/rmdir/ignore @@ -24,14 +24,14 @@ fi . $srcdir/../test-lib.sh cwd=`pwd` -mkdir -p $cwd/a/b/c $cwd/a/x || framework_failure +mkdir -p "$cwd/a/b/c" "$cwd/a/x" || framework_failure fail=0 -rmdir -p --ignore-fail-on-non-empty $cwd/a/b/c || fail=1 +rmdir -p --ignore-fail-on-non-empty "$cwd/a/b/c" || fail=1 # $cwd/a/x should remain -test -d $cwd/a/x || fail=1 +test -d "$cwd/a/x" || fail=1 # $cwd/a/b and $cwd/a/b/c should be gone -test -d $cwd/a/b && fail=1 -test -d $cwd/a/b/c && fail=1 +test -d "$cwd/a/b" && fail=1 +test -d "$cwd/a/b/c" && fail=1 exit $fail diff --git a/tests/test-lib.sh b/tests/test-lib.sh index b90f98ff7..8872b27b1 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -80,7 +80,7 @@ this_test=$(this_test_) # a partition, or to undo any other global state changes. cleanup_() { :; } -t_=$($abs_top_builddir/src/mktemp -d --tmp="$test_dir_" cu-$this_test.XXXXXXXXXX)\ +t_=$("$abs_top_builddir/src/mktemp" -d --tmp="$test_dir_" cu-$this_test.XXXXXXXXXX)\ || error_ "failed to create temporary directory in $test_dir_" # Run each test from within a temporary sub-directory named after the @@ -89,7 +89,7 @@ trap 'st=$?; cleanup_; d='"$t_"'; cd '"$test_dir_"' && chmod -R u+rwx "$d" && rm -rf "$d" && exit $st' 0 trap '(exit $?); exit $?' 1 2 13 15 -cd $t_ || error_ "failed to cd to $t_" +cd "$t_" || error_ "failed to cd to $t_" if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then compare() { diff -u "$@"; } |