Re: rmdir of one's pwd (was Re: rmdir of a busy directory)

Alexander Viro (viro@math.psu.edu)
Fri, 12 Feb 1999 11:34:37 -0500 (EST)


> Just tested on SunOS 5.5.1:
>
> $ mkdir xx
> $ cd xx
> $ rmdir .
> rmdir: directory ".": Can't remove current directory or ..
> $ rmdir ../xx
> $ ls -a
> $ ls ../xx
> ../xx: No such file or directory
>
> Note that rmdir actually tries rmdir(".") first, and only then translates
> the error (EINVAL) to the appropriate message.

Script started on Fri Feb 12 11:24:01 1999
$ /bin/mkdir xx
$ cd xx
$ /bin/rmdir .
/bin/rmdir: directory ".": Can't remove current directory or ..
$ /bin/rmdir ../xx
/bin/rmdir: directory "../xx": Can't remove current directory or ..
$ uname -sr
SunOS 5.6
$ exit

script done on Fri Feb 12 11:24:51 1999

>From rmdir(2) manpage:

System Calls rmdir(2)
[snip]
EINVAL The directory to be removed is the
current directory.

EINVAL The final component of path is ``.''.
[snip]
SunOS 5.6 Last change: 28 Dec 1996 2

So it looks like *both* suspicious cases are prohibited. And notice that
it's rmdir(2), so it has nothing with possible rmdir(1) tricks.

-
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/