From: Eli Zaretskii <eliz@gnu.org>
To: Tassilo Horn <tsdh@gnu.org>
Cc: michael.albinus@gmx.de, 21432@debbugs.gnu.org
Subject: bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted
Date: Mon, 14 Sep 2015 16:22:38 +0300 [thread overview]
Message-ID: <837fnt9lup.fsf@gnu.org> (raw)
In-Reply-To: <87r3m1igdf.fsf@gnu.org>
> From: Tassilo Horn <tsdh@gnu.org>
> Cc: michael.albinus@gmx.de, 21432@debbugs.gnu.org
> Date: Mon, 14 Sep 2015 09:56:12 +0200
>
> >> AFAIR, filenotify.el watches the parent directory of the
> >> file/directory you asked it to watch. So to see the invalid-p method
> >> in action you need to remove the parent, not the directory itself.
> >
> > Ah, I see. I'll adapt the tests accordingly.
>
> Done, however the descriptors still don't become invalid when deleting
> the parent directory of the watched file or directory. I guess, that's
> a problem in the inotify and TRAMP implementations then.
No, I think it's a problem with our mental model of what happens. The
file notifications use the Emacs event loop, and Emacs won't check for
events until it's idle. So calling file-notify-valid-p as part of the
test ends up doing that _before_ the directory deletion notification
is read by Emacs and invalidates the watch. I actually see the
message saying the watch is valid before the notification comes in and
its message is inserted into *Messages*.
The following simple test case works with w32notify:
(setq mydir "/tmp/x")
(make-directory mydir t)
(setq myfile "/tmp/x/y")
(write-region "foo\n" nil myfile)
(setq w (w32notify-add-watch mydir '(file-name attributes size last-write-time)
(lambda (event) (message "%s" event))))
(message "valid: %s" (w32notify-valid-p w))
(delete-directory mydir t)
(run-with-idle-timer 1 nil
(lambda ()
(message "valid: %s" (w32notify-valid-p w))))
When I run the above snippet with eval-region, I see these messages in
*Messages*:
Wrote d:/tmp/x/y
valid: t
(100161480 modified y)
(100161480 removed y)
valid: nil
Try something similar with inotify and see if you see the same basic
issue. If you do, I trust you will think of a way to modify the tests
so that validation does do its thing.
next prev parent reply other threads:[~2015-09-14 13:22 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-08 6:36 bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted Tassilo Horn
2015-09-08 7:47 ` Michael Albinus
2015-09-08 8:11 ` Tassilo Horn
2015-09-08 15:51 ` Eli Zaretskii
2015-09-08 15:49 ` Eli Zaretskii
2015-09-08 16:01 ` Michael Albinus
2015-09-12 10:18 ` Michael Albinus
2015-09-12 15:11 ` Eli Zaretskii
2015-09-12 18:09 ` Michael Albinus
2015-09-13 19:23 ` Michael Albinus
2015-09-14 6:08 ` Tassilo Horn
2015-09-14 7:08 ` Eli Zaretskii
2015-09-14 7:40 ` Tassilo Horn
2015-09-14 7:56 ` Tassilo Horn
2015-09-14 13:22 ` Eli Zaretskii [this message]
2015-09-14 20:23 ` Michael Albinus
2015-09-15 7:38 ` Eli Zaretskii
2015-09-15 8:00 ` Michael Albinus
2015-09-15 8:22 ` Eli Zaretskii
2015-09-15 11:54 ` Michael Albinus
2015-09-15 12:51 ` Eli Zaretskii
2015-09-15 12:56 ` Michael Albinus
2015-09-16 14:45 ` Michael Albinus
2015-09-16 17:08 ` Eli Zaretskii
2015-09-16 17:26 ` Michael Albinus
2015-09-16 17:55 ` Eli Zaretskii
2015-09-16 18:28 ` Michael Albinus
2015-09-15 5:53 ` Tassilo Horn
2015-09-14 7:35 ` Eli Zaretskii
2015-09-14 7:37 ` Michael Albinus
2015-09-15 13:02 ` Michael Albinus
2015-09-15 13:56 ` Eli Zaretskii
2015-09-16 13:54 ` Michael Albinus
2015-09-20 17:23 ` Michael Albinus
2015-09-20 19:19 ` Eli Zaretskii
2015-09-21 13:40 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=837fnt9lup.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=21432@debbugs.gnu.org \
--cc=michael.albinus@gmx.de \
--cc=tsdh@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.