notify-rs / notify

🔭 Cross-platform filesystem notification library for Rust.
https://docs.rs/notify
2.76k stars 222 forks source link

inotify: files pointed at by multiples symlinks generate events only for one path #572

Open hugwijst opened 8 months ago

hugwijst commented 8 months ago

System details

What you did (as detailed as you can)

I have a directory structure similar to the following:

- root
| - common
| | - file.json
| - tests
| | - test_1
| | | - common -> ../../common

We put a recursive watch on root, and then modify root/common/file.json.

What you expected

Either one of:

What happened

Only a notify event is fired for root/tests/test_1/common/file.json.

hugwijst commented 8 months ago

Relates to #255, #291, and #381, but seems distinct.

Reading https://docs.rs/inotify/latest/inotify/struct.Watches.html#attention-updating-watches-and-hardlinks, possibly the easiest way to solve this behavior is to keep a list of paths for each WatchDescriptor and add to that list at- https://github.com/notify-rs/notify/blob/main/notify/src/inotify.rs#L454.