tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: zero-length symlinks



>> On Unix System V, the link command would allow hard-linking
>> directories when used as root.

Also, recently enough that at least some versions of NetBSD do it,
unlink(2) performed by root on the last non-. link to a directory would
silently orphan the directory, requiring fsck to fix.

I've long thought this deserved to be considered a bug.

> The reason being that hard links to directories means that the tree
> of directories is no longer a DAG and that causes serious problems
> for the tree traversing code.

Well, might no longer be a DAG.  I don't see why this couldn't be
checked at link(2) time; it's checked within rename(2).

I think a more-likely-relevant reason is that there's only one place ..
can point, at least unless you allow multiple .. entries in the
directory (which would fix this but open a different can of worms).

Come to think of it, that could be relevant; if a directory can have
multiple parents, walking parents until you get to the root becomes a
much less obviously possible thing to do.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                mouse%rodents-montreal.org@localhost
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index