Re: [BUG] Inconsistent behaviour of rmdir

From: Linus Torvalds (torvalds@transmeta.com)
Date: Thu Nov 16 2000 - 10:49:26 EST


On Thu, 16 Nov 2000, Jean-Marc Saffroy wrote:
>
> As you see, it looks like the rmdir fails simply because the dir name ends
> with a dot !! This is confirmed by sys_rmdir in fs/namei.c, around line
> 1384 :
>
> switch(nd.last_type) {
> case LAST_DOTDOT:
> error = -ENOTEMPTY;
> goto exit1;
> case LAST_ROOT: case LAST_DOT:
> error = -EBUSY;
> goto exit1;
> }
>
> Should we rip off the offending "case LAST_DOT" ? Or do we need a smarter
> patch ? Is it really a problem that a process has its current directory
> deleted ? How about the root ?

The cwd is not the problem. The '.' is.

The reason for that check is that allowing "rmdir(".")" confuses a lot of
UNIX programs, because it wasn't traditionally allowed.

> The man page for rmdir(2) should be updated as well, the current one
> states :
> EBUSY pathname is the current working directory or root
> directory of some process.

That's definitely wrong. You can do

        rmdir `pwd`

and that's fine (not all filesystems will let you do that, but that's a
low-level filesystem issue). It's really only the special names "." and
".." that cannot be removed.

                Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Nov 23 2000 - 21:00:10 EST