Re: fsmonitor on linux is triggered due to unison changes its fingerprint cache
Ulrich Gemkow <[email protected]> Fri, 3 Oct 2025 21:17:25 +0200
| Newsgroups | gmane.network.unison.general |
|---|---|
| Organization | University of Stuttgart (Germany), IKR |
| Message-ID | <[email protected]> |
Hello T=C3=B5ivo, thanks! On Friday 03 October 2025, T=C3=B5ivo Leedj=C3=A4rv wrote: > 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 =3D 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. >=20 > This is to be expected. The fsmonitor implicitly knows about ignored > paths because Unison only asks it to monitor non-ignored sub-dirs. >=20 > > 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? >=20 > 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, ... >=20 > 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. Thanks for the explanation, this explains the behavior. But the question remains why unison performs a scan when it should only "watch" using the fsmonitor. And why every second. > I'm considering improving this to skip writing the cache file if there > is nothing new to add to the cache. Thanks again and best regards Ulrich =2D-=20 Ulrich Gemkow University of Stuttgart Institute of Communication Networks and Computer Engineering (IKR)