Skip to content

inotify, windows: don't rename sibling watches sharing a path prefix#755

Merged
mattn merged 1 commit into
fsnotify:mainfrom
mattn:inotify-windows-rename-sibling-prefix
May 4, 2026
Merged

inotify, windows: don't rename sibling watches sharing a path prefix#755
mattn merged 1 commit into
fsnotify:mainfrom
mattn:inotify-windows-rename-sibling-prefix

Conversation

@mattn

@mattn mattn commented May 1, 2026

Copy link
Copy Markdown
Contributor

The recursive rename path-rewriting loops used strings.HasPrefix(ww.path, old) to decide which watches belong under a renamed directory, so renaming /tmp/a to /tmp/x also rewrote a sibling watch on /tmp/ab to /tmp/xb (and on Windows, C:\root\aC:\root\x rewrote C:\root\ab to C:\root\xb). Subsequent events were then misrouted. Match on a path-separator boundary so only the renamed directory and its real descendants are rewritten.

Stacked on top of #754 (which fixes the same shape of bug in removePath); merging that one first will simplify the diff.

@mattn mattn requested a review from shogo82148 May 1, 2026 12:03

@shogo82148 shogo82148 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ヨシッ

The recursive-rename path-rewriting loop used strings.HasPrefix, so
renaming /tmp/a to /tmp/x also rewrote watches on /tmp/ab to /tmp/xb.
Match on a path-separator boundary instead. Same fix on Windows.
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

Successfully merging this pull request may close these issues.

2 participants