[Unison-hackers] Fwd: Daemonizing Unison and why this is easier said than done

Greg Troxel gdt at lexort.com
Sun Oct 15 15:50:59 EDT 2023


Josh Marshall <joshua.r.marshall.1991 at gmail.com> writes:

> Good to know that about the fsmonitor feature.  Adding everything to
> the README isn't what I was getting at.  A few bullet points as you
> suggest would be sufficient.  I might be able to commit for 803.  Is
> there a current up to date guidelines for me submitting a patch, or
> should we figure that out if/when it materializes?

I just added 2 lines to README.

Guidelines are in CONTRIBUTING.md.

> For atomic file actions, I was thinking of something like
> https://urldefense.com/v3/__https://linux.die.net/man/1/flock__;!!IBzWLUs!RR-mXLJqksmMHGJdoQ9Kuj62_4YLHYqzYAniAc-KJBHqANYq-o2rvXUrTWMvHUTk0KGTEOfEfZOkmLgX9L9VtZZy$  to lock all files to the acting
> process.  The reason for this being that if there is an interruption
> of some sort which prevents a clean change, then it could be safely
> re-attempted and prevent use by the system where the target file is
> from using the target file.

To first order, Unison only depends on POSIX facilities.  flock(2) is,
amusingly, from 4.2BSD, and not in POSIX.  But I think you are
suggesting some sort of transactions.  Unison intends to do things in an
order such that after a crash of either end, if run again, nothing bad
happens.  But there is no sense of a transaction where the side being
modified transitions from one state that was the result of sync
operation to a new state.

There are no guarantees that if you update foo and bar on A and then
sync to B, and there is a problem (network, full fs, crash) that B will
have none of foo and bar or both.   Basically if you want postgres with
full transactions, use that instead :-)

>> The repeat mode can tolerate some failures, such as connection to the server dropping.
> Is this something worth poking at to improve?

Well, have you run it?  What has your experience been?  What problems
are you having?  There are enough problems that bother people that I
really don't expect anyone to work on problems that aren't causing
annoyances at least.

You should be able to trivially use mosh instead of ssh, assuming it is
args-compatible, and it seems obvious that it would be.


More information about the Unison-hackers mailing list