From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] Added inotify support.
Date: Wed, 03 Oct 2012 20:34:01 +0200 [thread overview]
Message-ID: <83wqz78kx2.fsf@gnu.org> (raw)
In-Reply-To: <jwvtxubenda.fsf-monnier+emacs@gnu.org>
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: ofv@wanadoo.es, emacs-devel@gnu.org
> Date: Wed, 03 Oct 2012 08:46:39 -0400
>
> >> >> Btw, what are Emacs use cases for using this kind of feature?
> >> > Apart from those mentioned on the original message (dired or magit's (or
> >> > vc-dir) status view) I'll like to mention auto-revert-mode.
> >> Yes, for my own use auto-revert-mode is the main one.
> > AFAICS, all these use cases don't need support for every possible
> > notification inotify lets you define. How about a simpler interface?
>
> The patch he suggests is "as simple as it gets" because it just exposes
> the C-level API. And yes, we'll want a simpler interface on top.
> Both so as to make it easier to use but also so it can work with other
> mechanisms than inotify.
If providing a higher-level interface is the plan, then I think
inotify.el should be renamed to something like file-notifications.el, or
some other neutral name, because before long it will be home to other
back ends and to those higher-level APIs.
That said, when will this simpler interface be added? before or after
Emacs 24.3 is locked for changes? If before, then you can skip
everything I write below (or save it for a future discussion ;-).
That's assuming the inotify support _will_ be in Emacs 24.3.
But if Emacs 24.3 is supposed to be released without this simpler
interface, then I think we will do a disservice to Lisp programmers.
E.g., consider the Dired use case. This wants to know about any and
all changes to the files in the directory, because it will need to
refresh the listing, right? But as things are, whoever will want to
code this will have to carefully read the inotify(7) man page and
figure out which of the IN_* flags she wants, because there's no
'just-what-dired-needs' flag in the API that is being proposed.
Or consider the autorevert use case. Which flag(s) to use for that?
My first guess was IN_ATTRIB, but the man page says
IN_ATTRIB Metadata changed, e.g., permissions, timestamps,
extended attributes, link count (since Linux 2.6.25),
UID, GID, etc.
Hmmm... does this include file size? I don't know. If it doesn't,
then do I need to catch the series of IN_OPEN, IN_WRITE, IN_CLOSE?
Are you confused yet? Because I am.
Another concern is how to design the Lisp code that gets run by
notifications. Since we are converting notifications into Lisp
events, the most natural way of using them would be to bind a function
to the 'inotify-event' event. (Btw, I'd drop the "event" part from
the symbol name, it's redundant.) But since meaningful file-level
events are likely to produce multiple notifications (see below), such
a function will need to implement a non-trivial state machine to DTRT.
For example, if you type at the shell prompt "echo foo > bar" with
'bar' an existing non-empty file, how many notifications do you see?
On Windows, I get 2 or 3, depending on the details: 2 for size change
(first one when the file is truncated, second one when "foo" is
written into it), and sometimes also an attribute or "security" change
(e.g., if the original file was owned by someone else). Unless
inotify magically merges all these into a single meaningful
notification, the Lisp code that receives this series of notifications
will have hard time doing TRT with them, even if the exact expected
series are known in advance, especially if other notifications are
interspersed with these.
As yet another example, many applications update a file by first
writing a temporary file, then deleting the old file and renaming the
new one. That's another series of notifications someone will have to
figure out in Lisp, when the function bound to 'inotify-event' will
get called several times, because from the user POV, the file got
updated, not overwritten by moving another file over it.
This is why I think we _must_ have a higher-level API in place for
this feature to be useful in practice, even if just inotify back end
is supported. And we should talk _today_ about that API, because some
of the processing needed to produce higher-level abstractions of
events are much easier done in C than in Lisp.
next prev parent reply other threads:[~2012-10-03 18:34 UTC|newest]
Thread overview: 148+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 22:34 [PATCH] Support for filesystem watching (inotify) Rüdiger Sonderfeld
2011-06-04 8:52 ` joakim
2011-06-04 16:40 ` Rüdiger Sonderfeld
2011-06-04 10:43 ` Jan Djärv
2011-06-04 23:36 ` [PATCH update2] " Rüdiger Sonderfeld
2011-06-05 5:45 ` Eli Zaretskii
2011-06-05 9:48 ` [PATCH update3] " Rüdiger Sonderfeld
2011-06-05 7:48 ` [PATCH update2] " Jan Djärv
2011-06-05 7:54 ` Andreas Schwab
2011-06-05 9:49 ` Rüdiger Sonderfeld
2011-06-05 15:59 ` John Yates
2011-06-05 16:14 ` Rüdiger Sonderfeld
2011-06-05 16:58 ` Eli Zaretskii
2011-06-06 18:56 ` Rüdiger Sonderfeld
2011-06-06 19:57 ` Eli Zaretskii
2011-06-04 11:30 ` [PATCH] " Eli Zaretskii
2011-06-04 17:13 ` [PATCH updated] " Rüdiger Sonderfeld
2011-06-04 19:15 ` Eli Zaretskii
2011-06-04 20:10 ` Thien-Thi Nguyen
2011-06-04 23:43 ` Rüdiger Sonderfeld
2011-06-05 2:15 ` Thien-Thi Nguyen
2011-06-05 9:22 ` Štěpán Němec
2011-06-15 20:53 ` Johan Bockgård
2011-06-16 8:52 ` Inlined cl functions -- how to learn about them Štěpán Němec
2011-06-06 15:21 ` [PATCH updated] Support for filesystem watching (inotify) Stefan Monnier
2011-06-06 16:25 ` Rüdiger Sonderfeld
2011-06-06 17:11 ` Stefan Monnier
2011-06-06 20:16 ` Ted Zlatanov
2011-06-07 14:42 ` Stefan Monnier
2011-06-07 16:46 ` Ted Zlatanov
2011-06-07 18:06 ` Stefan Monnier
2011-06-07 18:26 ` Ted Zlatanov
2011-06-24 0:50 ` Rüdiger Sonderfeld
2011-06-24 10:19 ` Ted Zlatanov
2011-06-24 12:18 ` Ted Zlatanov
2011-07-06 13:36 ` Stefan Monnier
2011-07-06 15:54 ` Paul Eggert
2011-07-06 18:30 ` Stefan Monnier
2011-07-06 20:39 ` Paul Eggert
2011-07-06 19:14 ` wide-int crash [was Re: [PATCH updated] Support for filesystem watching (inotify)] Glenn Morris
2011-07-06 22:31 ` Paul Eggert
2011-10-07 7:30 ` bug#8884: wide-int crash Glenn Morris
2011-06-17 17:50 ` bug#8884: 24.0.50; temacs crashes and dumps core when configured --with-wide-int Peter Dyballa
2011-06-17 20:07 ` Peter Dyballa
[not found] ` <handler.8884.D8884.131797266119606.notifdone@debbugs.gnu.org>
2011-10-08 13:35 ` bug#8884: closed (Re: bug#8884: wide-int crash) Peter Dyballa
2011-10-17 22:24 ` Peter Dyballa
2011-10-18 5:42 ` Paul Eggert
2011-10-18 9:14 ` Peter Dyballa
2011-10-18 10:55 ` Eli Zaretskii
2011-10-18 13:33 ` Stefan Monnier
2011-10-18 15:38 ` Paul Eggert
2011-10-18 15:45 ` Andreas Schwab
2011-10-18 15:57 ` Paul Eggert
2011-10-18 21:41 ` Peter Dyballa
2011-10-19 1:47 ` Paul Eggert
2011-10-19 22:46 ` Peter Dyballa
2011-10-19 3:43 ` Stefan Monnier
2011-10-19 13:59 ` Peter Dyballa
2011-10-19 14:44 ` Stefan Monnier
2011-10-19 14:59 ` Peter Dyballa
2011-10-19 18:00 ` Stefan Monnier
2011-10-19 21:59 ` Peter Dyballa
2011-10-20 0:32 ` Stefan Monnier
2011-07-06 22:31 ` bug#8884: wide-int crash [was Re: [PATCH updated] Support for filesystem watching (inotify)] Paul Eggert
2011-07-07 19:43 ` [PATCH updated] Support for filesystem watching (inotify) Stefan Monnier
2012-09-28 13:06 ` [PATCH] Added basic file system watching support Rüdiger Sonderfeld
2012-09-28 14:13 ` Stefan Monnier
2012-09-28 16:27 ` Rüdiger Sonderfeld
2012-10-01 4:38 ` Stefan Monnier
2012-10-01 7:24 ` Eli Zaretskii
2012-10-01 14:09 ` [PATCH] Added inotify support Rüdiger Sonderfeld
2012-10-01 16:27 ` Stefan Monnier
2012-10-02 21:28 ` Eli Zaretskii
2012-10-02 23:46 ` Óscar Fuentes
2012-10-03 2:10 ` Stefan Monnier
2012-10-03 3:54 ` Eli Zaretskii
2012-10-03 12:46 ` Stefan Monnier
2012-10-03 18:34 ` Eli Zaretskii [this message]
2012-10-03 18:47 ` Stefan Monnier
2012-10-03 19:08 ` Eli Zaretskii
2012-10-03 20:59 ` Stefan Monnier
2012-10-12 13:54 ` Eli Zaretskii
2012-10-14 14:55 ` Eli Zaretskii
2012-10-03 19:33 ` Óscar Fuentes
2012-10-05 7:40 ` Eli Zaretskii
2012-10-05 13:07 ` Óscar Fuentes
2012-10-05 15:19 ` Eli Zaretskii
2012-10-05 16:55 ` Nix
2012-10-05 17:15 ` Eli Zaretskii
2012-10-05 17:46 ` Nix
2012-10-05 18:22 ` Stefan Monnier
2012-10-05 18:30 ` Óscar Fuentes
2012-10-06 16:39 ` Nix
2012-10-06 17:01 ` Stefan Monnier
2012-10-06 18:51 ` Nix
2012-10-06 21:26 ` Stefan Monnier
2012-10-06 21:28 ` Nix
2012-10-07 7:38 ` Achim Gratz
2012-10-07 13:58 ` Stefan Monnier
2012-10-07 14:54 ` Achim Gratz
2012-10-07 8:24 ` Stephen J. Turnbull
2012-10-07 14:00 ` Stefan Monnier
2012-10-07 14:28 ` Óscar Fuentes
2012-10-07 14:38 ` Stefan Monnier
2012-10-08 7:07 ` Stephen J. Turnbull
2012-10-08 8:06 ` Eli Zaretskii
2012-10-14 15:52 ` Jim Meyering
2012-10-06 7:04 ` Stephen J. Turnbull
2012-10-06 7:23 ` Andreas Schwab
2012-10-06 16:41 ` Nix
2012-10-07 8:09 ` Stephen J. Turnbull
2012-10-07 14:08 ` Stefan Monnier
2012-10-03 3:57 ` Eli Zaretskii
2012-12-02 20:08 ` Eli Zaretskii
2012-12-03 17:18 ` Stefan Monnier
2012-12-10 14:16 ` Eli Zaretskii
2012-12-10 14:47 ` Stefan Monnier
2012-12-10 11:52 ` Eli Zaretskii
2012-12-10 12:11 ` Rüdiger Sonderfeld
2012-12-11 7:43 ` Michael Albinus
2012-12-11 8:20 ` Eli Zaretskii
2012-12-11 16:36 ` Michael Albinus
2012-12-11 16:46 ` Rüdiger Sonderfeld
2012-12-11 20:17 ` Michael Albinus
2012-12-11 7:54 ` [PATCH] Added basic file system watching support Michael Albinus
2012-12-11 8:12 ` Eli Zaretskii
2012-12-11 8:19 ` Michael Albinus
2012-12-11 8:29 ` Eli Zaretskii
2012-12-11 8:44 ` Michael Albinus
2012-12-11 9:39 ` Eli Zaretskii
2012-12-11 10:15 ` Eli Zaretskii
2012-12-11 10:38 ` Michael Albinus
2012-12-11 10:24 ` Michael Albinus
2012-12-11 12:51 ` Eli Zaretskii
2012-12-11 13:17 ` Michael Albinus
2012-12-11 13:23 ` Eli Zaretskii
2012-12-12 1:09 ` Leo
2012-12-12 3:57 ` Eli Zaretskii
2013-01-07 11:33 ` Michael Albinus
2013-01-07 15:57 ` Eli Zaretskii
2013-01-07 16:00 ` Michael Albinus
2013-01-07 20:26 ` Stefan Monnier
2013-01-08 7:44 ` Michael Albinus
2011-06-06 15:14 ` [PATCH updated] Support for filesystem watching (inotify) Stefan Monnier
2011-06-06 16:21 ` Rüdiger Sonderfeld
2012-09-18 11:50 ` [PATCH] " Leo
2012-09-26 12:15 ` Rüdiger Sonderfeld
2012-09-26 17:52 ` Stefan Monnier
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=83wqz78kx2.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.