1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Guarantee delivery of inotify special events

* src/inotify.c (inotifyevent_to_event): Always match events
that are not encompassed by IN_ALL_EVENTS and which the
documentation implies are always delivered to callbacks.

* test/src/inotify-tests.el (inotify-file-watch-stop-delivery):
New test.
This commit is contained in:
Po Lu 2025-02-26 09:56:46 +08:00
parent 68f9a7aac1
commit 928dc34e05
2 changed files with 15 additions and 1 deletions

View file

@ -187,7 +187,10 @@ inotifyevent_to_event (Lisp_Object watch, struct inotify_event const *ev)
uint32_t mask;
CONS_TO_INTEGER (Fnth (make_fixnum (3), watch), uint32_t, mask);
if (! (mask & ev->mask))
if (! (mask & ev->mask)
/* These event types are supposed to be reported whether or not
they appeared in the ASPECT list when monitoring commenced. */
&& !(ev->mask & (IN_IGNORED | IN_Q_OVERFLOW | IN_ISDIR | IN_UNMOUNT)))
return Qnil;
if (ev->len > 0)

View file

@ -67,6 +67,17 @@
(inotify-rm-watch wd)
(should-not (inotify-valid-p wd)))))))
(ert-deftest inotify-file-watch-stop-delivery ()
"Test whether IN_IGNORE events are delivered."
(skip-unless (featurep 'inotify))
(progn
(ert-with-temp-file temp-file
(inotify-add-watch
temp-file t (lambda (event)
(when (memq 'ignored (cadr event))
(throw 'success t)))))
(should (catch 'success (recursive-edit) nil))))
(provide 'inotify-tests)
;;; inotify-tests.el ends here