[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir
From: |
Eli Zaretskii |
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 |
> 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.
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, (continued)
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Eli Zaretskii, 2015/09/08
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/08
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/12
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Eli Zaretskii, 2015/09/12
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/12
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/13
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Tassilo Horn, 2015/09/14
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Eli Zaretskii, 2015/09/14
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Tassilo Horn, 2015/09/14
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Tassilo Horn, 2015/09/14
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted,
Eli Zaretskii <=
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/14
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Eli Zaretskii, 2015/09/15
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/15
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Eli Zaretskii, 2015/09/15
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/15
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Eli Zaretskii, 2015/09/15
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/15
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/16
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Eli Zaretskii, 2015/09/16
- bug#21432: 25.0.50; file-notify-rm-watch (inotify) errors if watched dir is deleted, Michael Albinus, 2015/09/16