GNU bug report logs -
#9813
rm -rf calls rmdir() prior to close(), which can fail
Previous Next
Reported by: Eric Blake <eblake <at> redhat.com>
Date: Thu, 20 Oct 2011 17:41:01 UTC
Severity: normal
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 9813 <at> debbugs.gnu.org (full text, mbox):
On 10/20/2011 06:06 PM, Eric Blake wrote:
> Try the same exercise using NFSv2 or NFSv3 mounts (NFSv4 is getting
> closer to POSIX compliance, but I don't know if it will handle this any
> better). I suspect that it would be possible to find a testcase under
> Linux and Solaris clients using a less-than-stellar remote NFS server
> that reproduces this issue, at least on any setup where you would also
> see a failure in unlink()ing a regular file with open fds (rmdir() a
> directory with open handles is conceptually no different than unlink()).
Also, notice that the POSIX requirement on unlink() is that ETXTBSY is a
may fail (a file is currently being executed by some other process), but
that EBUSY is a shall fail, with the same wording as for rmdir(), namely:
[EBUSY]
The file named by the path argument cannot be unlinked because it is
being used by the system or another process and the implementation
considers this an error.
This "shall fail" EBUSY is _how_ NFS justifies their behavior of failing
to unlink files with open fds, even though I agree with you that it
flies in the face of traditional Unix semantics, and explains why many
GNU programs have already made efforts to ensure that all fds to a file
are closed before attempting unlink/rmdir.
--
Eric Blake eblake <at> redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
This bug report was last modified 13 years and 298 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.