thin-edge.io icon indicating copy to clipboard operation
thin-edge.io copied to clipboard

fs_notify generates events on wrong directory paths

Open PradeepKiruvale opened this issue 2 years ago • 4 comments

Describe the bug When fs_notify adds a watcher on different directories, and when the file is added/removed in one directory, the notification will be generated for all the directories. To Reproduce

Expected behavior It should generate the notification only for the directory where some change has happened.

Screenshots

Environment (please complete the following information):

  • OS [incl. version]
  • Hardware [incl. revision]
  • System-Architecture [e.g. result of "uname -a"]
  • thin-edge.io version [e.g. 0.1.0]

Additional context

PradeepKiruvale avatar Sep 16 '22 13:09 PradeepKiruvale

Action points

  • @initard Work on https://github.com/hannobraun/inotify-rs/pull/193 further. It will give us the file ID, which will fix our issue.
  • @PradeepKiruvale Start using @initard's branch as of now.

If we cannot make it merge whatever reason, we will use @initard's branch (as a workaround).

rina23q avatar Sep 20 '22 10:09 rina23q

Submitted the fix, waiting for it to be approved and merged.

@PradeepKiruvale this is the test that checks for two files with the same name: https://github.com/hannobraun/inotify-rs/blob/760a15664fbf6b2bcf770b8cffae3433e1de80ae/tests/main.rs#L347-L403 maybe it helps you with implementing it in our crate.

And here is my fork and branch with the fix: https://github.com/initard/inotify-rs/tree/improvement/inotify-two-files-with-the-same-name

cmosd avatar Sep 20 '22 10:09 cmosd

Thanks, @initard I will have a look. I tried using the git path for fs-notify as below

inotify = { git = "https://github.com/initard/inotify-rs", branch = "improvement/inotify-two-files-with-the-same-name" } It's not working, @didier-wenzek, any idea what's wrong here?

PradeepKiruvale avatar Sep 20 '22 11:09 PradeepKiruvale

inotify = { git = "https://github.com/initard/inotify-rs", branch = "improvement/inotify-two-files-with-the-same-name" } It's not working, @didier-wenzek, any idea what's wrong here?

Is there an error?

EDIT:

I tried too and to me it works.

I added this to crates/common/tedge_utils/Cargo.toml

inotify = { git = "https://github.com/initard/inotify-rs", branch = "improvement/inotify-two-files-with-the-same-name",  optional = true }

cmosd avatar Sep 20 '22 12:09 cmosd

Resolved with #1456

PradeepKiruvale avatar Oct 14 '22 02:10 PradeepKiruvale

The further refactoring of fs-notify crate will be done as part of https://github.com/thin-edge/thin-edge.io/issues/1484

PradeepKiruvale avatar Oct 14 '22 02:10 PradeepKiruvale

QA check passed, therefore close this issue.

rina23q avatar Oct 19 '22 11:10 rina23q