summaryrefslogtreecommitdiff
path: root/tests/rm
diff options
context:
space:
mode:
authorBob Proulx <bob@proulx.com>2008-02-25 20:38:23 +0100
committerJim Meyering <meyering@redhat.com>2008-02-25 21:03:53 +0100
commitfcdf32c1594cd0f9f525f39fb5340130877ba14d (patch)
tree72f093a504308668b2401aaa93e9f0c52229e30f /tests/rm
parent9396e9104e9965b9608a3652c18d7c2d94ea3351 (diff)
downloadcoreutils-fcdf32c1594cd0f9f525f39fb5340130877ba14d.tar.xz
Fix test failure where rm would appear to succeed incorrectly.
* tests/rm/fail-eperm: Ignore files that were opportunistically chosen to test permission failures but disappear before we can finish the test.
Diffstat (limited to 'tests/rm')
-rwxr-xr-xtests/rm/fail-eperm11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm
index 5fa54b097..e9e2108ec 100755
--- a/tests/rm/fail-eperm
+++ b/tests/rm/fail-eperm
@@ -96,6 +96,17 @@ foreach my $dir (@dir_list)
close RM;
my $rc = $?;
+ # This test opportunistically looks for files that can't
+ # be removed but those files may already have been removed
+ # by their owners by the time we get to them. It is a
+ # race condition. If so then the rm is successful and our
+ # test is thwarted. Detect this case and ignore.
+ if ($rc == 0)
+ {
+ next if ! -e $target_file;
+ die "$ME: unexpected exit status from `$cmd';\n"
+ . " got 0, expected 1\n";
+ }
if (0x80 < $rc)
{
my $status = $rc >> 8;