Traversing symlinks

Matt Mackall mpm at selenic.com
Fri May 20 11:03:54 CDT 2011


On Fri, 2011-05-20 at 08:48 +0200, Sune Foldager wrote:
> On 19-05-2011 22:56, Matt Mackall wrote:
> > On Thu, 2011-05-19 at 21:22 +0200, Sune Foldager wrote:
> >> On 19-05-2011 19:42, Martin Geisler wrote:
> >>> Isaac Jurado<diptongo at gmail.com>   writes:
> >>>> Superusers can hard-link a directory? Excuse me, but I'm lost at this
> >>>> point:
> >>>>
> >>>>       root at findus:~# mkdir testdir
> >>>>       root at findus:~# ln testdir link_to_testdir
> >>>>       ln: `testdir': hard link not allowed for directory
> >>>
> >>> My manpage has
> >>>
> >>>           -d, -F, --directory
> >>>                 allow  the  superuser  to attempt to hard link directories (note:
> >>>                 will probably fail due to system restrictions, even for the supe-
> >>>                 ruser)
> >>>
> >>> It failed for me when I tried it:
> >>>
> >>>     $ ln foo bar -d
> >>>     ln: creating hard link `bar' =>   `foo': Operation not permitted
> >>>
> >>
> >> It (somewhat limited) supported on Mac OS X.
> >
> > And even these aren't actually hardlinks (ie arbitrary graph-like
> > connections in an otherwise tree-shaped directory structure), they're
> > just presented as hardlinks to userspace.
> 
> Well, hardlinks have been tagged onto HFS+ later on in general, so I 
> guess you could say they are not "true", but I think that's a matter of 
> definition.
> 
> > Among other things, tools like
> > find have a finite run-time with them. Try mounting an HFS+ drive with a
> > Time Machine backup under Linux (or reading Apple's tech notes on them)
> > and you'll see what I mean.
> 
> Yeah, I'll just do that... or wait, no. (what does 'finite run-time' 
> mean anyway? As opposed to 0?)

As opposed to effectively infinite (see graph-structured vs
tree-structured mentioned above). Apple's pseudo-hardlinks cannot be
used to make loops... because they're not really hardlinks. A hardlink
is an arbitrary inode pointer. An Apple hardlink is a... weird thing.
You can read about it here:

http://developer.apple.com/library/mac/#technotes/tn/tn1150.html 

That probably won't make a whole lot of sense until you're actually
trying to recover data from a damaged Time machine volume.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list