Traversing symlinks

Dominik Psenner dpsenner at gmail.com
Fri May 20 05:00:35 CDT 2011



> -----Original Message-----
> From: mercurial-devel-bounces at selenic.com [mailto:mercurial-devel-
> bounces at selenic.com] On Behalf Of Martin Geisler
> Sent: Friday, May 20, 2011 11:38 AM
> To: Adrian Buehlmann
> Cc: Mercurial Developers
> Subject: Re: Traversing symlinks
> 
> Adrian Buehlmann <adrian at cadifra.com> writes:
> 
> > On 2011-05-16 19:57, Martin Geisler wrote:
> >> Hi guys,
> >>
> >> Way back in 2007, this changeset was added:
> >>
> >>   http://selenic.com/hg/rev/d316124ebbea
> >>
> >> It makes Mercurial abort when it encounters a symlink on the way to a
> >> file -- even when the symlink points inside the repository:
> >>
> >>   $ ln -s contrib extra
> >>   $ hg status extra/mq.el
> >>   abort: path 'extra/mq.el' traverses symbolic link 'extra'
> >>
> >> This seems a tad too restrictive to me, and Bryan did also flag this
> >> in the test and commit message.
> >>
> >> Would anybody object to me lifting this restriction?
> >
> > Is this for the case where the symlinkdir ('extra' in your example) is
> > under the same repo root as where it points to?
> 
> Yes, I was talking about a symlink in the working directory that points
> to another place in the working directory.
> 
> But it could be implemented differently: we could let the path auditor
> keep doing what it does today, and then merely start by resolving all
> command line arguments. So
> 
>   $ hg status extra/mq.py
> 
> would be translated into
> 
>   $ hg status hgext/mq.py
> 
> as the first thing -- and from that point on Mercurial operates on
> symlink-free paths only, like today. As if you had executed
> 
>   $ hg status $(readlink --canonicalize extra/mq.py)

I believe that this is too much of a hassle FWIW. :-)

> 
> > Does that mean mercurial would have to track (i.e. recording in
> > history) the fact that 'extra' is a directory symlink to contrib?
> >
> > If not, who creates 'extra' and for what purpose?
> 
> Maybe someone wants to make a deep path shorter by making a symlink. The
> symlink may or may not be tracked, the point was just that Mercurial
> behaves in an atypical way here compared to other Unix tools.

*hm* I was more thinking of something like:

$ hg init
$ ln -s /etc
$ hg add *
$ hg commit

At this point, I would expect mercurial to track the history of the data
stored at the symlink location as if that data was physically there.

Tracking the history of the symlink itself is - I believe - pretty useless.

> 
> --
> Martin Geisler
> 
> aragost Trifork
> Professional Mercurial support
> http://mercurial.aragost.com/kick-start/
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list