rjeczalik / notify

File system event notification library on steroids.
MIT License
900 stars 128 forks source link

inotify: Fix path when renaming dir in recursive watch #195

Closed imsodin closed 3 years ago

imsodin commented 3 years ago

Steps to reproduce (or just run the test in the PR):

  1. Create recursive watch.
  2. Create a dir A.
  3. Rename the dir to B.
  4. Create a file at B/foo

Expected: Event at B/foo

Actual: Event at A/foo

The main fix is in line 100: The path needs to updated too.

I also changed the locking, as both branches of the if require a write-lock, thus acquiring a read-lock first is pointless.

The issue was originally reported in https://github.com/syncthing/syncthing/issues/7076

imsodin commented 3 years ago

@rjeczalik lgtm?

rjeczalik commented 3 years ago

@imsodin Looks good!