Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There were two problems here: - When we see a link inside a directory the resolved version would get added to w.watches etc. but the link won't, resulting in many spurious create events for the link. This fixes #277; I'm surprised there aren't more reports for this). - filepath.EvalSymlinks() will resolve any symlinks in the entire path, rather than just the link itself. This would cause paths such as: /path/to/LINK/dir/dir/WATCH-THIS To have the wrong Event.Name; many of the test cases failed because of this because /tmp is a link to /private/tmp on macOS, but curiously no one reported it AFAIK (I guess many people don't use symlinks all that much). Example: % mkdir /tmp/xxx % touch /tmp/xxx/FILE % ln -s /tmp/xxx/LINK /tmp/xxx/FILE # 25 years of Unix experience, and still... ln: /tmp/xxx/FILE: File exists % ln -s /tmp/xxx/FILE /tmp/xxx/LINK Before it would do: % go run ./cmd/fsnotify watch /tmp/xxx & % touch /tmp/xxx/FILE 03:23:03.2731 1 CHMOD "/private/tmp/xxx/FILE" 03:23:03.2744 2 CHMOD "/tmp/xxx/FILE" ^C % fsnotify watch /tmp/xxx/LINK & % touch /tmp/xxx/LINK 03:26:37.3576 1 CHMOD "/private/tmp/xxx/FILE" And now it does: % go run ./cmd/fsnotify watch /tmp/xxx & 03:23:47.8911 1 CHMOD "/tmp/xxx/FILE" ^C % fsnotify watch /tmp/xxx/LINK & % touch /tmp/xxx/LINK 03:27:38.5227 1 CHMOD "/tmp/xxx/FILE"
- Loading branch information
Showing
2 changed files
with
74 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters