unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* inotify-based file notifications missing sometimes
@ 2014-10-25  6:17 Dima Kogan
  2014-10-25  7:34 ` Eli Zaretskii
  2014-10-25  8:04 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Dima Kogan @ 2014-10-25  6:17 UTC (permalink / raw)
  To: emacs-devel

Hi.

I ran into an issue with inotify-base file notifications when looking at
auto-revert stuff from an earlier thread. To show the issue, I build
the latest emacs from source using

 ./configure --with-file-notification=inotify

I then run

 ./emacs --eval "`cat  /tmp/tstnotify.el`" -Q -nw

with tstnotify.el being

 (progn
   (require 'filenotify)

   (dolist (fil '("/tmp/tst1" "/tmp/tst2"))
     (file-notify-add-watch fil  '(change attribute-change)
                            (lambda (event)
                              (message "notify event %s" event)))
     (find-file fil))
   (switch-to-buffer "*Messages*"))


Here I ask for notifications for two files, and print out the events as
they come in. While emacs is running this way, I modify those two files
using an external tool. I would expect to see modification events for
both of these files, but I only see them for one of the files.

The issue is that emacs doesn't ask inotify to look at the two files, it
asks it to look at the containing directory (/tmp in both cases),
filtering out all the files we don't care about later. inotify is being
intelligent, notices that we're asking to monitor the same object twice
(/tmp), and simply returns the same descriptor a second time. Emacs is
assuming a unique descriptor, and the result is that we only get
notifications for one file.

The main question is, why are monitoring the directory instead of the
objects we care about? I'm assuming that it has something to do with the
other notification backends we could possibly use. For inotify
specifically, it'd be much easier to simply look at the files (and this
bug wouldn't exist then).

Proposed solutions? I haven't filed this into the bug tracker yet since
I presume some discussion will happen first.

dima



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-29  0:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-25  6:17 inotify-based file notifications missing sometimes Dima Kogan
2014-10-25  7:34 ` Eli Zaretskii
2014-10-25  7:44   ` Michael Albinus
2014-10-29  0:15     ` Dima Kogan
2014-10-25  8:04 ` Eli Zaretskii
2014-10-25  8:27   ` Dima Kogan
2014-10-25  9:04     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).