[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9813: rm -rf calls rmdir() prior to close(), which can fail

From: Paul Eggert
Subject: bug#9813: rm -rf calls rmdir() prior to close(), which can fail
Date: Thu, 20 Oct 2011 16:46:05 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110928 Fedora/3.1.15-1.fc14 Thunderbird/3.1.15

On 10/20/11 12:57, Eric Blake wrote:
> That's because it's a shall fail, not a may fail error:
> The directory to be removed is currently in use by the system
> or some process and the implementation considers this to be an error.

But "in use by" does not mean "accessed by an open
file descriptor owned by".  It means that the directory
is mounted, or is the working directory of a process,
or is the root directory.  The interpretation of "in use by"
to mean "tied down by a file descriptor"
flies in the face of the plain meaning of the earlier part
of the text, which talks about what happens when one invokes
rmdir() on a directory that has an open file descriptor.

If we allow the phrase "in use by" to mean whatever the
operating system wants it to mean, then an operating system
where rmdir() always fails with errno==EBUSY would conform
to POSIX, because the O.S. could always say that the directory
is "in use by" the rmdir() call itself.  That's not what was
intended here.

> It's more than just cygwin.

So far, I've seen only Cygwin mentioned.
Where does it happen in a typical GNUish environment?

This isn't just a coreutils issue: I expect that it'll occur
many programs that do the equivalent of "rm -fr".

reply via email to

[Prev in Thread] Current Thread [Next in Thread]