Re: `rmdir .` doesn't work in 2.4

Andrea Arcangeli
2001-01-08T22:37:33Z

On Mon, Jan 08, 2001 at 03:11:08PM -0700, Benson Chow wrote:
> Not very portable at all...
>
> hpux = HP/UX 10.2
>
> hpux:~$ mkdir foo
> hpux:~$ cd foo
> hpux:~/foo$ rmdir "`pwd`"
> rmdir: /home/blc/foo: Cannot remove mountable directory
> hpux:~/foo$ rmdir .
> rmdir: cannot remove .. or .
> hpux:~/foo$ rmdir /home/blc/foo
> rmdir: /home/blc/foo: Cannot remove mountable directory
> hpux:~/foo$ rmdir ./
> rmdir: ./: Cannot remove mountable directory
> hpux:~/foo$
>
> Maybe HP/UX is messed up as well.

It seems not to return -EBUSY. As also mentioned by Andries:

If the directory is the root directory or the current working directory
of any process, it is unspecified whether the function succeeds, or
whether it fails and sets errno to [EBUSY].

The portable way is the one I mentioned as possible change for my code:

os.chdir("..")
shutil.rmtree(binutils_build)

Andrea