>From 0c581863f4b1f3ef31397357dd454fe68416e645 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 26 May 2017 10:53:02 -0700 Subject: [PATCH 3/3] Depromiscuify inotify with IN_MASK_ADD Use IN_MASK_ADD instead of using a no-longer-promiscuous-enough mask. Without this fix, a later watch that omits IN_OPEN disables an earlier watch that uses IN_OPEN (Bug#26973). * src/inotify.c (INOTIFY_DEFAULT_MASK): Remove. (Finotify_add_watch): Use IN_MASK_ADD instead. --- src/inotify.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/inotify.c b/src/inotify.c index b3e0728..3d5d3d2 100644 --- a/src/inotify.c +++ b/src/inotify.c @@ -42,21 +42,6 @@ along with GNU Emacs. If not, see . */ # define IN_ONLYDIR 0 #endif -/* Events that inotify-add-watch waits for. This list has all the - events that any watcher could include, because we want to support - multiple watches on the same file even though inotify uses the same - descriptor for all watches to that file. This list omits - IN_ACCESS, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, and IN_OPEN because - they would prevent other processes from reading; see Bug#26973. - - FIXME: Explain why it is OK to omit these four bits here even - though a inotify-add-watch call might specify them. */ - -#define INOTIFY_DEFAULT_MASK \ - (IN_ATTRIB | IN_CREATE | IN_DELETE | IN_DELETE_SELF \ - | IN_IGNORED | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM \ - | IN_MOVED_TO | IN_EXCL_UNLINK) - /* File handle for inotify. */ static int inotifyfd = -1; @@ -436,8 +421,7 @@ IN_ONESHOT */) Lisp_Object encoded_file_name; int wd = -1; uint32_t imask = aspect_to_inotifymask (aspect); - uint32_t mask = (INOTIFY_DEFAULT_MASK - | (imask & (IN_DONT_FOLLOW | IN_ONLYDIR))); + uint32_t mask = imask | IN_MASK_ADD | IN_EXCL_UNLINK; CHECK_STRING (filename); -- 2.9.4