Newsgroups: comp.sys.amiga.programmer Path: utzoo!utgpu!watserv1!watdragon!rose.waterloo.edu!ccplumb From: ccplumb@rose.waterloo.edu (Colin Plumb) Subject: Re: Checking to see if a file's a link Message-ID: <1991Apr30.070121.24535@watdragon.waterloo.edu> Sender: news@watdragon.waterloo.edu (News Owner) Organization: University of Waterloo References: <15127@darkstar.ucsc.edu> Date: Tue, 30 Apr 1991 07:01:21 GMT Lines: 23 mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) wrote: > Last time I reported this bug, I was told that they were going to > "fix" the problem by having makelink not allow circular links. That > this implied searching the entire subtree beneath the link didn't seem > to bother the person who posted that fix. You have to do this on rename, anyway, to avoid the Ouroboros bug. (Under 1.3, on a scratch floppy, makedir foo; makedir foo/bar; rename foo foo/bar/foo; *Poof*.) Actually, to check for this, you don't search the entire subtree under the source; rather you check all parents of the destination. To check that a proposed link to foo: with name bar:foo isn't circular, check that bar:, bar:/, bar://, etc. are not the same as foo:. Given SameLock(), it's trivial to write. (Question: under AmigaDOS 2.0, it seems that a file or directory is distinguishable from a hard link to it. If this is so, obviously my Unix understanding of hard links is invalid. What exactly are the semantics of one? Are they low-level pointers, and can one remove the file pointed to? How does the FS ensure the dangling link isn't picked up?) -- -Colin