Open francisdb opened 5 years ago
I believe this is the expected/desired behavior. A symlink is just a special kind of file which contains a path to another file (which may not even exist). As the man page says, "Inotify monitoring is inode-based," so we wouldn't expect a change to the target of a symlink to be picked up.
I think you'll have to watch the whole tree to catch such modifications.
This indeed seems to be a complicated subject. Differences between operating systems and chance of infinite recursion.
Yes it is tricky. Hopefully you can solve your problem by adding watches to wherever the files actually live, since inotify
doesn't provide a way to watch for this. I don't think fanotify
, the other Linux file watching system, does either. Not sure about Windows or Mac but I suspect it's the same situation.
Going to close this but let me know if you have any other thoughts.
Well actually -- the fswatch library is kind of a gold standard and it looks like they have done some work on this. See https://github.com/emcrisostomo/fswatch/issues/87, they mention that for inotify
they added the ability to scan the filesystem and add more watches when the --follow-links
argument is given.
So I guess we could consider this a feature request to add similar functionality. You'd still be out of luck on OSX though.
If someone's looking for workaround, https://github.com/jaspervdj/hakyll/issues/502#issuecomment-557895182 might help you
this has been copied over from https://github.com/haskell-fswatch/hfsnotify/issues/66#issuecomment-238694654 by @Prillan
Setup
Start the watcher in
/tmp/fsnotify-test/links
:watchTree mgr "/tmp/fsnotify-test/links/" (const True) print
The following commands illustrate this point
Note that the only actions output were the ones affecting the links themselves.