]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
This test might remove a file owned by the person running `make check'.
authorJim Meyering <jim@meyering.net>
Mon, 22 Jul 2002 08:12:27 +0000 (08:12 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 22 Jul 2002 08:12:27 +0000 (08:12 +0000)
Hoist definition of $target_file, and use
that (not $f) in test for owner/dir/symlink.  Patch by Michael Stone.

tests/rm/fail-eperm

index a5eb4c18a4ae5bf2760eccac3882826812e61a52..6d5f14c72c3b4ad5d4eaac0a5587817d71b594b9 100755 (executable)
@@ -52,16 +52,17 @@ foreach my $dir (@dir_list)
 
        foreach my $f (readdir DIR_HANDLE)
          {
+           my $target_file = "$dir/$f";
+
            # Skip files owned by self, symlinks, and directories.
            # It's not technically necessary to skip symlinks, but it's simpler.
-           -l $f || -o _ || -d _
+           -l $target_file || -o _ || -d _
              and next;
 
            $found_file = 1;
 
            # Invoke rm on this file and ensure that we get the
            # expected exit code and diagnostic.
-           my $target_file = "$dir/$f";
            my $cmd = "rm -f $target_file";
            open RM, "$cmd 2>&1 |"
              or die "$ME: cannot execute `$cmd'\n";