summaryrefslogtreecommitdiff
path: root/tests/rm
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-10-22 19:37:31 +0200
committerJim Meyering <jim@meyering.net>2006-10-22 19:37:31 +0200
commit2457af43cf6d670ab120c19bf4f23ac545ff24b5 (patch)
tree72e286663db916c5c42078075667d1ed1ade831d /tests/rm
parentf5417daca01691c0e6b409e39a534eb5e0f865d7 (diff)
downloadcoreutils-2457af43cf6d670ab120c19bf4f23ac545ff24b5.tar.xz
* tests/sample-test: Quote variables containing absolute build
tree paths. In the cleanup trap, make sure `cd' succeeds before `chmod'ing and `rm'ing the temporary files. * tests/chgrp/basic: Likewise. * tests/chgrp/deref: Likewise. * tests/chgrp/no-x: Likewise. * tests/chgrp/posix-H: Likewise. * tests/chgrp/recurse: Likewise. * tests/chmod/c-option: Likewise. * tests/chmod/equal-x: Likewise. * tests/chmod/equals: Likewise. * tests/chmod/inaccessible: Likewise. * tests/chmod/no-x: Likewise. * tests/chmod/octal: Likewise. * tests/chmod/setgid: Likewise. * tests/chmod/umask-x: Likewise. * tests/chmod/usage: Likewise. * tests/chown/basic: Likewise. * tests/chown/deref: Likewise. * tests/chown/separator: Likewise. * tests/cp/acl: Likewise. * tests/cp/backup-1: Likewise. * tests/cp/backup-dir: Likewise. * tests/cp/backup-is-src: Likewise. * tests/cp/cp-HL: Likewise. * tests/cp/cp-deref: Likewise. * tests/cp/cp-i: Likewise. * tests/cp/cp-mv-backup: Likewise. * tests/cp/cp-parents: Likewise. * tests/cp/deref-slink: Likewise. * tests/cp/dir-rm-dest: Likewise. * tests/cp/dir-slash: Likewise. * tests/cp/dir-vs-file: Likewise. * tests/cp/fail-perm: Likewise. * tests/cp/into-self: Likewise. * tests/cp/link: Likewise. * tests/cp/link-no-deref: Likewise. * tests/cp/link-preserve: Likewise. * tests/cp/no-deref-link1: Likewise. * tests/cp/no-deref-link2: Likewise. * tests/cp/no-deref-link3: Likewise. * tests/cp/perm: Likewise. * tests/cp/preserve-2: Likewise. * tests/cp/r-vs-symlink: Likewise. * tests/cp/same-file: Likewise. * tests/cp/slink-2-slink: Likewise. * tests/cp/sparse: Likewise. * tests/cp/special-bits: Likewise. * tests/cp/src-base-dot: Likewise. * tests/cp/symlink-slash: Likewise. * tests/dd/not-rewound: Likewise. * tests/dd/skip-seek2: Likewise. * tests/dd/unblock-sync: Likewise. * tests/du/2g: Likewise. * tests/du/8gb: Likewise. * tests/du/basic: Likewise. * tests/du/deref: Likewise. * tests/du/deref-args: Likewise. * tests/du/exclude: Likewise. * tests/du/fd-leak: Likewise. * tests/du/hard-link: Likewise. * tests/du/inaccessible-cwd: Likewise. * tests/du/long-from-unreadable: Likewise. * tests/du/long-sloop: Likewise. * tests/du/no-deref: Likewise. * tests/du/no-x: Likewise. * tests/du/restore-wd: Likewise. * tests/du/slash: Likewise. * tests/du/slink: Likewise. * tests/du/trailing-slash: Likewise. * tests/du/two-args: Likewise. * tests/fmt/long-line: Likewise. * tests/install/basic-1: Likewise. * tests/install/create-leading: Likewise. * tests/install/d-slashdot: Likewise. * tests/install/trap: Likewise. * tests/ln/misc: Likewise. * tests/ln/target-1: Likewise. * tests/ls/color-dtype-dir: Likewise. * tests/ls/dangle: Likewise. * tests/ls/dired: Likewise. * tests/ls/file-type: Likewise. * tests/ls/follow-slink: Likewise. * tests/ls/infloop: Likewise. * tests/ls/inode: Likewise. * tests/ls/m-option: Likewise. * tests/ls/no-arg: Likewise. * tests/ls/recursive: Likewise. * tests/ls/rt-1: Likewise. * tests/ls/stat-dtype: Likewise. * tests/ls/stat-failed: Likewise. * tests/ls/stat-vs-dirent: Likewise. * tests/misc/cat-proc: Likewise. * tests/misc/close-stdout: Likewise. * tests/misc/csplit: Likewise. * tests/misc/date-sec: Likewise. * tests/misc/false-status: Likewise. * tests/misc/head-c: Likewise. * tests/misc/head-pos: Likewise. * tests/misc/mknod: Likewise. * tests/misc/nl: Likewise. * tests/misc/nohup: Likewise. * tests/misc/pathchk1: Likewise. * tests/misc/printf: Likewise. * tests/misc/printf-hex: Likewise. * tests/misc/pwd-long: Likewise. * tests/misc/shuf: Likewise. * tests/misc/sort-rand: Likewise. * tests/misc/split-a: Likewise. * tests/misc/split-fail: Likewise. * tests/misc/split-l: Likewise. * tests/misc/stat-fmt: Likewise. * tests/misc/tac-continue: Likewise. * tests/misc/wc-files0: Likewise. * tests/mkdir/concurrent-1: Likewise. * tests/mkdir/p-1: Likewise. * tests/mkdir/p-2: Likewise. * tests/mkdir/p-3: Likewise. * tests/mkdir/p-slashdot: Likewise. * tests/mkdir/p-thru-slink: Likewise. * tests/mkdir/p-v: Likewise. * tests/mkdir/parents: Likewise. * tests/mkdir/perm: Likewise. * tests/mkdir/t-slash: Likewise. * tests/mv/acl: Likewise. * tests/mv/atomic: Likewise. * tests/mv/backup-dir: Likewise. * tests/mv/childproof: Likewise. * tests/mv/diag: Likewise. * tests/mv/dir-file: Likewise. * tests/mv/dir2dir: Likewise. * tests/mv/dup-source: Likewise. * tests/mv/hard-2: Likewise. * tests/mv/hard-3: Likewise. * tests/mv/hard-4: Likewise. * tests/mv/hard-link-1: Likewise. * tests/mv/hard-verbose: Likewise. * tests/mv/i-2: Likewise. * tests/mv/i-3: Likewise. * tests/mv/i-4: Likewise. * tests/mv/i-5: Likewise. * tests/mv/i-link-no: Likewise. * tests/mv/into-self-4: Likewise. * tests/mv/leak-fd: Likewise. * tests/mv/mv-special-1: Likewise. * tests/mv/no-target-dir: Likewise. * tests/mv/part-fail: Likewise. * tests/mv/part-hardlink: Likewise. * tests/mv/part-rename: Likewise. * tests/mv/part-symlink: Likewise. * tests/mv/partition-perm: Likewise. * tests/mv/perm-1: Likewise. * tests/mv/reply-no: Likewise. * tests/mv/trailing-slash: Likewise. * tests/mv/update: Likewise. * tests/od/od-N: Likewise. * tests/od/x8: Likewise. * tests/readlink/can-e: Likewise. * tests/readlink/can-f: Likewise. * tests/readlink/can-m: Likewise. * tests/readlink/rl-1: Likewise. * tests/rm/cycle: Likewise. * tests/rm/dangling-symlink: Likewise. * tests/rm/deep-1: Likewise. * tests/rm/dir-no-w: Likewise. * tests/rm/dir-nonrecur: Likewise. * tests/rm/dot-rel: Likewise. * tests/rm/empty-inacc: Likewise. * tests/rm/f-1: Likewise. * tests/rm/fail-2eperm: Likewise. * tests/rm/hash: Likewise. * tests/rm/i-1: Likewise. * tests/rm/i-no-r: Likewise. * tests/rm/ignorable: Likewise. * tests/rm/inaccessible: Likewise. * tests/rm/interactive-always: Likewise. * tests/rm/interactive-once: Likewise. * tests/rm/ir-1: Likewise. * tests/rm/isatty: Likewise. * tests/rm/no-give-up: Likewise. * tests/rm/r-1: Likewise. * tests/rm/r-2: Likewise. * tests/rm/r-3: Likewise. * tests/rm/r-4: Likewise. * tests/rm/readdir-bug: Likewise. * tests/rm/rm1: Likewise. * tests/rm/rm2: Likewise. * tests/rm/rm3: Likewise. * tests/rm/rm4: Likewise. * tests/rm/rm5: Likewise. * tests/rm/sunos-1: Likewise. * tests/rm/unread2: Likewise. * tests/rm/unread3: Likewise. * tests/rmdir/fail-perm: Likewise. * tests/rmdir/t-slash: Likewise. * tests/shred/exact: Likewise. * tests/shred/remove: Likewise. * tests/sum/sysv: Likewise. * tests/tail-2/append-only: Likewise. * tests/tail-2/assert: Likewise. * tests/tail-2/assert-2: Likewise. * tests/tail-2/big-4gb: Likewise. * tests/tail-2/fflush: Likewise. * tests/tail-2/infloop-1: Likewise. * tests/tail-2/proc-ksyms: Likewise. * tests/tail-2/start-middle: Likewise. * tests/tail-2/tail-n0f: Likewise. * tests/tee/basic: Likewise. * tests/tee/dash: Likewise. * tests/touch/fail-diag: Likewise. * tests/touch/no-create-missing: Likewise. * tests/touch/not-owner: Likewise. * tests/touch/obsolescent: Likewise. * tests/touch/read-only: Likewise. * tests/touch/relative: Likewise.
Diffstat (limited to 'tests/rm')
-rwxr-xr-xtests/rm/cycle4
-rwxr-xr-xtests/rm/dangling-symlink4
-rwxr-xr-xtests/rm/deep-12
-rwxr-xr-xtests/rm/dir-no-w4
-rwxr-xr-xtests/rm/dir-nonrecur4
-rwxr-xr-xtests/rm/dot-rel4
-rwxr-xr-xtests/rm/empty-inacc2
-rwxr-xr-xtests/rm/f-14
-rwxr-xr-xtests/rm/fail-2eperm4
-rwxr-xr-xtests/rm/hash4
-rwxr-xr-xtests/rm/i-12
-rwxr-xr-xtests/rm/i-no-r4
-rwxr-xr-xtests/rm/ignorable2
-rwxr-xr-xtests/rm/inaccessible8
-rwxr-xr-xtests/rm/interactive-always2
-rwxr-xr-xtests/rm/interactive-once2
-rwxr-xr-xtests/rm/ir-12
-rwxr-xr-xtests/rm/isatty4
-rwxr-xr-xtests/rm/no-give-up6
-rwxr-xr-xtests/rm/r-12
-rwxr-xr-xtests/rm/r-22
-rwxr-xr-xtests/rm/r-36
-rwxr-xr-xtests/rm/r-44
-rwxr-xr-xtests/rm/readdir-bug2
-rwxr-xr-xtests/rm/rm14
-rwxr-xr-xtests/rm/rm22
-rwxr-xr-xtests/rm/rm34
-rwxr-xr-xtests/rm/rm44
-rwxr-xr-xtests/rm/rm54
-rwxr-xr-xtests/rm/sunos-14
-rwxr-xr-xtests/rm/unread24
-rwxr-xr-xtests/rm/unread316
32 files changed, 63 insertions, 63 deletions
diff --git a/tests/rm/cycle b/tests/rm/cycle
index f77f90df9..22936ee00 100755
--- a/tests/rm/cycle
+++ b/tests/rm/cycle
@@ -1,7 +1,7 @@
#!/bin/sh
# rm (coreutils-4.5.4) could be tricked into mistakenly reporting a cycle.
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/dangling-symlink b/tests/rm/dangling-symlink
index 388ca1d07..17794e0d1 100755
--- a/tests/rm/dangling-symlink
+++ b/tests/rm/dangling-symlink
@@ -4,7 +4,7 @@
# But for fileutils-4.1.9, it would do the former and
# for fileutils-4.1.10 the latter.
-# Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/deep-1 b/tests/rm/deep-1
index b5ae89754..41928862b 100755
--- a/tests/rm/deep-1
+++ b/tests/rm/deep-1
@@ -33,7 +33,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
umask 022
diff --git a/tests/rm/dir-no-w b/tests/rm/dir-no-w
index 6dd04aa3e..27aba6aa9 100755
--- a/tests/rm/dir-no-w
+++ b/tests/rm/dir-no-w
@@ -2,7 +2,7 @@
# rm (without -r) must give a diagnostic for any directory.
# It must not prompt, even if that directory is unwritable.
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/dir-nonrecur b/tests/rm/dir-nonrecur
index fd10ba936..5b09821c0 100755
--- a/tests/rm/dir-nonrecur
+++ b/tests/rm/dir-nonrecur
@@ -2,7 +2,7 @@
# Ensure that `rm dir' (i.e., without --recursive) gives a reasonable
# diagnostic when failing.
-# Copyright (C) 2005 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/dot-rel b/tests/rm/dot-rel
index 41bea4aaa..2ffa49e4f 100755
--- a/tests/rm/dot-rel
+++ b/tests/rm/dot-rel
@@ -2,7 +2,7 @@
# Use rm -r to remove two non-empty dot-relative directories.
# This would have failed between 2004-10-18 and 2004-10-21.
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/empty-inacc b/tests/rm/empty-inacc
index 5db86ad42..bc040689d 100755
--- a/tests/rm/empty-inacc
+++ b/tests/rm/empty-inacc
@@ -27,7 +27,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/f-1 b/tests/rm/f-1
index bdd41d7ec..33041a350 100755
--- a/tests/rm/f-1
+++ b/tests/rm/f-1
@@ -1,7 +1,7 @@
#!/bin/sh
# Test "rm -f" with a nonexistent file.
-# Copyright (C) 1997, 2002, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
test_failure=0
diff --git a/tests/rm/fail-2eperm b/tests/rm/fail-2eperm
index d53747374..076195034 100755
--- a/tests/rm/fail-2eperm
+++ b/tests/rm/fail-2eperm
@@ -2,7 +2,7 @@
# Like fail-eperm, but the failure must be for a file encountered
# while trying to remove the containing directory with the sticky bit set.
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/hash b/tests/rm/hash
index a07a2b1d0..036240c8c 100755
--- a/tests/rm/hash
+++ b/tests/rm/hash
@@ -3,7 +3,7 @@
# Before then, rm would fail occasionally, sometimes via
# a failed assertion, others with a seg fault.
-# Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 || exit $?; exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 || exit $?; exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/i-1 b/tests/rm/i-1
index 0e606a2ab..214292bc4 100755
--- a/tests/rm/i-1
+++ b/tests/rm/i-1
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
test_failure=0
diff --git a/tests/rm/i-no-r b/tests/rm/i-no-r
index c0a0a8104..b23ff5e62 100755
--- a/tests/rm/i-no-r
+++ b/tests/rm/i-no-r
@@ -3,7 +3,7 @@
# recurse into directory DIR. rm -i (without -r) must fail in that case.
# Fixed in coreutils-4.5.2.
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/ignorable b/tests/rm/ignorable
index 7c2b2ba9a..6036dd945 100755
--- a/tests/rm/ignorable
+++ b/tests/rm/ignorable
@@ -27,7 +27,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/inaccessible b/tests/rm/inaccessible
index 08c5e3245..721210a2a 100755
--- a/tests/rm/inaccessible
+++ b/tests/rm/inaccessible
@@ -39,7 +39,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
@@ -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/interactive-always b/tests/rm/interactive-always
index 6dc623161..7b8166484 100755
--- a/tests/rm/interactive-always
+++ b/tests/rm/interactive-always
@@ -29,7 +29,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/interactive-once b/tests/rm/interactive-once
index 9643eff90..9325e8e70 100755
--- a/tests/rm/interactive-once
+++ b/tests/rm/interactive-once
@@ -29,7 +29,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/ir-1 b/tests/rm/ir-1
index 4a84ecdf0..71f142004 100755
--- a/tests/rm/ir-1
+++ b/tests/rm/ir-1
@@ -28,7 +28,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
test_failure=0
diff --git a/tests/rm/isatty b/tests/rm/isatty
index 488788a5e..202dc0195 100755
--- a/tests/rm/isatty
+++ b/tests/rm/isatty
@@ -1,7 +1,7 @@
#!/bin/sh
# Make sure `chown 0 f; rm f' prompts before removing f.
-# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
# This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/no-give-up b/tests/rm/no-give-up
index cabfc8840..b85132bdb 100755
--- a/tests/rm/no-give-up
+++ b/tests/rm/no-give-up
@@ -2,7 +2,7 @@
# With rm from coreutils-5.2.1 and earlier, `rm -r' would mistakenly
# give up too early under some conditions.
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
@@ -47,7 +47,7 @@ fi
fail=0
# This must fail, since `.' is not writable by $NON_ROOT_USERNAME.
-setuidgid $NON_ROOT_USERNAME env PATH=$PATH rm -rf d 2>/dev/null && fail=1
+setuidgid $NON_ROOT_USERNAME env PATH="$PATH" rm -rf d 2>/dev/null && fail=1
# d must remain.
test -d d || fail=1
diff --git a/tests/rm/r-1 b/tests/rm/r-1
index 6c03454c2..7b6f187fd 100755
--- a/tests/rm/r-1
+++ b/tests/rm/r-1
@@ -30,7 +30,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/r-2 b/tests/rm/r-2
index 5064413f6..68e61874e 100755
--- a/tests/rm/r-2
+++ b/tests/rm/r-2
@@ -28,7 +28,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 || exit $?; exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 || exit $?; exit $status' 0
trap 'exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/r-3 b/tests/rm/r-3
index 0bd6c4f85..0d85f64d9 100755
--- a/tests/rm/r-3
+++ b/tests/rm/r-3
@@ -1,7 +1,7 @@
#!/bin/sh
# Create and remove a directory with more than 254 files.
-# Copyright (C) 1997, 2001, 2002, 2003, 2004 Free Software Foundation,
+# Copyright (C) 1997, 2001, 2002, 2003, 2004, 2006 Free Software Foundation,
# Inc.
# This program is free software; you can redistribute it and/or modify
@@ -33,7 +33,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_fail=0
@@ -51,7 +51,7 @@ done
test -f 0a || framework_fail=1
test -f by || framework_fail=1
-cd $pwd || framework_fail=1
+cd "$pwd" || framework_fail=1
if test $framework_fail = 1; then
echo 'failure in testing framework'
diff --git a/tests/rm/r-4 b/tests/rm/r-4
index 087e16e9c..355133598 100755
--- a/tests/rm/r-4
+++ b/tests/rm/r-4
@@ -26,7 +26,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
@@ -34,7 +34,7 @@ mkdir -p $tmp || framework_failure=1
cd $tmp || framework_failure=1
touch a || framework_failure=1
-cd $pwd || framework_failure=1
+cd "$pwd" || framework_failure=1
if test $framework_failure = 1; then
echo 'failure in testing framework'
diff --git a/tests/rm/readdir-bug b/tests/rm/readdir-bug
index 7298c3868..a82aa955e 100755
--- a/tests/rm/readdir-bug
+++ b/tests/rm/readdir-bug
@@ -26,7 +26,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/rm1 b/tests/rm/rm1
index 3a73b0a35..8987cd2d5 100755
--- a/tests/rm/rm1
+++ b/tests/rm/rm1
@@ -1,7 +1,7 @@
#!/bin/sh
# exercise another small part of remove.c
-# Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/rm2 b/tests/rm/rm2
index 7fd5c1716..c64a9f352 100755
--- a/tests/rm/rm2
+++ b/tests/rm/rm2
@@ -30,7 +30,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/rm3 b/tests/rm/rm3
index a4c7b68d7..b3caf49ea 100755
--- a/tests/rm/rm3
+++ b/tests/rm/rm3
@@ -1,7 +1,7 @@
#!/bin/sh
# exercise another small part of remove.c
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/rm4 b/tests/rm/rm4
index 434ab2d8d..944aaec38 100755
--- a/tests/rm/rm4
+++ b/tests/rm/rm4
@@ -1,7 +1,7 @@
#!/bin/sh
# ensure that `rm dir' fails without --recursive
-# Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/rm5 b/tests/rm/rm5
index a08f93f13..297d02afc 100755
--- a/tests/rm/rm5
+++ b/tests/rm/rm5
@@ -1,7 +1,7 @@
#!/bin/sh
# a basic test of rm -ri
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/sunos-1 b/tests/rm/sunos-1
index abee7a18c..1f6a09cd3 100755
--- a/tests/rm/sunos-1
+++ b/tests/rm/sunos-1
@@ -1,7 +1,7 @@
#!/bin/sh
# Make sure that rm -r '' fails.
-# Copyright (C) 1997, 1998, 2002, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 2002, 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ fi
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/unread2 b/tests/rm/unread2
index 403a89198..e67c9ae38 100755
--- a/tests/rm/unread2
+++ b/tests/rm/unread2
@@ -1,7 +1,7 @@
#!/bin/sh
# exercise one small part of remove.c
-# Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
framework_failure=0
diff --git a/tests/rm/unread3 b/tests/rm/unread3
index 3d359a770..c8af5cfe7 100755
--- a/tests/rm/unread3
+++ b/tests/rm/unread3
@@ -1,7 +1,7 @@
#!/bin/sh
# Ensure that rm works even from an unreadable working directory.
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
+trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
framework_failure=0
@@ -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