-
Notifications
You must be signed in to change notification settings - Fork 18k
x/exp/inotify: Remove watches from the internal map even if a directory is deleted #16709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also happened to find this problem. I deleted a directory that was being watched, then I tried to invoke @agorman I think you fix is wrong,
|
Doh, you're right about my logic error. Good catch. I don't think this change quite fixes it either though. If a directory was deleted and then RemoveWatch is called it will still error without deleting the watch internally. I propose that we just move the internal deletes up and keep the error handling the same. That way users can handle the error as they see fit but the watch is cleaned up properly internally. |
My patch fix the situation that the path was deleted and retrying to remove the watch is useless. But if |
I'm fine with not doing the syscall to inotify if the directory doesn't exist as long as the internal maps are cleaned up even if an error is returned. I don't think a user should have to force anything to allow for the watches to be removed internally even if there is no actual inotify watch. |
Deleted this code instead. See github.com/fsnotify for more maintained code. |
What version of Go are you using (go version)?
go version go1.6.1 linux/amd64
What operating system and processor architecture are you using?
CentOS 6
Intel Core 2 Duo
2.6.32-431.20.3.el6.centos.plus.x86_64 #1 SMP Thu Jun 19 23:04:15 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
What did you do?
I deleted a directory that was being watched.
What did you expect to see?
If a directory is deleted I expect to be able to watch another directory that gets created with the same name.
What did you see instead?
If a watched directory is deleted from the OS it will never be removed from the watches map which cases a directory with the same name to never be able to be watched again during the programs execution.
My proposed change: agorman/exp@66dcf71
I created a gist for a program that shows the bug. You can test it against the current code and my proposed change. https://gist.github.com/agorman/000e5aca46827057accc8312bf55d989
Thanks
The text was updated successfully, but these errors were encountered: