Re: Is this a bug or rather a feature?

Khimenko Victor (khim@sch57.msk.ru)
Sat, 18 Dec 1999 15:10:38 +0300 (MSK)


In <Pine.GSO.4.10.9912180323050.22643-100000@weyl.math.psu.edu> Alexander Viro (viro@math.psu.edu) wrote:

> On Sat, 18 Dec 1999 feiliu@aa.eps.jhu.edu wrote:

>>
>> # mkdir test
>> # touch 1;touch 2;touch 3
>> # mkdir hello
>> # cd hello
>> # rmdir ./
>> # ls
>> total 0
>> # cd ..
>> # mkdir hello
>> # cd hello
>> # rmdir ../
>> rmdir: ..: Directory not empty
>> # rm -rf ..
>> rm: cannot remove `.' or `..'
>> # rm -rf .
>> rm: cannot remove `.' or `..'
>>
>> comparing the behavior of "rm -rf" and "rmdir", they are not
>> very consistent.

> Really? How odd - they _had_ some reason for implementing rmdir.

It was NOT ability to do "rmdir ." for sure :-)

> Amazing, isn't it? And you know what? I've heard that "and" is not the same
> operation as "or"...

Hmm. Inconsistency started from linux kernel 2.2 :-) With linux kernel 2.0
"rmdir" and "rm -rf" were consistent: both were unable to remove `.' or `..'
In case of "rmdir" it was limitation of kernel while "rm -rf" had special
check (there was no need for special check in rmdir since rmdir will not do
anything destructive before trying to remove `.' or `..'). In linux kernel 2.2
you can remove `.' and/or `..' (you can remove `..' only when `..' is empty,
of course; this mean that `.' must be already removed :-) and now "rmdir" and
"rm -rf" behaviour are inconsistent. Since Linus said that it's Ok to rmdir(".")
now it's task for FSF to make "rmdir" and "rm -rf" consistent again (by removing
check from "rm -rf" or by adding it to "rmdir").

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