"rm -rf ./foo/" safe to use?

Eric Blake ebb9@byu.net
Sat Apr 29 22:49:00 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[thread TITTTL'd]

According to Ross, George - DOA on 4/26/2006 9:26 AM:
> A few years ago, I came across a "rm -rf" problem with NFSv2 and NFSv3 clients. NFS clients on Solaris 8 and 9, AIX 4.3, and the Hummingbird on Windows all had a problem with "rm -rf", against a certain NFS server. 
> 
> The problem was an NFS protocol implementation short-cut.  When reported, one of the vendors fixed the problem, others did not. 

And that bug is still in the wild.  The bug is that when you traverse a
directory with readdir(), while calling unlink() on the entries, that
buggy NFS servers quit at 256 files even if there are more in the
directory.  Hence, coreutils has a workaround that every 256 deleted
files, on platforms known to have buggy readdir(), rm must rewind the
directory to be sure that EVERYTHING got deleted (of course, the
workaround involves more syscalls, and is less efficient, so it is avoided
when possible).

But at least it happened to be the kind of bug you generally like (if
there is such a thing) - it misbehaved, but did not corrupt data; and you
could repeatedly run 'rm -rf' until everything finally DID disappear,
because each run successfully unlinked the next 256 entries.  It would
have been much worse if when deleting a requested file, NFS also deleted
unrequested files.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEU+1384KuGfSFAYARAjlhAJ9pNCyofBNTaVJFXwr6QRLM6lmf8gCfTBmH
ELwE5fZ6YW2BggjSm90XQKE=
=Rmms
-----END PGP SIGNATURE-----



More information about the Cygwin-talk mailing list