GNU bug report logs - #20299
25.0.50; File notification is not working

Previous Next

Package: emacs;

Reported by: Sean McAfee <eefacm <at> gmail.com>

Date: Sat, 11 Apr 2015 00:41:01 UTC

Severity: normal

Tags: notabug

Found in version 25.0.50

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20299 in the body.
You can then email your comments to 20299 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20299; Package emacs. (Sat, 11 Apr 2015 00:41:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sean McAfee <eefacm <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 11 Apr 2015 00:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sean McAfee <eefacm <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; File notification is not working
Date: Fri, 10 Apr 2015 17:39:48 -0700
[Message part 1 (text/plain, inline)]
I recently started a new job, where I have been supplied with the laptop
I'm now using.  I noticed that magit-auto-revert-mode was not having any
effect; checking out a new branch using Magit did not revert any of the
buffers visiting files which were different on the previous branch.

I dug into the source and found that the culprit is the function
auto-revert-handler, and specifically the expression:

(or (not auto-revert-use-notify)
  auto-revert-notify-modified-p)

auto-revert-use-notify had a value of t, and yet
auto-revert-notify-modified-p was nil even in buffers whose associated
files had changed out from under them.  I verified this visiting a file,
then repeatedly issuing the shell command "echo foo >> my-file" and then
evaluating the expression (auto-revert-handler) with M-:, but the file
never got reverted.

I found a note to the effect that this feature would only be active if
Emacs had been compiled with file notification support.  I would have
expected auto-revert-use-notify to be given a suitable default value
depending on whether such support was available, but in any case I went
to my local emacs git repo, pulled down the latest changes, and
recompiled after providing the --with-file-notification=inotify flag to
configure.  Even after this change, though, file notification still
isn't working.

I can just set auto-revert-use-notify to nil going forward, but it would
be nice to get file notification working as intended.



In GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
 of 2015-04-10 on sean-Latitude-E7440
Repository revision: f55ea05bdf60e24c09f9064fc0d2e8a114d6e358
Windowing system distributor `The X.Org Foundation', version 11.0.11600000
System Description:    Ubuntu 14.10

Configured using:
 `configure --with-file-notification=inotify'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Shell

Minor modes in effect:
  recentf-mode: t
  projectile-global-mode: t
  projectile-mode: t
  global-anzu-mode: t
  anzu-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  google-this-mode: t
  global-flycheck-mode: t
  minibuffer-depth-indicate-mode: t
  ido-everywhere: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  override-global-mode: t
  show-paren-mode: t
  electric-pair-mode: t
  savehist-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent messages:
Cleaning up the recentf list...done (2 removed)
~/emacs-src
Template key:
Clipboard pasted as level 4 subtree
C-c C-g is undefined
ad-handle-definition: `bookmark-jump' got redefined
Saving bookmarks to file ~/.emacs.d/bookmarks...
Wrote /home/sean/.emacs.d/bookmarks
Saving bookmarks to file ~/.emacs.d/bookmarks...done
Wrote /home/sean/done.org

Load-path shadows:
~/emacs/japanese hides /usr/local/share/emacs/25.0.50/lisp/language/japanese

Features:
(shadow sort mail-extr emacsbug sendmail bookmark tabify org-datetree
org-capture pcmpl-unix recentf tree-widget eww mm-url url-queue shr dom
browse-url js-mode-expansions js imenu cc-mode-expansions cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs sh-script smie executable restclient conf-mode cap-words
superword subword scala-mode2 scala-mode2-imenu scala-mode2-sbt
scala-mode2-map scala-mode2-fontlock scala-mode2-indent
scala-mode2-paragraph scala-mode2-lib html-mode-expansions sgml-mode
org-element org-rmail org-mhe org-irc org-info org-gnus org-docview
doc-view image-mode org-bibtex bibtex org-bbdb org-w3m
the-org-mode-expansions org org-macro org-footnote org-pcomplete
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
ob-comint ob-core ob-eval org-compat org-macs org-loaddefs cal-menu
calendar cal-loaddefs gnus-dired jka-compr vc vc-dispatcher vc-git
projectile ibuf-ext ibuffer elisp-slime-nav etags xref anzu mule-util
magit-key-mode magit view tramp tramp-compat tramp-loaddefs trampver
shell pcomplete epa epg diff-mode autorevert filenotify git-rebase-mode
git-commit-mode log-edit message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader pcvs-util add-log google-this
flycheck find-func rx subr-x cyberpunk-theme ensime ensime-ui
ensime-semantic-highlight ensime-doc ensime-scalex url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse auth-source eieio eieio-core cl-generic
password-cache mailcap ensime-search ensime-undo ensime-startup
ensime-refactor ensime-popup ensime-notes ensime-model ensime-mode
ensime-inspector ensime-goto-testfile ensime-editor ensime-debug gdb-mi
bindat json gud ensime-stacktrace ensime-inf ensime-sbt sbt-mode
sbt-mode-rgrep grep sbt-mode-comint sbt-mode-buffer sbt-mode-project
ensime-company yasnippet help-mode company ensime-auto-complete
ensime-completion-util scala-mode2-syntax ensime-config ensime-vars s
ucs-normalize ensime-util auto-complete popup flymake hideshow pp
arc-mode archive-mode dash url-gw url-vars ensime-client derived
ensime-macros warnings gnus gnus-ems nnheader gnus-util mail-utils
mm-util mail-prsvr wid-edit mb-depth ido dired-details+ dired
dired-details anchored-transpose change-inner expand-region
text-mode-expansions er-basic-expansions expand-region-core
expand-region-custom org-bullets multiple-cursors
mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors
mc-edit-lines multiple-cursors-core byte-opt advice rect undo-tree diff
ack compile comint ansi-color ring paredit edmacro kmacro use-package
diminish bytecomp byte-compile cl-extra seq cconv bind-key easy-mmode
finder-inf info easymenu package epg-config paren elec-pair savehist
desktop frameset server thingatpt help-fns perl-mode cl-macs cl gv
cl-loaddefs pcase cl-lib time-date tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

Memory information:
((conses 16 567561 51984)
 (symbols 48 51197 0)
 (miscs 40 2332 364)
 (strings 32 121532 20169)
 (string-bytes 1 3675027)
 (vectors 16 75299)
 (vector-slots 8 1788518 105160)
 (floats 8 456 780)
 (intervals 56 4135 309)
 (buffers 976 64)
 (heap 1024 54594 2035))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20299; Package emacs. (Sat, 11 Apr 2015 07:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 20299 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Sean McAfee <eefacm <at> gmail.com>
Cc: 20299 <at> debbugs.gnu.org
Subject: Re: bug#20299: 25.0.50; File notification is not working
Date: Sat, 11 Apr 2015 09:03:19 +0200
Sean McAfee <eefacm <at> gmail.com> writes:

Hi Sean,

> auto-revert-use-notify had a value of t, and yet
> auto-revert-notify-modified-p was nil even in buffers whose associated
> files had changed out from under them. I verified this visiting a
> file,
> then repeatedly issuing the shell command "echo foo >> my-file" and
> then
> evaluating the expression (auto-revert-handler) with M-:, but the file
> never got reverted.

On which directory have you done this? Note, that inotify does not work
on mounted directories.

> I can just set auto-revert-use-notify to nil going forward, but it
> would
> be nice to get file notification working as intended.

Another test you might apply is setting prior magit-auto-revert-mode

(require 'filenotify)
(require 'trace)
(dolist (elt (all-completions "file-notify-" obarray 'functionp))
  (trace-function (intern elt)))

You will observe in the buffer *trace-output*, whether file
notifications events arrive.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20299; Package emacs. (Thu, 16 Apr 2015 14:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 20299 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Sean McAfee <eefacm <at> gmail.com>
Cc: 20299 <at> debbugs.gnu.org
Subject: Re: bug#20299: 25.0.50; File notification is not working
Date: Thu, 16 Apr 2015 16:25:30 +0200
Sean McAfee <eefacm <at> gmail.com> writes:

[Pls keep the Cc for the archives]

> Anyway, here's what I just did:
>
> * Started Emacs with "emacs -Q"
> * (require 'filenotify)
> * (require 'trace)
> * Evaluated your (dolist ...) expression from above
> * (require 'auto-revert)

Not needed.

> * Visit a file

Here you must apply "M-x auto-revert-mode".

> * Append to the file by executing a shell command
> * Evaluated (auto-revert-handler)
>
> The file was not reverted, and the complete list of open buffers at
> that time were foo.txt (visiting my test file), *scratch*, *Messages*,
> *Shell Command Output*, and *Backtrace*. Nothing trace-related that I
> can see. It appears that none of the file-notify-* functions are ever
> called, even though I built Emacs with the -
> -with-file-notification=inotify configuration switch.
>
> --Sean

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20299; Package emacs. (Sat, 18 Apr 2015 16:55:02 GMT) Full text and rfc822 format available.

Message #14 received at 20299 <at> debbugs.gnu.org (full text, mbox):

From: Sean McAfee <eefacm <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 20299 <at> debbugs.gnu.org
Subject: Re: bug#20299: 25.0.50; File notification is not working
Date: Sat, 18 Apr 2015 09:54:16 -0700
Michael Albinus <michael.albinus <at> gmx.de> writes:
> Here you must apply "M-x auto-revert-mode".

Ah, I didn't realize this was necessary.  I assumed Emacs would receive
file notification events for all open files if it was built with that
capability, since it seems an inexpensive enough operation.

This would seem to be more of a Magit issue than an Emacs issue.  I'll
re-report my original issue in the appropriate place (although it's hard
to imagine that such a substantial feature being broken could have gone
unnoticed by anyone other than me by now).

Thanks for the help!


--Sean




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20299; Package emacs. (Sat, 18 Apr 2015 17:53:02 GMT) Full text and rfc822 format available.

Message #17 received at 20299 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Sean McAfee <eefacm <at> gmail.com>
Cc: 20299 <at> debbugs.gnu.org
Subject: Re: bug#20299: 25.0.50; File notification is not working
Date: Sat, 18 Apr 2015 19:51:51 +0200
Sean McAfee <eefacm <at> gmail.com> writes:

> Michael Albinus <michael.albinus <at> gmx.de> writes:
>> Here you must apply "M-x auto-revert-mode".
>
> Ah, I didn't realize this was necessary.  I assumed Emacs would receive
> file notification events for all open files if it was built with that
> capability, since it seems an inexpensive enough operation.

Inexpensive if you have native support like inotify. If you use glib,
for example, it might be necessary to poll, which is more heavy.

> This would seem to be more of a Magit issue than an Emacs issue.  I'll
> re-report my original issue in the appropriate place (although it's hard
> to imagine that such a substantial feature being broken could have gone
> unnoticed by anyone other than me by now).

OK, so I'm closing this bug. Feel free to come back if needed.

> Thanks for the help!
>
> --Sean

Best regards, Michael.




Added tag(s) notabug. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Sat, 18 Apr 2015 17:53:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 20299 <at> debbugs.gnu.org and Sean McAfee <eefacm <at> gmail.com> Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Sat, 18 Apr 2015 17:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20299; Package emacs. (Sun, 19 Apr 2015 08:28:02 GMT) Full text and rfc822 format available.

Message #24 received at 20299 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Sean McAfee <eefacm <at> gmail.com>
Cc: 20299 <at> debbugs.gnu.org
Subject: Re: bug#20299: 25.0.50; File notification is not working
Date: Sun, 19 Apr 2015 10:27:42 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Sean McAfee <eefacm <at> gmail.com> writes:
>
>> Michael Albinus <michael.albinus <at> gmx.de> writes:
>>> Here you must apply "M-x auto-revert-mode".
>>
>> Ah, I didn't realize this was necessary.  I assumed Emacs would receive
>> file notification events for all open files if it was built with that
>> capability, since it seems an inexpensive enough operation.
>
> Inexpensive if you have native support like inotify. If you use glib,
> for example, it might be necessary to poll, which is more heavy.

PS: If you want to run all buffers in auto-revert-mode per default, you
could apply "M-x global-auto-revert-mode".

>> Thanks for the help!

Bst regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 May 2015 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 88 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.