Subject: 24.3.50; inotify-add-watch fails in batch mode
From: Chong Yidong <[email-masked]>
To: [email-masked]
Date: Sat, 09 Feb 2013 22:35:49 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

On latest trunk, `make check' fails with
2 unexpected results:
   FAILED  ert-test-record-backtrace
   FAILED  inotify-file-watch-simple

The first of this is Bug#13064 (still not fixed; I couldn't disentangle
the mess of CL-isms and closures involved in that bug).  The second
failure is relatively new: apparently, inotify-file-watch-simple works
when Emacs is interactive but fails in batch mode.

Another way to see this is to create a file with the contents

(let* ((temp-file (make-temp-file "inotify-simple"))
       (events 0)
       (wd
	(inotify-add-watch temp-file t (lambda (ev)
					 (setq events (1+ events))))))
  (unwind-protect
      (progn
	(with-temp-file temp-file
	  (insert "Foo\n"))
	(sit-for 5)
	(message ">> %d <<" events))
    (inotify-rm-watch wd)))

and run `emacs -batch -l foo.el'.  This prints ">> 0 <<", indicating
that the inotify watcher failed to run.  If you repeat omitting -batch,
">> 4 <<" is printed, as expected.

In GNU Emacs 24.3.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.4)
 of 2013-02-09 on tsparkle
Bzr revision: 111704 [email-masked]
Windowing system distributor `The X.Org Foundation', version 11.0.11301000
Configured using:
 `configure --with-x-toolkit=gtk3 CFLAGS=-g --no-create --no-recursion'