Re: rmdir(".") works, and causes havoc

Linus Torvalds (
7 Aug 1997 03:54:17 GMT

In article <>,
Darin Johnson <> wrote:
>John Kodis writes:
> > On Mon, Aug 04, 1997 at 09:23:24AM -0700, Linus Torvalds wrote:
> > > Sad, because it _could_ be potentially useful, it's just not allowed in
> > > POSIX.
> >
> > You could follow the precident set by the FSF. Allow the new enhanced
> > behavior by default, but provide a switch,
> > To force the POSIX-mandated brain-damage.
>POSIX is not necessarily brain damaged here.

Indeed. There are good historical reasons why a pathname for any of the
functions that crated or deleted new files couldn't end with '.' or
'..'. It just happens that the new Linux dcache doesn't have those
restrictions which I consider to be a good thing, but with just about
any other implementation I can think of the supposed POSIX restriction
actually makes perfect sense.

Note the "supposed": I've been poring over my POSIX papers, and I wasn't
actually able to find any place that really forbids 'rmdir(".")' from
working. So it is entirely possible that the current Linux behaviour is
actually permissible.

Until it can be shown otherwise, I'm going to assume that the new Linux
feature is perfectly ok, and as it actually makes sense and is a very
logical thing to do I'm just going to leave it as is. The other
problems outlined in the original mail that caused this thread are real
bugs, though, and will be fixed (most of them are already fixed in

I'd also like to mention that while I consider the POSIX 'size_t' thing
with socket names to be horribly braindamaged, on the whole my only
major gripe with POSIX has been that it has specified too little rather
than too much, and most of the POSIX specifications are good. And it
seems that even the 'size_t' thing has been fixed.