Re: fsmonitor on linux is triggered due to unison changes its fingerprint cache
Tõivo Leedjärv <[email protected]> Fri, 3 Oct 2025 17:34:47 +0200
| Newsgroups | gmane.network.unison.general |
|---|---|
| Message-ID | <CAALvpZQZ+1jrvjCmpe6t4anza5aPRUdy--uzWyQeofq+2pmScA@mail.gmail.com> |
On Mon, 29 Sept 2025 at 21:17, Ulrich Gemkow <[email protected]> wrote: > > - When I exclude the _whole_ directory ~/.unison/homesync with > an ignore-Statement like > > ignore = Path .../.unison/homesync > > then the 1-second open-modify-close cycle does not happen, the > fsmonitor does not wake up and my watch tool shows no events. This is to be expected. The fsmonitor implicitly knows about ignored paths because Unison only asks it to monitor non-ignored sub-dirs. > So when ignoring only the files, the problem happens. When excluding > the whole directory with the files inside there is no problem. This > seems to be a little strange - I really hope that I made no mistake. > > I tried to find the reason in the source but failed. > > Has anyone an idea what unison does every second with its fp-File > when the directory where it lives is not ignored? Does a bell ring? It's a feedback loop caused by a slight inefficiency in Unison's code. The inefficiency being that Unison writes to the fingerprint cache file at every scan, even if it has nothing new to write to the cache. This causes an inotify event, which causes a new scan, which writes the cache file, which causes an inotify event, ... There is no tmp file or rename(2) involved. The issue is that the cache file is truncated and a preamble written at every scan. This causes the MODIFY inotify event. I'm considering improving this to skip writing the cache file if there is nothing new to add to the cache. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].