Hard links to directories: why not?
Andrew Hume
andrew at alice.UUCP
Tue Jul 31 14:53:20 AEST 1990
In article <1990Jul30.153949.28122 at dg-rtp.dg.com>, goudreau at 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.
More information about the Comp.unix.wizards
mailing list