mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-03-06 13:05:04 +02:00
This test might remove a file owned by the person running `make check'.
Hoist definition of $target_file, and use that (not $f) in test for owner/dir/symlink. Patch by Michael Stone.
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user