Re: rootalias does not work with symlink

Greg Troxel <[email protected]> Fri, 21 Mar 2025 09:54:09 -0400
Newsgroups gmane.network.unison.general
Message-ID <[email protected]>
Vojtěch Čermák <[email protected]> writes:

> if I have following in my unison profile it works:

Are you using 2.53.7?  If not, would be good to upgrade so that you have
all published fixes.  (Not saying that I think anything changed, but I
as a general rule do not engage in debugging old versions.)

You didn't mention OS; I'll assume something that is not a mac and
more or less complies with POSIX (and is thus also not windows).

> root = /new/path/to/sync
> rootalias = //hostname//new/path/to/sync -> //hostname//old/path/to/sync

Presumably you have an archive file with /old/path/to/sync.  You can
look at archive files with `head -3` to see the metadata.

> ln -sfn /new/path /symlink
>
> and put in my profile:
> root = /symlink/path/to/sync
> rootalias = //hostname//symlink/path/to/sync -> //hostname//old/path/to/sync
>
> the rootalias is ignored

Do you mean in GUI and TUI both?

> However, using it in command works:
> unison "profile" -rootalias "//hostname//symlink/path/to/sync -> 
> //hostname//old/path/to/sync"

Is that with leaving rootalias in the profile?

> So I can use the command line, but I can't use the gui. It would be nice if 
> I could get it working. Is it a bug or do I need to format it differently 
> in the profile?

It seems like it might be a bug, but also symlinks are very difficult to
deal with.  It's not really well specified how rootalias interacts  with
symlinks rather than true directory names.   It's not immediately clear
to me what the rule ought to be, but it is clear that it's tricky and
less clear but probable that any rule would make someone unhappy :).

A path with a symlink more or less names a directory, and then one can ask
'what is the name of this directory'.   See pwd(1) which has pwd -L and
pwd -P.

It is possible that the GUI code is doing something like pwd and
canonicalizing the path, and the TUI doesn't, or that one or the other
does it differently from prefs file vs command line.  A lack of
consistency, if that's how it is, seems likely to be a bug.

What happens if you have root with symlink, and use the real path in
rootalias?  I'm not suggesting that is a pleasing solution, but if that
works with the GUI, it's a clue.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].