coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coreutils] [PATCH] tests: cleanup rm -rf fails under NFS


From: Paul Eggert
Subject: [coreutils] [PATCH] tests: cleanup rm -rf fails under NFS
Date: Fri, 03 Dec 2010 11:10:34 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10

(I pushed this.)

This problem was observed on RHEL 5.5 x86-64 when running as a
client of a NetApp FAS2050.
* tests/cp/cp-mv-backup: Don't leave a file descriptor open to
a file in a directory that will be cleaned up with "rm -rf".
Under NFS, when the rm unlinks that file, it is instead renamed
to .nfsXXXX and then rm cannot remove the parent directory,
and the test fails.
* tests/cp/same-file: Likewise.
---
 tests/cp/cp-mv-backup |    4 +++-
 tests/cp/same-file    |    3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/cp/cp-mv-backup b/tests/cp/cp-mv-backup
index d775685..a1b2efe 100755
--- a/tests/cp/cp-mv-backup
+++ b/tests/cp/cp-mv-backup
@@ -28,7 +28,7 @@ umask 022
 actual=actual
 expected=expected
 
-exec 1> $actual
+exec 3>&1 1> $actual
 
 for prog in cp mv; do
   for initial_files in 'x' 'x y' 'x y y~' 'x y y.~1~' 'x y y~ y.~1~'; do
@@ -85,6 +85,8 @@ EOF
 
 sed 's/: x/:/' $expected-tmp |cat $expected-tmp - > $expected
 
+exec 1>&3 3>&-
+
 compare $expected $actual || fail=1
 
 Exit $fail
diff --git a/tests/cp/same-file b/tests/cp/same-file
index 873ac2d..7a8fe68 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -42,7 +42,7 @@ test $hard_link_to_symlink_does_the_deref = yes \
 actual=actual-$$
 expected=expected-$$
 
-exec 1> $actual
+exec 3>&1 1> $actual
 
 # FIXME: This should be bigger: like more than 8k
 contents=XYZ
@@ -216,6 +216,7 @@ cat <<\EOF | sed "$remove_these_sed" > $expected
 
 EOF
 
+exec 1>&3 3>&-
 
 compare $expected $actual 1>&2 || fail=1
 
-- 
1.7.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]