all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#29450: 26.0.90; No check for nil in some filenotify functions
@ 2017-11-26  6:18 John Wiegley
  2017-11-26 15:39 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: John Wiegley @ 2017-11-26  6:18 UTC (permalink / raw)
  To: 29450

The documentation for find-file-name-handler says:

    find-file-name-handler is a built-in function in ‘C source code’.
    
    (find-file-name-handler FILENAME OPERATION)
    
    Return FILENAME’s handler function for OPERATION, if it has one.
    Otherwise, return nil.

However, several of the functions in filenotify use the return value of this
function without checking if it's nil or not:

    (defun file-notify-rm-watch (descriptor)
      "Remove an existing watch specified by its DESCRIPTOR.
    DESCRIPTOR should be an object returned by `file-notify-add-watch'."
      (when-let* ((watch (gethash descriptor file-notify-descriptors)))
        (let ((handler (find-file-name-handler
                        (file-notify--watch-directory watch)
                        'file-notify-rm-watch)))
          (condition-case nil
              (if handler
                  ;; A file name handler could exist even if there is no
                  ;; local file notification support.
                  (funcall handler 'file-notify-rm-watch descriptor)

I've been getting several errors with a backtrace like nil(48). This is likely
because some package has done something wrong, but even still, filenotify
should be more defensive.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-05  7:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-26  6:18 bug#29450: 26.0.90; No check for nil in some filenotify functions John Wiegley
2017-11-26 15:39 ` Eli Zaretskii
2018-01-10  0:28   ` Glenn Morris
2018-01-10 23:56     ` John Wiegley
2018-01-11  9:13       ` Michael Albinus
2018-02-05  6:48         ` John Wiegley
2018-02-05  7:45           ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.