diff options
| author | Po Lu | 2025-02-26 09:56:46 +0800 |
|---|---|---|
| committer | Po Lu | 2025-02-26 10:39:46 +0800 |
| commit | 928dc34e05fc04a9b8394df477beca2ef6d9fd1b (patch) | |
| tree | 49155540107962e0bafe822ac01aa87b85dc6707 | |
| parent | 68f9a7aac1f5b9606ca6245e1dd74d09087752d4 (diff) | |
| download | emacs-928dc34e05fc04a9b8394df477beca2ef6d9fd1b.tar.gz emacs-928dc34e05fc04a9b8394df477beca2ef6d9fd1b.zip | |
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.
| -rw-r--r-- | src/inotify.c | 5 | ||||
| -rw-r--r-- | test/src/inotify-tests.el | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/inotify.c b/src/inotify.c index ff842ddc58c..c29d940c984 100644 --- a/src/inotify.c +++ b/src/inotify.c | |||
| @@ -187,7 +187,10 @@ inotifyevent_to_event (Lisp_Object watch, struct inotify_event const *ev) | |||
| 187 | uint32_t mask; | 187 | uint32_t mask; |
| 188 | CONS_TO_INTEGER (Fnth (make_fixnum (3), watch), uint32_t, mask); | 188 | CONS_TO_INTEGER (Fnth (make_fixnum (3), watch), uint32_t, mask); |
| 189 | 189 | ||
| 190 | if (! (mask & ev->mask)) | 190 | if (! (mask & ev->mask) |
| 191 | /* These event types are supposed to be reported whether or not | ||
| 192 | they appeared in the ASPECT list when monitoring commenced. */ | ||
| 193 | && !(ev->mask & (IN_IGNORED | IN_Q_OVERFLOW | IN_ISDIR | IN_UNMOUNT))) | ||
| 191 | return Qnil; | 194 | return Qnil; |
| 192 | 195 | ||
| 193 | if (ev->len > 0) | 196 | if (ev->len > 0) |
diff --git a/test/src/inotify-tests.el b/test/src/inotify-tests.el index 23febef2c67..aa7801d1e2c 100644 --- a/test/src/inotify-tests.el +++ b/test/src/inotify-tests.el | |||
| @@ -67,6 +67,17 @@ | |||
| 67 | (inotify-rm-watch wd) | 67 | (inotify-rm-watch wd) |
| 68 | (should-not (inotify-valid-p wd))))))) | 68 | (should-not (inotify-valid-p wd))))))) |
| 69 | 69 | ||
| 70 | (ert-deftest inotify-file-watch-stop-delivery () | ||
| 71 | "Test whether IN_IGNORE events are delivered." | ||
| 72 | (skip-unless (featurep 'inotify)) | ||
| 73 | (progn | ||
| 74 | (ert-with-temp-file temp-file | ||
| 75 | (inotify-add-watch | ||
| 76 | temp-file t (lambda (event) | ||
| 77 | (when (memq 'ignored (cadr event)) | ||
| 78 | (throw 'success t))))) | ||
| 79 | (should (catch 'success (recursive-edit) nil)))) | ||
| 80 | |||
| 70 | (provide 'inotify-tests) | 81 | (provide 'inotify-tests) |
| 71 | 82 | ||
| 72 | ;;; inotify-tests.el ends here | 83 | ;;; inotify-tests.el ends here |