Hi again, On Thu, 19 Mar 2020 at 00:20, Uwe Geuder wrote: > > Hi! > > On Tue, 17 Mar 2020 at 23:52, Michael Chapman wrote: > > > > On Wed, 18 Mar 2020, Uwe Geuder wrote: > > > Hi! > > > > > > I have wondered for a while how I can use *.path units without (too bad) > > > races. > > > > > > Since > > > https://github.com/systemd/systemd/pull/13509/commits/06582e42de65a61d0238a18720a12b6353edb7cd > > > the behaviour has been become much clearer, but I must admit I still > > > don't get it. > > > > That commit does look incomplete to me. > > > > As a quick test, are you able to try out the patch below? This makes > > systemd always check the filesystem when the service stops, rather than > > just relying on the (as of that commit nonexistent) inotify event. ... > I built that change and quickly tested it. It seems to work fine! ... > As expected the service gets now invoked 3 times. Without your patch the > second touch command/file is missed and only "handled" together with the > third touch command/file. I tested a bit more. Yesterday I tested using DirectoryNotEmpty= Today I tested PathModified= and there your patch does not improve the situation. The manual page is not very specific about how that is supposed to work IMHO, but I could imagine the following distinction: PathExists=, PathExistsGlob=, and DirectoryNotEmpty= are absolute predicates. When setting the path unit to waiting one can just check whether they are true or not. (After arming inotify of course.) With your patch my limited testing was successful. However, PathChanged= and PathModified= are relative predicates. You cannot just check whether they are true or not. Wouldn't the correct implementation 1. need to store the applicable timestamp of the path involved when the path unit is set to started and 2. when the path unit is set to waiting again it would need to compare the stored timestamp with the current timestamp (again after arming inotify) to catch modifications that happened while the unit was running/inotify not armed I don't think I see the timestamps stored at all. So how was this supposed to work? Was the intended semantics different? Regards, Uwe Uwe Geuder Neuro Event Labs Oy Tampere, Finland uwe.gxuder@xxxxxxxxxxxxxxxxxx (bot check: fix 1 obvious typo) _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel