diff options
author | Jim Meyering <jim@meyering.net> | 2006-10-26 11:03:30 +0200 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-10-26 11:03:30 +0200 |
commit | b40b5b6917f62f59eff8f8bd913bd79e4cebe8f2 (patch) | |
tree | 8581923bfe75824980ae361df11e0a5bdcb3984c /tests | |
parent | 95954ad5832e2dcc5709401643e615612281fc88 (diff) | |
download | coreutils-b40b5b6917f62f59eff8f8bd913bd79e4cebe8f2.tar.xz |
Avoid a shell bug in Tru64 4.0 sh's handling of double-quoted strings.
[patch by Paul Eggert]
* tests/chmod/c-option: When double-quoting part of a word, prefer
to double-quote the whole word. This is a bit easier to read (at
least for me), and in some cases it avoids a shell bug with Tru64
4.0 sh reported by Nelson H. F. Beebe. For example, instead of
"$abs_srcdir"/../setgid-check we now write
"$abs_srcdir/../setgid-check".
* tests/cp/cp-parents: Likewise.
* tests/du/inaccessible-cwd: Likewise.
* tests/du/long-from-unreadable: Likewise.
* tests/install/basic-1: Likewise.
* tests/install/trap: Likewise.
* tests/misc/close-stdout: Likewise.
* tests/mkdir/concurrent-1: Likewise.
* tests/mkdir/p-1: Likewise.
* tests/mkdir/p-3: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
* tests/readlink/can-e: Likewise.
* tests/readlink/can-f: Likewise.
* tests/readlink/can-m: Likewise.
* tests/rm/inaccessible: Likewise.
* tests/rm/unread3: Likewise.
* tests/touch/no-create-missing: Likewise.
* lib/.cvsignore: Add uinttostr.c.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/chmod/c-option | 2 | ||||
-rwxr-xr-x | tests/cp/cp-parents | 2 | ||||
-rwxr-xr-x | tests/du/inaccessible-cwd | 2 | ||||
-rwxr-xr-x | tests/du/long-from-unreadable | 2 | ||||
-rwxr-xr-x | tests/install/basic-1 | 4 | ||||
-rwxr-xr-x | tests/install/trap | 4 | ||||
-rwxr-xr-x | tests/misc/close-stdout | 12 | ||||
-rwxr-xr-x | tests/mkdir/concurrent-1 | 2 | ||||
-rwxr-xr-x | tests/mkdir/p-1 | 2 | ||||
-rwxr-xr-x | tests/mkdir/p-3 | 14 | ||||
-rwxr-xr-x | tests/mkdir/parents | 6 | ||||
-rwxr-xr-x | tests/mkdir/perm | 4 | ||||
-rwxr-xr-x | tests/readlink/can-e | 2 | ||||
-rwxr-xr-x | tests/readlink/can-f | 2 | ||||
-rwxr-xr-x | tests/readlink/can-m | 2 | ||||
-rwxr-xr-x | tests/rm/inaccessible | 6 | ||||
-rwxr-xr-x | tests/rm/unread3 | 12 | ||||
-rwxr-xr-x | tests/touch/no-create-missing | 4 |
18 files changed, 42 insertions, 42 deletions
diff --git a/tests/chmod/c-option b/tests/chmod/c-option index 0b116c46a..bf2c4a9a5 100755 --- a/tests/chmod/c-option +++ b/tests/chmod/c-option @@ -50,7 +50,7 @@ if test $framework_failure = 1; then (exit 1); exit 1 fi -. "$abs_srcdir"/../setgid-check +. "$abs_srcdir/../setgid-check" fail=0 diff --git a/tests/cp/cp-parents b/tests/cp/cp-parents index c68921538..373e60776 100755 --- a/tests/cp/cp-parents +++ b/tests/cp/cp-parents @@ -44,7 +44,7 @@ cd "$pwd" || framework_failure=1 mkdir -p $tmp || framework_failure=1 cd $tmp || framework_failure=1 -. "$abs_srcdir"/../setgid-check +. "$abs_srcdir/../setgid-check" mkdir foo bar || framework_failure=1 mkdir -p a/b/c d e || framework_failure=1 diff --git a/tests/du/inaccessible-cwd b/tests/du/inaccessible-cwd index ea4ba7a27..0f9f9b766 100755 --- a/tests/du/inaccessible-cwd +++ b/tests/du/inaccessible-cwd @@ -48,6 +48,6 @@ fi fail=0 -du "$pwd"/$tmp/a > /dev/null || fail=1 +du "$pwd/$tmp/a" > /dev/null || fail=1 (exit $fail); exit $fail diff --git a/tests/du/long-from-unreadable b/tests/du/long-from-unreadable index 16f00e8ec..f43a6dbb6 100755 --- a/tests/du/long-from-unreadable +++ b/tests/du/long-from-unreadable @@ -84,6 +84,6 @@ if test $framework_failure = 1; then fi fail=0 -du -s "$pwd"/$tmp/$dir > /dev/null || fail=1 +du -s "$pwd/$tmp/$dir" > /dev/null || fail=1 (exit $fail); exit $fail diff --git a/tests/install/basic-1 b/tests/install/basic-1 index bbb30878e..9ee4525a4 100755 --- a/tests/install/basic-1 +++ b/tests/install/basic-1 @@ -117,7 +117,7 @@ test -d newdir3 || fail=1 # hence cannot do anything meaningful with the following relative-named dirs. abs=$pwd/$tmp mkdir sub || fail=1 -(cd sub && chmod 0 . && ginstall -d "$abs"/xx/yy rel/sub1 rel/sub2 2> /dev/null) && fail=1 +(cd sub && chmod 0 . && ginstall -d "$abs/xx/yy" rel/sub1 rel/sub2 2> /dev/null) && fail=1 chmod 755 sub # Ensure that the first argument-dir has been created. @@ -132,7 +132,7 @@ test -d xx/rel && fail=1 # inaccessible parent. coreutils 5.97 fails this test. mkdir -p sub1/d || fail=1 (cd sub1/d && chmod a-rx .. && chmod a-r . && - ginstall -d "$abs"/xx/zz rel/a rel/b 2> /dev/null) || fail=1 + ginstall -d "$abs/xx/zz" rel/a rel/b 2> /dev/null) || fail=1 chmod 755 sub1 sub1/d || fail=1 test -d xx/zz || fail=1 test -d sub1/d/rel/a || fail=1 diff --git a/tests/install/trap b/tests/install/trap index 3ebaafff3..aaf0a3346 100755 --- a/tests/install/trap +++ b/tests/install/trap @@ -43,10 +43,10 @@ fail=0 # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh. ( # ash doesn't support "trap '' CHLD"; it knows only signal numbers. - sig=`"$pwd"/../../src/kill -l CHLD 2>/dev/null` && trap '' $sig + sig=`"$pwd/../../src/kill" -l CHLD 2>/dev/null` && trap '' $sig # Before 2004-04-21, install would infloop, in the `while (wait...' loop: - exec ginstall -s "$pwd"/../../src/ginstall$EXEEXT . + exec ginstall -s "$pwd/../../src/ginstall$EXEEXT" . ) (exit $fail); exit $fail diff --git a/tests/misc/close-stdout b/tests/misc/close-stdout index 01edf32c4..dd8bbc5e1 100755 --- a/tests/misc/close-stdout +++ b/tests/misc/close-stdout @@ -56,21 +56,21 @@ mv d e >&- || fail=1 rmdir e >&- || fail=1 touch e >&- || fail=1 sleep 0 >&- || fail=1 -"$pwd"/../../src/true >&- || fail=1 -"$pwd"/../../src/printf '' >&- || fail=1 +"$pwd/../../src/true" >&- || fail=1 +"$pwd/../../src/printf" '' >&- || fail=1 # If >&- works, ensure these fail, because stdout is closed and they # *do* generate output. >&- apparently does not work in HP-UX 11.23. # This test is ineffective unless /dev/stdout also works. -if "$pwd"/../../src/test -w /dev/stdout >/dev/null && - "$pwd"/../../src/test ! -w /dev/stdout >&-; then - "$pwd"/../../src/printf 'foo' >&- 2>/dev/null && fail=1 +if "$pwd/../../src/test" -w /dev/stdout >/dev/null && + "$pwd/../../src/test" ! -w /dev/stdout >&-; then + "$pwd/../../src/printf" 'foo' >&- 2>/dev/null && fail=1 cp --verbose a b >&- 2>/dev/null && fail=1 fi # Likewise for /dev/full, if /dev/full works. if test -w /dev/full && test -c /dev/full; then - "$pwd"/../../src/printf 'foo' >/dev/full 2>/dev/null && fail=1 + "$pwd/../../src/printf" 'foo' >/dev/full 2>/dev/null && fail=1 cp --verbose a b >/dev/full 2>/dev/null && fail=1 fi diff --git a/tests/mkdir/concurrent-1 b/tests/mkdir/concurrent-1 index 790e4ed7a..0a8c14295 100755 --- a/tests/mkdir/concurrent-1 +++ b/tests/mkdir/concurrent-1 @@ -32,7 +32,7 @@ tmp=`echo "$0"|sed 's,.*/,,'`.tmp trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 -mkdir --parents "$pwd"/$tmp/a/b/c || fail=1 +mkdir --parents "$pwd/$tmp/a/b/c" || fail=1 test -d $tmp || fail=1 diff --git a/tests/mkdir/p-1 b/tests/mkdir/p-1 index 001b8b74c..7e384e415 100755 --- a/tests/mkdir/p-1 +++ b/tests/mkdir/p-1 @@ -28,7 +28,7 @@ tmp=`echo "$0"|sed 's,.*/,,'`.tmp trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 -mkdir --parents "$pwd"/$tmp || fail=1 +mkdir --parents "$pwd/$tmp" || fail=1 test -d $tmp || fail=1 diff --git a/tests/mkdir/p-3 b/tests/mkdir/p-3 index d9e49d5dc..7f367178e 100755 --- a/tests/mkdir/p-3 +++ b/tests/mkdir/p-3 @@ -45,20 +45,20 @@ if test $framework_failure = 1; then fi p=$pwd/$tmp -(cd no-access && chmod 0 . && mkdir -p "$p"/a/b u/v) 2> /dev/null && fail=1 -test -d "$p"/a/b || fail=1 +(cd no-access && chmod 0 . && mkdir -p "$p/a/b" u/v) 2> /dev/null && fail=1 +test -d "$p/a/b" || fail=1 # Same as above, but with a following *absolute* name, it should succeed -(cd no-acce2s && chmod 0 . && mkdir -p "$p"/b/b "$p"/z) || fail=1 -test -d "$p"/b/b && test -d "$p"/z || fail=1 +(cd no-acce2s && chmod 0 . && mkdir -p "$p/b/b" "$p/z") || fail=1 +test -d "$p/b/b" && test -d "$p/z" || fail=1 # Same as above, but a trailing relative name in an unreadable directory # whose parent is inaccessible. coreutils 5.97 fails this test. -(cd no-acce3s/d && chmod a-rx .. && chmod a-r . && mkdir -p a/b "$p"/b/c d/e && +(cd no-acce3s/d && chmod a-rx .. && chmod a-r . && mkdir -p a/b "$p/b/c" d/e && test -d a/b && test -d d/e) || fail=1 -test -d "$p"/b/c || fail=1 +test -d "$p/b/c" || fail=1 -b=`ls "$p"/a|tr -d '\n'` +b=`ls "$p/a" | tr -d '\n'` # With coreutils-5.3.0, this would fail with $b=bu. test "x$b" = xb || fail=1 diff --git a/tests/mkdir/parents b/tests/mkdir/parents index 46977fcdc..f0ead6ee8 100755 --- a/tests/mkdir/parents +++ b/tests/mkdir/parents @@ -44,7 +44,7 @@ if test $framework_failure = 1; then (exit 1); exit 1 fi -. "$abs_srcdir"/../setgid-check +. "$abs_srcdir/../setgid-check" fail=0 @@ -56,12 +56,12 @@ mkdir e-dir > /dev/null 2>&1 && fail=1 # Create an existing directory. umask 077 mode_str=drwxr-x-wx -mode_arg=`"$abs_srcdir"/../rwx-to-mode $mode_str` +mode_arg=`"$abs_srcdir/../rwx-to-mode" $mode_str` mkdir -m $mode_arg a || fail=1 # this `mkdir -p ...' shouldn't change perms of existing dir `a'. d_mode_str=drwx-w--wx -d_mode_arg=`"$abs_srcdir"/../rwx-to-mode $d_mode_str` +d_mode_arg=`"$abs_srcdir/../rwx-to-mode" $d_mode_str` mkdir -p -m $d_mode_arg a/b/c/d # Make sure the permissions of `a' haven't been changed. diff --git a/tests/mkdir/perm b/tests/mkdir/perm index 54838088c..3853f2a3b 100755 --- a/tests/mkdir/perm +++ b/tests/mkdir/perm @@ -45,8 +45,8 @@ if test $framework_failure = 1; then (exit 1); exit 1 fi -. "$abs_srcdir"/../setgid-check -. "$abs_srcdir"/../umask-check +. "$abs_srcdir/../setgid-check" +. "$abs_srcdir/../umask-check" fail=0 diff --git a/tests/readlink/can-e b/tests/readlink/can-e index d2777aa49..40c8e9177 100755 --- a/tests/readlink/can-e +++ b/tests/readlink/can-e @@ -31,7 +31,7 @@ trap 'status=$?; (exit $status); exit $status' 1 2 13 15 fail=1 while :; do bindir=`cd ../../src && pwd`|| break - my_pwd=`"$bindir"/pwd` || break + my_pwd=`"$bindir/pwd"` || break mkdir -p $tmp || break cd $tmp || break diff --git a/tests/readlink/can-f b/tests/readlink/can-f index 51ebda88d..c0cf53063 100755 --- a/tests/readlink/can-f +++ b/tests/readlink/can-f @@ -31,7 +31,7 @@ trap 'status=$?; (exit $status); exit $status' 1 2 13 15 fail=1 while :; do bindir=`cd ../../src && pwd`|| break - my_pwd=`"$bindir"/pwd` || break + my_pwd=`"$bindir/pwd"` || break mkdir -p $tmp || break cd $tmp || break diff --git a/tests/readlink/can-m b/tests/readlink/can-m index 78771c800..bdd4033ea 100755 --- a/tests/readlink/can-m +++ b/tests/readlink/can-m @@ -31,7 +31,7 @@ trap 'status=$?; (exit $status); exit $status' 1 2 13 15 fail=1 while :; do bindir=`cd ../../src && pwd`|| break - my_pwd=`"$bindir"/pwd` || break + my_pwd=`"$bindir/pwd"` || break mkdir -p $tmp || break cd $tmp || break diff --git a/tests/rm/inaccessible b/tests/rm/inaccessible index 721210a2a..02128d70e 100755 --- a/tests/rm/inaccessible +++ b/tests/rm/inaccessible @@ -56,9 +56,9 @@ fail=0 p=$pwd/$tmp set +x -(cd no-access; chmod 0 . && rm -r "$p"/abs1 rel "$p"/abs2) 2> out && fail=1 -test -d "$p"/abs1 && fail=1 -test -d "$p"/abs2 && fail=1 +(cd no-access; chmod 0 . && rm -r "$p/abs1" rel "$p/abs2") 2> out && fail=1 +test -d "$p/abs1" && fail=1 +test -d "$p/abs2" && fail=1 cat <<\EOF > exp || fail=1 rm: cannot remove `rel': Permission denied diff --git a/tests/rm/unread3 b/tests/rm/unread3 index c8af5cfe7..4021a39d2 100755 --- a/tests/rm/unread3 +++ b/tests/rm/unread3 @@ -47,16 +47,16 @@ chmod u=x,go= . t=$pwd/$tmp # With coreutils-5.2.1, this would get a failed assertion. -rm -r "$t"/a "$t"/b || fail=1 +rm -r "$t/a" "$t/b" || fail=1 # With coreutils-5.2.1, this would get the following: # rm: cannot get current directory: Permission denied # rm: failed to return to initial working directory: Bad file descriptor -rm -r "$t"/d "$t"/e || fail=1 +rm -r "$t/d" "$t/e" || fail=1 -test -d "$t"/a && fail=1 -test -d "$t"/b && fail=1 -test -d "$t"/d && fail=1 -test -d "$t"/e && fail=1 +test -d "$t/a" && fail=1 +test -d "$t/b" && fail=1 +test -d "$t/d" && fail=1 +test -d "$t/e" && fail=1 (exit $fail); exit $fail diff --git a/tests/touch/no-create-missing b/tests/touch/no-create-missing index 3f3452ebd..cf6b6dc6a 100755 --- a/tests/touch/no-create-missing +++ b/tests/touch/no-create-missing @@ -46,8 +46,8 @@ touch -ca no-file > /dev/null 2>&1 || fail=1 # If >&- works, test "touch -c -" etc. # >&- apparently does not work in HP-UX 11.23. # This test is ineffective unless /dev/stdout also works. -if "$pwd"/../../src/test -w /dev/stdout >/dev/null && - "$pwd"/../../src/test ! -w /dev/stdout >&-; then +if "$pwd/../../src/test" -w /dev/stdout >/dev/null && + "$pwd/../../src/test" ! -w /dev/stdout >&-; then touch -c - >&- 2> /dev/null || fail=1 touch -cm - >&- 2> /dev/null || fail=1 touch -ca - >&- 2> /dev/null || fail=1 |