Deleting the current directory, V2.1.54

Richard B. Johnson (
Thu, 11 Sep 1997 21:42:58 -0400 (EDT)


If a directory is empty, it is now possible to remove the default

'pwd' shows that the default directory is still the directory that
was removed.

Attempts to write into the directory that was removed, will fail with
"Operation not permitted".

If the entire path-name is used, it is possible to make a new directory
with the same name as the one just removed.

Attempts to write into the newly created directory, will fail with
"Operation not permitted".

However, if the entire path name is used, it is possible to write into
the new directory. The file exists and can be manipulated if its entire
path-name is used. It does not seem to exist if accessed from the default

If the default directory is changed, then changed back to the newly created
one, the subsequent file operations are normal.

If the default directory is not changed, but instead is reset, i.e.,
'cd /complete/path/name', file operations are again normal.

I have looked in the old AT&T Unix reference manual and cannot find
any prohibition against removing the default directory, however my
Sun doesn't allow such an operation. Sun's rmdir responds with
"Can't remove . or ..".

If this new behavior is okay, it could result in some problems for
new-bee Linux users. They could get "lost" as programs running in
certain default directories could have their file operations fail
for no apparent reason as some other task removed that directory
and then recreated it.

This needs some serious thought. Perhaps if cwd opened "." as
part of the operation.... I donno... I just test this stuff.

Richard B. Johnson
Analogic Corporation
Penguin : Linux version 2.1.54 on an i586 machine (66.15 BogoMips).
Warning : It's hard to stay on the trailing edge of technology.
Linux : Engineering tool
Windows : Child's computer interface written in BASIC.
Win-NT : Child's computer interface rewritten in C.