3 ms·
I am a long-term user of Unison (https://www.cis.upenn.edu/~bcpierce/unison/ https://www.cis.upenn.edu/~bcpierce/unison/) from the command line, to synchronize
by Syzygies 6y ago
I am a long-term user of Unison (https://www.cis.upenn.edu/~bcpierce/unison/ https://www.cis.upenn.edu/~bcpierce/unison/) from the command line, to synchronize directories between my machines. If Unison weren't available, from studying the Syncthing documentation it would be my next choice.
You wouldn't think that writing synchronization software would be rocket science, but apparently it is: Unison's author is Benjamin C. Pierce, a prominent computer scientist and author of "Types and Programming Languages". Together with an active user community, he makes the correct call on some key design decisions.
I have tested many alternatives to expose these issues. I have not tested Syncthing, as this HN post is so poorly titled that it would sync into oblivion before I could complete the tests. I recommend writing your favorite sync software author if you find their handling of these issues problematic, though expect defensive replies.
[1] Symbolic links. They should be copied as is, not considered for their semantic content. Would you want sync software taking a half hour break if it found porn on your computer? Why should it think about symbolic links, either? It is your responsibility that they have some meaning on the target machine. Unison and Syncthing copy Unix symbolic links. All other programs wreck them or follow them. It confuses matters that some users beg for such behavior, in hopes of extending the capabilities of sync software beyond their original design.
On MacOS an application bundle, not meant to be examined by casual users, can contain internal symbolic links, for example from "latest" to a versioned directory. Software that mangles this will claim that it isn't meant for "system files" as if that is some dangerous art. It is not; they are simply handling symbolic links wrong.
[2] "Atomic" directories. If one has for example a MacOS sparse disk image open on two machines, and makes conflicting changes, one cannot simply merge the pieces, deciding arbitrarily on conflicting index files. Think of the movie "The Fly". A sparse disk image is again a directory of many files. This has many advantages, including ease of incremental backup. However, one needs to decide which copy to keep in case of conflict, at the directory level.
Unison has a way to declare this. I've never seen other software with this capability. This also applies for example to .git directories.
[3] Interactive conflict management. Using Unison, one chooses interactively how to resolve conflicts before committing to the sync. I sync many gigabytes of data, and I have no interest in dealing later with scattered renamed copies of files, many of which matter to automated tools and will never see my manual attention. I either choose a preferred copy at the time of sync, or I abort and fix the problem before the sync.
I prefer Unison's handling here to Syncthing.
- LeoPanthera 6y agoI used to use Unison. It has a huge flaw. Like rsync, the Unison binary must be installed at both ends of the sync. Unlike rsync, they must be exactly the same version, compiled with exactly the same version of various libraries. I was bitten by this so many times, because the path of least resistance is just to install unison from the repo of whatever OS you are using, but if you want to sync between different OSs, may God have mercy on your soul. Sometimes, it works. Sometimes, it explodes. I switched to Syncthing. Your points here are valid, but so far, have not been a problem in the real world.
- tome 6y ago> Like rsync, the Unison binary must be installed at both ends of the sync. Unlike rsync, they must be exactly the same version, compiled with exactly the same version of various libraries. Wow, I've been using rsync for years and never knew this. I hope I haven't silently corrupted anything.
- yjftsjthsd-h 6y ago> You wouldn't think that writing synchronization software would be rocket science, but apparently it is It really is, depending on your constraints. It's one of those charming problems that starts at "Why don't you just ___?" and quickly devolves to "Okay, so we can probably avoid creating an inconsistent state here so long as edgecase0, edgecase1, and edgecase38 don't occur at the same time."
- CmdrKrool 6y ago> [2] "Atomic" directories. What's this feature called in Unison's own terms? I'm also a regular Unison user, but I'm not familiar with this idea and it's not jumping out from a quick browse through the manual. Would like to know more in case I'm missing something good.