Bugzilla – Bug 104660
inotify: IN_IGNORED is sent although unlinked file is not watched anymore
Last modified: 2005-08-16 14:34:43 UTC
When doing this wd = inotify_add_watch(fd, "file", IN_ACCESS); (do stuff with "file") inotify_rm_watch(fd, wd); close(file_fd); unlink("file"); there is still an IN_IGNORED event pending in fd, although "file" is deleted after the watch has been removed. I don't think this is the intended behaviour.
You will get an IN_IGNORED event when you remove the watch. So, unless you are seeing TWO such events, this is not a bug.
I'm sorry, but this behaviour makes absolutely no sense to me. When I remove a watch, then I don't want to get any further events about that file/dir. You might also want to describe this behaviour in the documentation.
It is consistent: You get an IN_IGNORED event whenever an event is removed, regardless of how. Also, it lets applications handle event removal in a single place, their IN_IGNORED handler.