symlink behaviour?

Jeroen De Vlieger fly.jdv at gmail.com
Fri Jan 6 13:01:57 UTC 2012


a small test didn't really report  anything when creating unsafe symlinks
:-(

example:

% cd /tmp
% mkdir testHgsymlinkbehaviour
% cd testHgsymlinkbehaviour
% touch fileA
% mkdir hgrepo
% cd hgrepo
% hg init
% touch fileB
% hg add
adding fileB
% hg ci -m ' commit 1 '

% ln -s fileB symlinkToB
% ln -s ../fileA symlinkToExternalFileA

% hg add
% hg st
A symlinkToB
A symlinkToExternalFileA
% hg ci -m "added some symlinks"
 symlinkToB             |  1 +
 symlinkToExternalFileA |  1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

% cd ../
% hg clone --pull hgrepo pulledRepo
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 3 changes to 3 files
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
jeroendv at zadeh /tmp/testHgsymlinkbehaviour % cd pulledRepo
% ls -l
total 0
-rw-rw-r-- 1 jeroendv jeroendv 0 2012-01-06 13:23 fileB
lrwxrwxrwx 1 jeroendv jeroendv 5 2012-01-06 13:23 symlinkToB -> fileB
lrwxrwxrwx 1 jeroendv jeroendv 8 2012-01-06 13:23 symlinkToExternalFileA ->
../fileA

Jeroen


On Fri, Jan 6, 2012 at 1:49 PM, Jeroen De Vlieger <fly.jdv at gmail.com> wrote:

> Hi,
>
> I recently learned of the nice symlink behaviour in rsync, more
> specifically the distinction between safe and unsafe  symlinks.
>
> >  Symbolic links are considered unsafe if they are :
> >    absolute symlinks (start with /),
> >    empty, or
> >    if they contain enough “..”  components to ascend from the directory
> being copied.
>
>
> Does mercurial also support a similar notion of safe and unsafe symlinks?
> I.e. symlink that point to files not in the repository?
>
>
> 'hg help add' doesn mention it and I don't really find any documentation
> regarding this.
> Or any other *official* documentation with respect to symlink behaviour.
>
> The only information that I did find was in revision messages and some bug
> reports, but they didn't really clear the confusion for me.
>
> with kind regards,
>
> Jeroen
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20120106/ca4bbbcf/attachment-0002.html>


More information about the Mercurial mailing list