Re: rmdir of one's pwd

Alexander Viro (viro@math.psu.edu)
Mon, 15 Feb 1999 09:47:47 -0500 (EST)


On Mon, 15 Feb 1999 Andries.Brouwer@cwi.nl wrote:

> Alexander Viro <viro@math.psu.edu> writes:
>
> : ... and SUS2 doesn't mention names ending with "." as a possible reason
> : for failure. Weird. Anyway, I think that (a) no matter which policy we
> : will take it should be done in VFS (*not* in filesystems - see your
> : example with lofs) and (b) we may need a generic mechanism for dealing
> : with such stuff.
> : What about adding a boolean vector to the struct task and adding a
> : new syscall:
> : int POSIX_lossage(...)
>
> I do not understand why you insist on uglifying Linux.

I don't. Sorry, it was *not* intended to be a troll. Let me
explain why I think that such mechanism might be useful. There are
several, erm, strange things. Example: link("foo","bar");rename("foo","bar");
leaving both links. As far as I can understand it's an artefact of
inaccurate wording (rename("foo","foo"); *should* leave the link intact,
indeed). Another one: discrepancies in rmdir() implementations (reshuffled
in this thread). Yet another one: effect of chown() on s[ug]id (even
chown(-1,-1) removes both and it's intended to be no-op). Another one
(albeit it's more of Linux problem): rename over the busy directory.
Technically we violate SUS2 returning -EBUSY. Differences between the
conditions when rmdir() and rename() over the directory are allowed.
I'm sure that you can continue this list with *much* more examples than I
ever met. I've spent some time cleaning up the stuff in filesystems
and at least making it consistent (see changes in 2.1.<late>), so I don't
think that "uglifying Linux" comment is deserved. What I really want is
(a) taking fs-independant permissions stuff into VFS instead of spreading
it over each fs in existance and (b) some mechanism that would allow
preserving bugwarts compatibility for those who depend on bugs *without*
screwing in process everybody else.

Obrename(): could you comment on Linux rename(2) manpage? Quote:

EEXIST The new pathname contained a path prefix of the
old.

EINVAL An attempt was made to make a directory a subdi­
rectory of itself.

How do those cases differ? Notice that while the first case is formally
broader (non-directories) the remaining part is covered by ENOTDIR case (a
component used as a directory in newpath is not, in fact, a directory).
UMSDOS driver does definitely wrong thing - it returns EEXIST on the
second case. Either EEXIST case is bogus or I (and everybody else)
completely misparsed it. There is no cases when rename() would return
EEXIST due to any tests involving both names (except the UMSDOS one, that
is). AFAIK you are the maintainer of manpages. Could you clarify the
situation with this one?

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