Re: rootalias does not work with symlink
Vojtěch Čermák <[email protected]> Mon, 24 Mar 2025 09:18:52 -0700 (PDT)
| Newsgroups | gmane.network.unison.general |
|---|---|
| Message-ID | <[email protected]> |
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). 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). 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. 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. Dne pátek 21. března 2025 v 14:54:14 UTC+1 uživatel Greg Troxel napsal: > 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].