Hard links to directories: why not?

Maarten Litmaath maart at cs.vu.nl
Tue Jul 31 06:32:40 AEST 1990


In article <1990Jul30.153949.28122 at dg-rtp.dg.com>,
	goudreau at larrybud.rtp.dg.com (Bob Goudreau) writes:
)...
)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.

There's hardly a difference; things really get nice if quotas are enabled...

)That is the behavior I find objectionable.

Indeed.  Perhaps another file attribute could be of service here:
permission to make a hard link.  Or get rid of hard links altogether and
use symlinks instead.
--
 "and with a sudden plop it lands on usenet.  what is it? omigosh, it must[...]
   be a new user! quick kill it before it multiplies!"      (Loren J. Miller)



More information about the Comp.unix.wizards mailing list