On 10/20/11 12:57, Eric Blake wrote: > That's because it's a shall fail, not a may fail error: > > [EBUSY] > 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".