removing hard linked directories

Bruce Varney asg at sage.cc.purdue.edu
Thu Mar 21 23:34:19 AEST 1991


In article <1991Mar21.100031.12027 at athena.mit.edu> jik at athena.mit.edu (Jonathan I. Kamens) writes:
}In article <1991Mar21.025311.9821 at nmt.edu>, rmilner at zia.aoc.nrao.edu (Ruth Milner) writes:
}|> Scenario: directory in /tmp belonging to someone else. I forget it isn't
}|> mine, come along (just me, not root) and mv it. Result: mv says "not
}|> owner", but by that time it has already created the new directory *and did
}|> not clean it up*. Not nice.
}
}  Sounds like you've got an odd version of mv.  Here's what happens on my
}(4.3BSD-like) system:
}
}  Staring at the source code for mv on my system, it appears that directories
}are moved using an atomic rename system call.  If your mv is behaving as
}you've described, then either (a) the rename system call in your kernel is
}brain-damaged, or (b) you've got a brain-damaged version of mv.

Some versions of UNIX do not have the rename() call. As such, to do a mv,
they implement a link(), then an unlink(). Here is what probably happened. 
The / directory was 1777. The mv command was successful up to the link(),
but then the unlink() failed because you did not own the directory, and the
sticky bit was left on. You were thus left with a hard link to the directory.

Johnathan, you must really quit being so condescending to people. 90% of
your responses include "this belongs in another newsgroup not this one"'s.
(although this particular article does not) Just because you think a 
certain topic is not appropriate does not mean others don't think it is.
And in fact, I just got done reading a 30+ line response from you that
had 29+ lines of "you could ftp to here for the FAQ, or mail to here, or
post to here, or do this" and only one line of help - talk about wasting
bandwidth!!!!!!

(Not that I am never guilty :-) )
}
}  What kind of machine and OS are you working on?
Probably SYSV. If I remember right SYSV does not have the rename() call.
}
}-- 
}Jonathan Kamens			              USnail:
						      ^^^^^^????
Get out your UShammers.

}MIT Project Athena				11 Ashford Terrace
}jik at Athena.MIT.EDU				Allston, MA  02134
}Office: 617-253-8085			      Home: 617-782-0710


		The Grand Master
---------
sar.casm \'sa:r-.kaz-*m\ \sa:r-'kas-tik\ \-ti-k(*-)le-\ n [F sarcasme, fr. 
   LL sarcasmos, fr. Gk sarkasmos, fr. sarkazein to tear flesh, bite the lips 
   in rage, sneer, fr. sark-, sarx flesh; akin to Av thwar*s to cut] 1: a 
   cutting, hostile, or contemptuous remark : GIBE 2: the use of caustic or 
   ironic language - sar.cas.tic aj

                                   ###             ##
Courtesy of Bruce Varney           ###               #
aka -> The Grand Master                               #
asg at sage.cc.purdue.edu             ###    #####       #
PUCC                               ###                #
;-)                                 #                #
;'>                                #               ##



More information about the Comp.unix.questions mailing list