Subject: bug#18880: closed (Re: bug#18880: 25.0.50; inotify-based file notifications missing sometimes)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 17 Feb 2015 19:32:03 +0000

Your bug report

#18880: 25.0.50; inotify-based file notifications missing sometimes

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
18880: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18880
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#18880: 25.0.50; inotify-based file notifications missing sometimes
From: Michael Albinus <[email-masked]>
To: Dima Kogan <[email-masked]>
Cc: [email-masked]
Date: Tue, 17 Feb 2015 20:30:52 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.5

Michael Albinus <[email-masked]> writes:

> I've committed a patch to the emacs-24 branch; could you, please, check?

No reaction for weeks; I set this bug as closed. If there are still
problems, please reopen.

Best regards, Michael.

Subject: 25.0.50; inotify-based file notifications missing sometimes
From: Dima Kogan <[email-masked]>
To: [email-masked]
Date: Tue, 28 Oct 2014 17:11:10 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

This bug is about an issue on the emacs-devel-mailing list:

 http://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00911.html

The main message is copied below:

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.