Description of problem:
The rm program calls access() on the target file before calling
unlink() on it. This is unnecessary (unlink should tell you
everything you need to know), and may hang rm (it may be a symlink
pointing to something on an unreachable NFS server).
Version-Release number of selected component (if applicable):
coreutils-5.2.1-7 is what I've got installed, but it's not
restricted to that version.
Steps to Reproduce:
1. touch x
2. rm x
1. Mount a directory off an NFS server without any special options
(so no -ointr, for example)
2. Make a symlink from somewhere outside that mountpoint to
somewhere inside that mountpoint.
3. Power off the NFS server
4. Try and rm the symlink.
rm hangs as it tries to run access() on what the symlink points to.
If rm is traced, this can be observed:
access("x", W_OK) = 0
unlink("x") = 0
rm should just delete the symlink.
Please try coreutils-5.2.1-12, which has a patch from Jim Meyering for
Here's what Jim Meyering says about this patch by the way:
> Unfortunately, rm (without -f) must call access (via euidaccess) to
> determine whether it needs to issue a prompt. With this patch, rm now
> calls both lstat and access for each non-symlink it might unlink.
> Another good reason to use -f.
Okay. I think I see what this is getting at... you use access(W_OK)
to decide whether to issue a prompt or not.
BTW, I tried coreutils-5.2.1-12, and that seems to evade the problem
of dodgy symlinks by lstat'ing them first, which will do.