GNU bug report logs - #51146
29.0.50; file-notify-add-watch not reporting changes of files

Previous Next

Package: emacs;

Reported by: Carlos Pita <carlosjosepita2 <at> gmail.com>

Date: Tue, 12 Oct 2021 04:18:02 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 28.1

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 51146 in the body.
You can then email your comments to 51146 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#51146; Package emacs. (Tue, 12 Oct 2021 04:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Carlos Pita <carlosjosepita2 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 Oct 2021 04:18:02 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita2 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; file-notify-add-watch not reporting changes of files
Date: Tue, 12 Oct 2021 01:16:50 -0300
Hi all,

the docstring for file-notify-add-watch states:
   
    If FILE is a directory, ‘change’ watches for file creation or
    deletion in that directory.  This does not work recursively.

OTOH the elisp documentation in [1] states:

     If file is a directory, changes for all files in that directory
     will be notified. This does not work recursively.

So the statements seem contradictory regarding the notification of
changes in the contents of the files (not their creation or
deletion). In the most lenient interpretation, the docstring may be
considered silent in this regard.

This little experiment shows that, at least in my setup, a change in the
content of a file is not notified:

    (defun my-watcher (event) (message "Not in my watch: %s" event))

    (file-notify-add-watch "/tmp/some-dir" '(change) #'my-watcher)

Then:

    touch /tmp/some-dir/x => Not in my watch: (18 created /tmp/some-dir/x)
    echo dsds > /tmp/some-dir/x => Nothing
    rm  /tmp/some-dir/x => Not in my watch: (18 deleted /tmp/some-dir/x)

If instead I track "/tmp/some-dir/x":

    echo dsds > /tmp/some-dir/x =>
        Not in my watch: (20 changed /tmp/some-dir/x)

So according to the elisp manual this is a bug, but according to the
docstring it seemingly isn't. I'm with the manual in this one.

Best regards,
Carlos

[1] https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Notifications.html

---
        

In GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin20.6.0, NS appkit-2022.60 Version 11.6 (Build 20G165))
 of 2021-10-07 built on Carloss-MacBook-Pro.local
Repository revision: d2611920685ca415a1d85ffb9567b968518028d6
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.6

Configured using:
 'configure --without-native-compilation'

