Re: rootalias does not work with symlink

Greg Troxel <[email protected]> Mon, 24 Mar 2025 15:29:04 -0400
Newsgroups gmane.network.unison.general
Message-ID <[email protected]>
Vojtěch Čermák <[email protected]> writes:

> I did a bit more testing and apparently I mixed up something when running 
> the command, so this is how it behaves with symlink (I double checked 
> everything):

> In root the symlink works, but on the second line of the archive the real 
> path is saved (e.g. the pwd -P you mentioned).

I can see how this would happen.

> In rootalias the symlink does not work (both profile and command line 
> argument), it causes the rootalias to be ignored (therefore the root is 
> used on the second line of the archive). 

Presumably the code is comparing the rootalias LHS with the archive file
and not getting a match.

> I was trying to solve this, because I wanted to sync folder that is 
> dynamically mounted (the mountpoint name is randomly generated), I solved 
> this in the end by writing a script that creates a new profile file every 
> time with the new paths for root and rootalias. But I must say that it 
> would save me a lot of time if the symlink would work the same in rootalias 
> as it does in root (or if the root in the archive would use the path with 
> the symlink). So although my specific problem is now solved, this could be 
> something where unison could be improved.

Why are you setting paths for root?  It would seem that your archive
file has a particular root value encoded in it, and what you need to do
is to configure rootalias with LHS matching what is in the archive file
and RHS matching the new location.

I think you are running into Unison was designed and coded during a time
when volumes were not mounted to random names.   There are two
traditions:

  mount a filesystem on removable drive on /mnt

  somehow get a name or uuid from the filesystem and mount it at that
  name


If you want to do better than your wrapper, I suggest you read the code
to first get a clear understanding of what is going on and why.  I would
be very reluctant to stir the pot by deciding to invert how it is.

You figuring out how it really is now, and sending in a patch to the
manual/man page to very briefly state about [pwd -L/-P] would be welcome.

> Also I apologize for forgetting to mention what software version I use: 
> unison version 2.53.7 (ocaml 5.2.0) running on Manjaro Linux.

At least that is the most recent release!

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