removing hard linked directories

Rob McMahon cudcv at warwick.ac.uk
Tue Mar 26 03:19:32 AEST 1991


In article <1991Mar21.025311.9821 at nmt.edu> rmilner at zia.aoc.nrao.edu (Ruth
Milner) writes: 
>In article <1991Mar20.115508.25638 at athena.mit.edu> jik at athena.mit.edu
(Jonathan I. Kamens) writes:
>>the problem you are having is just one of the many reasons why the man pages
>>for ln(1) and link(2) say that you shouldn't create hard links to
>>directories.
>
>So would somebody please tell me why "mv" will do this?

For a long time SunOS had a bug where if you had a sticky /tmp directory, and
you tried to move someone else's directory, rename() would create a new link
to the directory, try to unlink the old one, fail, try to unlink the new one,
and fail.  Then I'd come along as super-user and try to /etc/unlink the new
version, and it would fail.  The only way out was to halt the machine and do a
manual fsck (the automatic fsck would just let it pass as you say).

I complained to Sun that a) rename() shouldn't leave these extraneous links
around and b) unlink should allow them to be removed even if they did, but the
people I talked to at Sun seemed to think this was a feature, which would not
be fixed.  Meanwhile we've gone to SunOS 4.1{,.1}, and I don't know if the
problem still exists, it's too much of a pain to try it out.

No doubt next term we'll get a new batch of these fun links called "Freddy
you're a bozo" which seem to amuse some of the undergraduates, and I'll be
complaining to Sun again.

Cheers,

Rob
-- 
UUCP:   ...!mcsun!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv at uk.ac.warwick             INET:   cudcv at warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England



More information about the Comp.unix.questions mailing list