tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: zero-length symlinks
On Sun, Nov 03, 2013 at 07:48:54PM -0500, Mouse wrote:
> >> 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.
That is a bug, yes.
> > 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).
It is checked, at substantial expense and, historically, mostly
incorrectly. (Don't run concurrent renames on 1.4T; you can easily
corrupt the filesystem.)
The check also depends on the filesystem being a tree, so it's quite
likely that if you tried to implement this generalization that you'd
get into trouble.
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index