Configured features:
ACL DBUS GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE
NS PDUMPER PNG RSVG THREADS TIFF TOOLKIT_SCROLL_BARS XIM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
  shell-dirtrack-mode: t
  recentf-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  company-box-mode: t
  global-flycheck-mode: t
  ivy-mode: t
  global-company-mode: t
  company-mode: t
  which-key-mode: t
  winner-mode: t
  override-global-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  electric-pair-mode: t
  minions-mode: t
  doom-modeline-mode: t
  ns-auto-titlebar-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-history-mode: t
  tab-bar-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
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/carlos/.emacs.d/straight/build/transient/transient hides /Applications/Emacs.app/Contents/Resources/lisp/transient
/Users/carlos/.emacs.d/straight/build/org/ob-exp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-exp
/Users/carlos/.emacs.d/straight/build/org/ob-emacs-lisp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-emacs-lisp
/Users/carlos/.emacs.d/straight/build/org/oc hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc
/Users/carlos/.emacs.d/straight/build/org/ob-css hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-css
/Users/carlos/.emacs.d/straight/build/org/ob-lob hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lob
/Users/carlos/.emacs.d/straight/build/org/ol-irc hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-irc
/Users/carlos/.emacs.d/straight/build/org/ob-forth hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-forth
/Users/carlos/.emacs.d/straight/build/org/org-macs hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-macs
/Users/carlos/.emacs.d/straight/build/org/ob hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob
/Users/carlos/.emacs.d/straight/build/org/org-version hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-version
/Users/carlos/.emacs.d/straight/build/org/ob-scheme hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-scheme
/Users/carlos/.emacs.d/straight/build/org/ox hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox
/Users/carlos/.emacs.d/straight/build/org/ob-C hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-C
/Users/carlos/.emacs.d/straight/build/org/org-capture hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-capture
/Users/carlos/.emacs.d/straight/build/org/ob-ref hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ref
/Users/carlos/.emacs.d/straight/build/org/ob-clojure hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-clojure
/Users/carlos/.emacs.d/straight/build/org/org-mouse hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mouse
/Users/carlos/.emacs.d/straight/build/org/org-ctags hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-ctags
/Users/carlos/.emacs.d/straight/build/org/org-entities hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-entities
/Users/carlos/.emacs.d/straight/build/org/org-archive hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-archive
/Users/carlos/.emacs.d/straight/build/org/ob-screen hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-screen
/Users/carlos/.emacs.d/straight/build/org/ol-bibtex hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-bibtex
/Users/carlos/.emacs.d/straight/build/org/ob-haskell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-haskell
/Users/carlos/.emacs.d/straight/build/org/org-table hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-table
/Users/carlos/.emacs.d/straight/build/org/ol-eww hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-eww
/Users/carlos/.emacs.d/straight/build/org/ox-org hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-org
/Users/carlos/.emacs.d/straight/build/org/org-num hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-num
/Users/carlos/.emacs.d/straight/build/org/org-plot hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-plot
/Users/carlos/.emacs.d/straight/build/org/ol-rmail hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-rmail
/Users/carlos/.emacs.d/straight/build/org/ob-awk hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-awk
/Users/carlos/.emacs.d/straight/build/org/ob-groovy hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-groovy
/Users/carlos/.emacs.d/straight/build/org/ob-octave hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-octave
/Users/carlos/.emacs.d/straight/build/org/org-faces hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-faces
/Users/carlos/.emacs.d/straight/build/org/oc-biblatex hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc-biblatex
/Users/carlos/.emacs.d/straight/build/org/org-colview hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-colview
/Users/carlos/.emacs.d/straight/build/org/ob-R hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-R
/Users/carlos/.emacs.d/straight/build/org/org-refile hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-refile
/Users/carlos/.emacs.d/straight/build/org/org-timer hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-timer
/Users/carlos/.emacs.d/straight/build/org/org-mobile hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-mobile
/Users/carlos/.emacs.d/straight/build/org/ob-fortran hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-fortran
/Users/carlos/.emacs.d/straight/build/org/ob-shell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-shell
/Users/carlos/.emacs.d/straight/build/org/ob-perl hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-perl
/Users/carlos/.emacs.d/straight/build/org/ob-sqlite hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sqlite
/Users/carlos/.emacs.d/straight/build/org/oc-basic hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc-basic
/Users/carlos/.emacs.d/straight/build/org/ob-sed hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sed
/Users/carlos/.emacs.d/straight/build/org/org-list hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-list
/Users/carlos/.emacs.d/straight/build/org/ob-ruby hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ruby
/Users/carlos/.emacs.d/straight/build/org/ob-eval hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-eval
/Users/carlos/.emacs.d/straight/build/org/org-habit hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-habit
/Users/carlos/.emacs.d/straight/build/org/org-clock hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-clock
/Users/carlos/.emacs.d/straight/build/org/org-goto hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-goto
/Users/carlos/.emacs.d/straight/build/org/ox-html hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-html
/Users/carlos/.emacs.d/straight/build/org/org-src hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-src
/Users/carlos/.emacs.d/straight/build/org/ob-lisp hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lisp
/Users/carlos/.emacs.d/straight/build/org/ol-eshell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-eshell
/Users/carlos/.emacs.d/straight/build/org/ob-ditaa hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ditaa
/Users/carlos/.emacs.d/straight/build/org/org-pcomplete hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-pcomplete
/Users/carlos/.emacs.d/straight/build/org/org-lint hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-lint
/Users/carlos/.emacs.d/straight/build/org/ox-latex hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-latex
/Users/carlos/.emacs.d/straight/build/org/ob-sass hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sass
/Users/carlos/.emacs.d/straight/build/org/ob-tangle hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-tangle
/Users/carlos/.emacs.d/straight/build/org/ob-calc hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-calc
/Users/carlos/.emacs.d/straight/build/org/ob-java hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-java
/Users/carlos/.emacs.d/straight/build/org/ox-icalendar hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-icalendar
/Users/carlos/.emacs.d/straight/build/org/ol-mhe hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-mhe
/Users/carlos/.emacs.d/straight/build/org/org-attach-git hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-attach-git
/Users/carlos/.emacs.d/straight/build/org/ox-md hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-md
/Users/carlos/.emacs.d/straight/build/org/ox-beamer hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-beamer
/Users/carlos/.emacs.d/straight/build/org/org-element hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-element
/Users/carlos/.emacs.d/straight/build/org/oc-natbib hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc-natbib
/Users/carlos/.emacs.d/straight/build/org/org-protocol hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-protocol
/Users/carlos/.emacs.d/straight/build/org/ob-gnuplot hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-gnuplot
/Users/carlos/.emacs.d/straight/build/org/org-tempo hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-tempo
/Users/carlos/.emacs.d/straight/build/org/ob-latex hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-latex
/Users/carlos/.emacs.d/straight/build/org/ol-w3m hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-w3m
/Users/carlos/.emacs.d/straight/build/org/org-id hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-id
/Users/carlos/.emacs.d/straight/build/org/ox-man hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-man
/Users/carlos/.emacs.d/straight/build/org/ol-doi hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-doi
/Users/carlos/.emacs.d/straight/build/org/org-feed hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-feed
/Users/carlos/.emacs.d/straight/build/org/ob-julia hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-julia
/Users/carlos/.emacs.d/straight/build/org/ob-lua hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lua
/Users/carlos/.emacs.d/straight/build/org/ob-table hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-table
/Users/carlos/.emacs.d/straight/build/org/ob-ocaml hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-ocaml
/Users/carlos/.emacs.d/straight/build/org/oc-csl hides /Applications/Emacs.app/Contents/Resources/lisp/org/oc-csl
/Users/carlos/.emacs.d/straight/build/org/ol-gnus hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-gnus
/Users/carlos/.emacs.d/straight/build/org/org-indent hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-indent
/Users/carlos/.emacs.d/straight/build/org/ob-lilypond hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-lilypond
/Users/carlos/.emacs.d/straight/build/org/ob-matlab hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-matlab
/Users/carlos/.emacs.d/straight/build/org/org-datetree hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-datetree
/Users/carlos/.emacs.d/straight/build/org/ol-docview hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-docview
/Users/carlos/.emacs.d/straight/build/org/ob-python hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-python
/Users/carlos/.emacs.d/straight/build/org/ob-makefile hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-makefile
/Users/carlos/.emacs.d/straight/build/org/org-duration hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-duration
/Users/carlos/.emacs.d/straight/build/org/org-agenda hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-agenda
/Users/carlos/.emacs.d/straight/build/org/ob-dot hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-dot
/Users/carlos/.emacs.d/straight/build/org/ob-js hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-js
/Users/carlos/.emacs.d/straight/build/org/ox-publish hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-publish
/Users/carlos/.emacs.d/straight/build/org/org-inlinetask hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-inlinetask
/Users/carlos/.emacs.d/straight/build/org/ob-org hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-org
/Users/carlos/.emacs.d/straight/build/org/org-keys hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-keys
/Users/carlos/.emacs.d/straight/build/org/ob-core hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-core
/Users/carlos/.emacs.d/straight/build/org/org-compat hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-compat
/Users/carlos/.emacs.d/straight/build/org/ol hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol
/Users/carlos/.emacs.d/straight/build/org/ox-odt hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-odt
/Users/carlos/.emacs.d/straight/build/org/ol-info hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-info
/Users/carlos/.emacs.d/straight/build/org/ob-plantuml hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-plantuml
/Users/carlos/.emacs.d/straight/build/org/ob-eshell hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-eshell
/Users/carlos/.emacs.d/straight/build/org/ox-ascii hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-ascii
/Users/carlos/.emacs.d/straight/build/org/org-loaddefs hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-loaddefs
/Users/carlos/.emacs.d/straight/build/org/ox-koma-letter hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-koma-letter
/Users/carlos/.emacs.d/straight/build/org/ob-maxima hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-maxima
/Users/carlos/.emacs.d/straight/build/org/org hides /Applications/Emacs.app/Contents/Resources/lisp/org/org
/Users/carlos/.emacs.d/straight/build/org/ol-bbdb hides /Applications/Emacs.app/Contents/Resources/lisp/org/ol-bbdb
/Users/carlos/.emacs.d/straight/build/org/org-macro hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-macro
/Users/carlos/.emacs.d/straight/build/org/ob-sql hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-sql
/Users/carlos/.emacs.d/straight/build/org/org-attach hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-attach
/Users/carlos/.emacs.d/straight/build/org/ob-processing hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-processing
/Users/carlos/.emacs.d/straight/build/org/ox-texinfo hides /Applications/Emacs.app/Contents/Resources/lisp/org/ox-texinfo
/Users/carlos/.emacs.d/straight/build/org/org-crypt hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-crypt
/Users/carlos/.emacs.d/straight/build/org/org-footnote hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-footnote
/Users/carlos/.emacs.d/straight/build/org/org-install hides /Applications/Emacs.app/Contents/Resources/lisp/org/org-install
/Users/carlos/.emacs.d/straight/build/org/ob-comint hides /Applications/Emacs.app/Contents/Resources/lisp/org/ob-comint
/Users/carlos/.emacs.d/straight/build/let-alist/let-alist hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/let-alist

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec epa derived
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mailabbrev
gmm-utils mailheader sendmail mail-utils ffap debug backtrace eieio-opt
speedbar ezimage dframe shortdoc cl-print help-fns trace view lsp-zig
lsp-steep lsp-svelte lsp-sqls lsp-yaml lsp-xml lsp-vimscript lsp-vhdl
lsp-vetur lsp-html lsp-verilog lsp-vala lsp-v lsp-terraform lsp-tex
lsp-sorbet lsp-solargraph lsp-rust lsp-rf lsp-r lsp-purescript lsp-pylsp
lsp-pyls lsp-pwsh lsp-php lsp-perl lsp-ocaml lsp-nix lsp-nim
lsp-markdown lsp-lua lsp-kotlin lsp-json url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf mailcap
lsp-javascript lsp-haxe lsp-groovy lsp-hack lsp-graphql lsp-go
lsp-completion lsp-gdscript lsp-fsharp lsp-fortran lsp-eslint lsp-erlang
lsp-elixir lsp-elm lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp
gnutls lsp-crystal lsp-cmake lsp-clojure lsp-semantic-tokens lsp-clangd
dom lsp-beancount lsp-bash lsp-angular lsp-ada lsp-actionscript
lsp-pyright lsp-treemacs lsp-treemacs-themes lsp-ui lsp-ui-flycheck
lsp-ui-doc goto-addr lsp-ui-imenu lsp-ui-peek lsp-ui-sideline
lsp-ui-util lsp-mode lsp-protocol url-util spinner network-stream puny
nsm rmc markdown-mode url-parse url-vars ewoc epg rfc6068 epg-config
python tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat shell pcomplete parse-time iso8601 ls-lisp format-spec
auth-source password-cache thingatpt recentf tree-widget wid-edit
treemacs-bookmarks bookmark pp vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs vc time-date vc-git diff-mode vc-dispatcher treemacs
treemacs-header-line treemacs-compatibility treemacs-mode
treemacs-interface treemacs-extensions treemacs-mouse-interface
treemacs-tags imenu treemacs-persistence treemacs-filewatch-mode
filenotify treemacs-follow-mode treemacs-rendering treemacs-async
treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-scope eieio eieio-core eieio-loaddefs
pulse treemacs-faces treemacs-icons treemacs-themes treemacs-core-utils
pfuture inline hl-line ht treemacs-logging treemacs-customization
treemacs-macros company-box company-box-doc frame-local
company-box-icons display-line-numbers noutline outline server
pdf-tools-autoloads tablist-autoloads org-roam-autoloads
emacsql-sqlite-autoloads emacsql-autoloads lsp-pyright-autoloads
pyvenv-autoloads dired-x exec-path-from-shell
exec-path-from-shell-autoloads hl-todo-autoloads flycheck json map
find-func flycheck-autoloads let-alist-autoloads pkg-info-autoloads
epl-autoloads dap-mode-autoloads bui-autoloads lsp-treemacs-autoloads
lsp-ivy-autoloads lsp-ui-autoloads lsp-mode-autoloads
markdown-mode-autoloads spinner-autoloads git-timemachine-autoloads
treemacs-magit-autoloads magit-autoloads magit-section-autoloads
git-commit-autoloads with-editor-autoloads transient-autoloads
treemacs-autoloads autoload radix-tree lisp-mnt mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr cfrs-autoloads
posframe-autoloads ht-autoloads pfuture-autoloads ace-window-autoloads
projectile-autoloads ivy-hydra hydra lv ivy-hydra-autoloads
hydra-autoloads lv-autoloads counsel xdg dired dired-loaddefs compile
text-property-search comint ansi-color swiper ivy delsel ivy-faces
ivy-overlay colir color counsel-autoloads swiper-autoloads ivy-autoloads
company-box-autoloads frame-local-autoloads company-oddmuse
company-keywords company-etags etags fileloop generator xref project
company-gtags company-dabbrev-code company-dabbrev company-files
company-clang company-capf company-cmake company-semantic
company-template company-bbdb company pcase company-autoloads which-key
advice which-key-autoloads winner ring visual-fill-column
visual-fill-column-autoloads wgrep-autoloads edmacro kmacro
avy-autoloads use-package-bind-key bind-key easy-mmode undo-tree diff
undo-tree-autoloads elec-pair minions minions-autoloads doom-modeline
doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path
rx f s all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons dash
doom-modeline-autoloads shrink-path-autoloads f-autoloads dash-autoloads
s-autoloads all-the-icons-autoloads doom-themes-ext-org
doom-themes-ext-treemacs doom-themes-ext-visual-bell face-remap
doom-solarized-light-theme doom-themes doom-themes-base
doom-themes-autoloads finder-inf ns-auto-titlebar
ns-auto-titlebar-autoloads use-package-core use-package-autoloads
bind-key-autoloads straight-autoloads info cl-seq cl-extra help-mode seq
byte-opt straight subr-x cl-macs gv cl-loaddefs cl-lib bytecomp
byte-compile cconv iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads dbusbind kqueue cocoa ns
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 420887 23959)
 (symbols 48 34109 3)
 (strings 32 119478 4553)
 (string-bytes 1 3924129)
 (vectors 16 64593)
 (vector-slots 8 958649 36362)
 (floats 8 1593 1052)
 (intervals 56 3043 2099)
 (buffers 992 26))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51146; Package emacs. (Tue, 12 Oct 2021 04:31:02 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita2 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 29.0.50; file-notify-add-watch not reporting changes of files
Date: Tue, 12 Oct 2021 01:30:46 -0300
May be relevant, this is macOS so no inotify:

    Does Emacs use a file notification library?             yes (kqueue)

and:

    conftest.c:143:10: fatal error: 'sys/inotify.h' file not found
    #include <sys/inotify.h>
             ^~~~~~~~~~~~~~~




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51146; Package emacs. (Tue, 12 Oct 2021 04:53:02 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita2 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 29.0.50; file-notify-add-watch not reporting changes of files
Date: Tue, 12 Oct 2021 01:52:37 -0300
According to https://news.ycombinator.com/item?id=9063910 the difference
I noticed is in fact a difference between kqueue and inotify.

This is the only disclaimer the elisp manual does wrt kqueue:

     Likewise, the kqueue library does not report reliably file
     attribute changes when watching a directory.

So nothing about changes in file contents. Given that the documentation
also states:

     Since all these libraries emit different events on notified file
     changes, there is the Emacs library filenotify which provides a
     unified interface. Lisp programs that want to receive file
     notifications should always use this library in preference to the
     native ones.

I think that either this is a bug or the documentation is very
misleading in that the library provides a unified interface. If it is a
bug, it doesn't seem to be an easy cure, at least if we are to believe
what was said in the referenced ycombinator thread.

Best regards,
Carlos




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51146; Package emacs. (Tue, 12 Oct 2021 13:55:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Carlos Pita <carlosjosepita2 <at> gmail.com>
Cc: 51146 <at> debbugs.gnu.org
Subject: Re: bug#51146: 29.0.50;
 file-notify-add-watch not reporting changes of files
Date: Tue, 12 Oct 2021 16:54:17 +0300
> From: Carlos Pita <carlosjosepita2 <at> gmail.com>
> Date: Tue, 12 Oct 2021 01:52:37 -0300
> 
> I think that either this is a bug or the documentation is very
> misleading in that the library provides a unified interface. If it is a
> bug, it doesn't seem to be an easy cure, at least if we are to believe
> what was said in the referenced ycombinator thread.

IMO, this is a bug in macOS: the kqueue feature is incomplete and
unreliable.  I suggest to file a bug report with kqueue developers
about that.  I don't see how Emacs can do anything to improve the
situation on macOS regarding file notifications, as long as macOS
doesn't get their act together and fix this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51146; Package emacs. (Tue, 12 Oct 2021 14:43:01 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita2 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51146 <at> debbugs.gnu.org
Subject: Re: bug#51146: 29.0.50; file-notify-add-watch not reporting changes
 of files
Date: Tue, 12 Oct 2021 11:41:36 -0300
Hi Eli,

> IMO, this is a bug in macOS: the kqueue feature is incomplete and
> unreliable.  I suggest to file a bug report with kqueue developers
> about that.  I don't see how Emacs can do anything to improve the
> situation on macOS regarding file notifications, as long as macOS
> doesn't get their act together and fix this.

I agree there's not a lot that Emacs can do here. I disagree in than
it's a bug in macOS. Although I'm not an expert in the matter from what
I have been reading this is a fact about watchers implemented on top of
kqueue. See for example this remark in the documentation of fswatch [1]:

    The kqueue monitor requires a file descriptor to be opened for every
    file being watched. As a result, this monitor scales badly with the
    number of files being observed and may begin to misbehave as soon as
    the fswatch process runs out of file descriptors. In this case,
    fswatch dumps one error on standard error for every file that cannot
    be opened so that users are notified and can take action, including
    terminating the fswatch session. Beware that on some systems the
    maximum number of file descriptors that can be opened by a process
    is set to a very low value (values as low as 256 are not uncommon),
    even if the operating system may allow a much larger value.

They also present a number of alternatives:

    - Consider raising the number of maximum open file descriptors.
    - Consider using the (--directories, -d) option.
    - Consider using another monitor.

The --directories option:

    Request the monitor to watch directories only during a recursive
    scan. This feature helps reducing the number of open file
    descriptors if a generic change event for a directory is acceptable
    instead of events on directory children.

So it's not a strategy that fully addresses the problem and, moreover,
it will miss directory changes that are part of the contract of
file-notify-add-watch anyway.

Besides the aforementioned problems of scalability, watching each file
would lead to a more complex implementation that updates the list of
watched files each time an add/remove event is detected.

Is there is no other option I sympathize with the idea of leaving emacs
alone, but the documentation is still lacking and should be very clear
about what to expect in the case of kqueue (as the documentation quoted
above is). Also the documentation in the manual and in the docstring
should converge.

Best regards,
Carlos

---

[1] http://emcrisostomo.github.io/fswatch/doc/1.16.0/fswatch.html/Monitors.html#Peculiarities-1




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51146; Package emacs. (Tue, 12 Oct 2021 14:53:02 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita2 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51146 <at> debbugs.gnu.org
Subject: Re: bug#51146: 29.0.50; file-notify-add-watch not reporting changes
 of files
Date: Tue, 12 Oct 2021 11:52:20 -0300
That was about kqueue, but in macOS there is the FSEvents monitor:

   The FSEvents monitor, available only on Apple macOS, has no known
   limitations and scales very well with the number of files being
   observed. In fact, I observed no performance degradation when testing
   fswatch observing changes on a filesystem of 500 GB over long periods
   of time. This is the default monitor on Apple macOS.

So this seems to be an option, either directly or through fswatch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51146; Package emacs. (Wed, 13 Oct 2021 07:46:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Carlos Pita <carlosjosepita2 <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 51146 <at> debbugs.gnu.org
Subject: Re: bug#51146: 29.0.50; file-notify-add-watch not reporting changes
 of files
Date: Wed, 13 Oct 2021 09:45:23 +0200
Carlos Pita <carlosjosepita2 <at> gmail.com> writes:

> That was about kqueue, but in macOS there is the FSEvents monitor:
>
>    The FSEvents monitor, available only on Apple macOS, has no known
>    limitations and scales very well with the number of files being
>    observed. In fact, I observed no performance degradation when testing
>    fswatch observing changes on a filesystem of 500 GB over long periods
>    of time. This is the default monitor on Apple macOS.
>
> So this seems to be an option, either directly or through fswatch.

Of course. I wrote the Emacs kqueue support on top of FreeBSD. Likely, I
won't write something macOS specific, since I have no respective
machine, and I'm not interested in. Somebody else must do the job, if
required.

(And I will analyze your bug report in detail next days, as time permits).

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51146; Package emacs. (Fri, 15 Oct 2021 12:08:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Carlos Pita <carlosjosepita2 <at> gmail.com>
Cc: 51146 <at> debbugs.gnu.org
Subject: Re: bug#51146: 29.0.50; file-notify-add-watch not reporting changes
 of files
Date: Fri, 15 Oct 2021 14:06:51 +0200
Carlos Pita <carlosjosepita2 <at> gmail.com> writes:

> Hi all,

Hi Carlos,

> the docstring for file-notify-add-watch states:
>    
>     If FILE is a directory, ‘change’ watches for file creation or
>     deletion in that directory.  This does not work recursively.
>
> OTOH the elisp documentation in [1] states:
>
>      If file is a directory, changes for all files in that directory
>      will be notified. This does not work recursively.
>
> So the statements seem contradictory regarding the notification of
> changes in the contents of the files (not their creation or
> deletion). In the most lenient interpretation, the docstring may be
> considered silent in this regard.

Well, the situation is complex. We have 6 (in words: "six") different
file notification libraries: inotify, kqueue, gfilenotify, w32notify,
inotifywatch, and gio. The two latter libraries are for remote file
systems.

gfilenotify / gio know different implementations, called monitors. Until
now I could test 5 (in words: "five") of them: GFamFileMonitor,
GFamDirectoryMonitor, GInotifyFileMonitor, GKqueueFileMonitor, and
GPollFileMonitor. Likely there are more.

All of them behave slightly different. filenotify.el is the attempt to
harmonize them, especially to let them fire the same events. This has
restrictions.

If you want to get an impressions, I recommend you to read
test/lisp/filenotify-tests.el.

> This little experiment shows that, at least in my setup, a change in the
> content of a file is not notified:
>
>     (defun my-watcher (event) (message "Not in my watch: %s" event))
>
>     (file-notify-add-watch "/tmp/some-dir" '(change) #'my-watcher)
>
> Then:
>
>     touch /tmp/some-dir/x => Not in my watch: (18 created /tmp/some-dir/x)
>     echo dsds > /tmp/some-dir/x => Nothing
>     rm  /tmp/some-dir/x => Not in my watch: (18 deleted /tmp/some-dir/x)

Running your test with some of them shows:

inotify
=======
touch /tmp/x => Not in my watch: ((1 . 0) created /tmp/x)
echo dsds > /tmp/x => Not in my watch: ((1 . 0) changed /tmp/x)
rm  /tmp/x => Not in my watch: ((1 . 0) deleted /tmp/x)

kqueue
======
touch /tmp/x => Not in my watch: (9 created /tmp/x)
echo dsds > /tmp/x => Nothing
rm  /tmp/x => Not in my watch: (9 deleted /tmp/x)

gfilenotify (GFamFileMonitor)
===========
touch /tmp/x => Not in my watch: (8590168344 created /tmp/x)
echo dsds > /tmp/x => Not in my watch: (8590168344 changed /tmp/x)
rm  /tmp/x => Not in my watch: (8590168344 deleted /tmp/x)

w32notify
=========
touch c:/Users/albinus/AppData/Roaming/x => Not in my watch: (649583674484 created c:/Users/albinus/AppData/Roaming/x)
echo dsds > c:/Users/albinus/AppData/Roaming/x => Not in my watch: (649583674484 changed c:/Users/albinus/AppData/Roaming/x)
rm  c:/Users/albinus/AppData/Roaming/x => Not in my watch: (649583674484 deleted c:/Users/albinus/AppData/Roaming/x)

inotifywait
===========
touch /tmp/x => Not in my watch: (inotifywait created /ssh:gandalf:/tmp/x)
echo dsds > /tmp/x => Not in my watch: (inotifywait changed /ssh:gandalf:/tmp/x)
rm  /tmp/x => Not in my watch: (inotifywait deleted /ssh:gandalf:/tmp/x)

gio (GKqueueFileMonitor)
===
touch /tmp/x => Not in my watch: (gio created /ssh:freebsd12:/tmp/x)
echo dsds > /tmp/x => Nothing
rm  /tmp/x => Not in my watch: (gio deleted /ssh:freebsd12:/tmp/x)

gio (GPollFileMonitor)
===
touch /tmp/x => Not in my watch: (gio created /mock:win10:/tmp/x)
echo dsds > /tmp/x => Not in my watch: (gio changed /mock:win10:/tmp/x)
rm  /tmp/x => Not in my watch: (gio deleted /mock:win10:/tmp/x)

> So according to the elisp manual this is a bug, but according to the
> docstring it seemingly isn't. I'm with the manual in this one.

In case a directory is watched, creation and deletion of a file are
notified. Changes to a file are notified depending on the underlying
library, in short everything which depends on kqueue does not notify
such a change.

I will adapt the docstring of file-notify-add-watch as well as the elisp
manual accordingly.

> Best regards,
> Carlos

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51146; Package emacs. (Fri, 15 Oct 2021 18:44:02 GMT) Full text and rfc822 format available.

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

From: Carlos Pita <carlosjosepita2 <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 51146 <at> debbugs.gnu.org
Subject: Re: bug#51146: 29.0.50; file-notify-add-watch not reporting changes
 of files
Date: Fri, 15 Oct 2021 15:43:23 -0300
Hi Michael,

I highly appreciate your detailed explanation.

> I will adapt the docstring of file-notify-add-watch as well as the elisp
> manual accordingly.

Thanks, this should be enough, it's clear from the above that there's
only so much emacs can do in order to pull off the illusion of a
common interface.

Best regards,
Carlos




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Sat, 16 Oct 2021 06:54:02 GMT) Full text and rfc822 format available.

Notification sent to Carlos Pita <carlosjosepita2 <at> gmail.com>:
bug acknowledged by developer. (Sat, 16 Oct 2021 06:54:02 GMT) Full text and rfc822 format available.

Message #34 received at 51146-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Carlos Pita <carlosjosepita2 <at> gmail.com>
Cc: 51146-done <at> debbugs.gnu.org
Subject: Re: bug#51146: 29.0.50; file-notify-add-watch not reporting changes
 of files
Date: Sat, 16 Oct 2021 08:53:11 +0200
Version: 28.1

Carlos Pita <carlosjosepita2 <at> gmail.com> writes:

> Hi Michael,

Hi Carlos,

>> I will adapt the docstring of file-notify-add-watch as well as the elisp
>> manual accordingly.
>
> Thanks, this should be enough, it's clear from the above that there's
> only so much emacs can do in order to pull off the illusion of a
> common interface.

Thanks for the feedback, I'm closing the bug.

> Best regards,
> Carlos

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 13 Nov 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 162 days ago.

Previous Next


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