Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No modification notifications for symlinks #87

Open
francisdb opened this issue Feb 12, 2019 · 5 comments
Open

No modification notifications for symlinks #87

francisdb opened this issue Feb 12, 2019 · 5 comments

Comments

@francisdb
Copy link

this has been copied over from #66 (comment) by @Prillan

Setup

/tmp$ tree fsnotify-test
fsnotify-test
├── files
│   └── test
└── links
    └── test -> ../files/test

Start the watcher in /tmp/fsnotify-test/links: watchTree mgr "/tmp/fsnotify-test/links/" (const True) print

The following commands illustrate this point

$ cd fsnotify-test/
$ touch files/test
<no output from watcher>
$ echo "ASDF" >> files/test
<no output from watcher>
$ echo "ASDF" >> links/test
<no output from watcher>
$ ln -s files/test links/test2
Added "/tmp/fsnotify-test/links/test2" 2016-08-09 21:09:36.370309 UTC
$ rm files/test
<no output from watcher>
$ rm links/test
Removed "/tmp/fsnotify-test/links/test" 2016-08-09 21:10:05.512831 UTC

Note that the only actions output were the ones affecting the links themselves.

@thomasjm
Copy link
Contributor

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.

@francisdb
Copy link
Author

This indeed seems to be a complicated subject. Differences between operating systems and chance of infinite recursion.

eg guard/listen#25

@thomasjm
Copy link
Contributor

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.

@thomasjm
Copy link
Contributor

Well actually -- the fswatch library is kind of a gold standard and it looks like they have done some work on this. See emcrisostomo/fswatch#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.

@karlicoss
Copy link

If someone's looking for workaround, jaspervdj/hakyll#502 (comment) might help you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@francisdb @karlicoss @thomasjm and others