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

Ralf Corsepius (corsepiu@faw.uni-ulm.de)
Sat, 13 Feb 1999 02:57:47 +0100


Linus Torvalds wrote:

> Show me POSIX or other standards that say that you can't do it, and I
> guess I have to work around a standards problem, but right now I say that
> if programs ask for 'rmdir(".")', then they had better get it. I don't
> think the OS should second-guess anybody.

I don't know about a formal standard, either.

Nevertheless, in my initial post, I wasn't talking about rmdir (2), I was
talking about rmdir(1)'s behaviour on linux-2.[12].x breaking gcc/fixincludes
for building cross-compilers.

The cause of this problem is the fragment from gcc/fixincludes below:

> echo 'Removing unneeded directories:'
> cd $LIB
> files=`find . -type d -print | sort -r`
> for file in $files; do
> rmdir $LIB/$file > /dev/null 2>&1
> done

This fragment relies on rmdir(1) failing when $file contains "."- So the actual
problem is gcc/fixincludes requiring "rmdir $LIB/." to fail (Of cause this can
easily be worked around by modifying fixincludes, but is a different topic).

AFAIS, this fragment is present in all gcc-releases I have handy right now:
gcc-1.42 (Sep. 91), gcc-2.3.1 (Oct. 92), gcc-2.7.2.3, egcs-1.1b, egcs-1.1.1 and
egcs updated from cvs a few hours ago.

IMO, this is indicates that this fragment must have worked on all (most?) hosts
which have been supported by gcc (BTW, it did on linux-2.0.x) and which have
been used as hosts for cross-compilation.

Given this assumption is true and considering that fixincludes doesn't work
anymore for cross-compiling on linux-2.[12].x, because of rmdir(1)'s
behavioural difference, this might also indicate that all (most?) platforms but
linux-2.[12].X issue an error/warning on "rmdir ." (de-facto standard?).

Regards,
Ralf

--
Ralf Corsepius
Forschungsinstitut fuer Anwendungsorientierte Wissensverarbeitung (FAW)
Helmholtzstr. 16, 89081 Ulm, Germany     Tel: +49/731/501-8690
mailto:corsepiu@faw.uni-ulm.de           FAX: +49/731/501-999
http://www.faw.uni-ulm.de

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