Hard links to directories: why not?

Bob Goudreau goudreau at larrybud.rtp.dg.com
Fri Aug 3 03:25:32 AEST 1990


In article <11110 at alice.UUCP>, andrew at alice.UUCP (Andrew Hume) writes:
>
> ~ So now I'm stuck with a subdirectory that I own that lives in a
> ~ directory that I can write, but I can't delete it!  All I know is how
> ~ many extra links to it exist -- and I have no way of finding out
> ~ *where* those links are.  Contrast this case to the deletion of an
> ~ ordinary file with many links, and you'll see the difference.  There's
> ~ nothing preventing me unlinking the file, yet there is for the
> ~ directory.
> ~ 
> ~ That is the behavior I find objectionable.
> 
> 
> 	if it were true, it would be a bummer. luckily, i couldn't
> find a system where the example failed. the unlink of sub will always
> work; and as the link count of sub/. is two, rmdir must stop there
> and not free up the space (inode). the end result is that joe's
> link to what was a dir called sub is the only one left; its all his
> fault now.

Hey, I wasn't saying this situation *was* true on any existing UNIX
systems -- I was describing my objections to Peter da Silva's proposed
implementation of directory hard links.  Peter's scheme would disallow
unlinking the "real" entry for a directory if the directory's link count
indicated that there were other (non-primary) hard links to it.  His
scheme would work, but only at the expense of opening the system up to
unpleasant situations like the one I described above.

------------------------------------------------------------------------
Bob Goudreau				+1 919 248 6231
Data General Corporation
62 Alexander Drive			goudreau at dg-rtp.dg.com
Research Triangle Park, NC  27709	...!mcnc!rti!xyzzy!goudreau
USA



More information about the Comp.unix.wizards mailing list