Well in Solaris e.g. it isn't -EBUSY either. Have a look at the trace:
rmdir(".") Err#22 EINVAL
^^^^^^
rmdirwrite(2, " r m d i r", 5) = 5
: directory "write(2, " : d i r e c t o r y ".., 13) = 13
.": write(2, " . " : ", 4) = 4
Can't remove current directory or ..write(2, " C a n ' t r e m o v
e".., 36) = 36
write(2, "\n", 1) = 1
lseek(0, 0, SEEK_CUR) = 9628
_exit(2)
So perhaps this isn't POSIX (I don't really know POSIX that much), but I
think this is the correct behaviour. You normally don't cut the tree you
are sitting on.
So IMHO you may discuss the error-code, but it really should be a error,
as this is so in (as I think) all OSs. (Even in SunOS 4.x a BSD-Unix it
returned an Error.)
But rmdir really works (under Solaris) if you do the following:
mkdir x
cd x
cmdtool & # or any other process, but with the working directory on x
cd ..
rmdir x
So it is in fact only a problem if the process invoking the rmdir is in
the direcory which should be removed.
BTW: If you do a pwd in the new cmdtool you get a "Cannot determine
current working directory". So it really is in the removed directory.
Bye
Martin
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/