Path: utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!alice!andrew From: andrew@alice.UUCP (Andrew Hume) Newsgroups: comp.unix.wizards Subject: Re: Hard links to directories: why not? Summary: que? Message-ID: <11110@alice.UUCP> Date: 31 Jul 90 04:53:20 GMT References: <5222@milton.u.washington.edu> <6940@eos.UUCP> <1990Jul30.153949.28122@dg-rtp.dg.com> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 27 In article <1990Jul30.153949.28122@dg-rtp.dg.com>, goudreau@larrybud.rtp.dg.com (Bob Goudreau) writes: ~ Here's an example of the problem: ~ ~ 1) I create a subdirectory named "sub". ~ ~ 2) Unbeknownst to be me, Joe Schmo creates a hard link of his own ~ to "sub". ~ ~ 3) I try to rmdir "sub", which is empty, and find that I cannot, ~ because its link count is > 2. ~ ~ 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.