GNU bug report logs - #78712
31.0.50; definition is void in file-notify

Previous Next

Package: emacs;

Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>

Date: Fri, 6 Jun 2025 10:21:02 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

Fixed in version 31.1

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

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Subject: bug#78712: closed (Re: bug#78712: 31.0.50; definition is void in
 file-notify)
Date: Wed, 11 Jun 2025 17:24:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#78712: 31.0.50; definition is void in file-notify

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 78712 <at> debbugs.gnu.org.

-- 
78712: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78712
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Michael Albinus <michael.albinus <at> gmx.de>
To: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Cc: 78712-done <at> debbugs.gnu.org
Subject: Re: bug#78712: 31.0.50; definition is void in file-notify
Date: Wed, 11 Jun 2025 19:23:17 +0200
Version: 31.1

Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:

Hi,

>> I suppose the appended patch should fix it. It is assembled on top of
>> Emacs 31, but it should also apply on Emacs 29. Do you have a chance to
>> test it?
> I haven't seen the error since applying this patch. So I do think it fixes the issue.

Thanks for the feedback. I've pushed it to the master branch, closing
the bug.

Best regards, Michael.

[Message part 3 (message/rfc822, inline)]
From: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; definition is void in file-notify
Date: Fri, 06 Jun 2025 11:16:44 +0100
I am running into an issue (on MacOS) where a file-watcher gets called with a specific set of actions, which lead to the error

,----
| file-notify--call-handler: Symbol's function definition is void: nil
`----

Here's the full stack trace:

,----
| Debugger entered--Lisp error: (void-function nil)
|   nil((63 attribute-changed "[redacted]"))
|   file-notify--call-handler(#s(file-notify--watch :directory "[redacted]" :filename "[redacted]" :callback nil) 63 attribute-changed "[redacted]" nil)
|   file-notify--handle-event(63 (renamed attribute-changed deleted) "[redacted]" nil)
|   file-notify--callback-kqueue((63 (rename attrib delete) "[redacted]"))
|   file-notify-handle-event((file-notify (63 (rename attrib delete) "[redacted]") file-notify--callback-kqueue))
|   funcall-interactively(file-notify-handle-event (file-notify (63 (rename attrib delete) "[redacted]") file-notify--callback-kqueue))
|   command-execute(file-notify-handle-event nil [(file-notify (63 (rename attrib delete) "[redacted]") file-notify--callback-kqueue)] t)
`----

and here's some code that replicates the error (I can't figure out now to replicate the event itself)

--8<---------------cut here---------------start------------->8---
(let* ((desc (car (hash-table-keys file-notify-descriptors)))
       (watch (gethash desc file-notify-descriptors))
       (action '(rename atttrib delete)))
  (when desc
    (file-notify-handle-event
     (make-file-notify
      :-event (list desc action (file-notify--watch-absolute-filename watch))
      :-callback 'file-notify--callback-kqueue))))
--8<---------------cut here---------------end--------------->8---

assuming that `file-notify-descriptors` has some entries (enabling `global-auto-revert-mode` would add such entries).

The issues seems to be that when processing the first action (`rename`), the function `file-notify--handle-event` treats it as 'delete' which calls `file-notify-rm-watch` which calls `file-notify--rm-descriptor` which has the line `(setf
(file-notify--watch-callback watch) nil)`

This modifies the hash to have a nil handler, which trips up
`file-notify--handle-event` when the actual `delete` event is processed.

The same effect can be seen if the actions are (rename delete) or (delete delete).



This bug report was last modified 5 days ago.

Previous Next


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