all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "John Wiegley" <johnw@gnu.org>
Cc: 29450@debbugs.gnu.org
Subject: bug#29450: 26.0.90; No check for nil in some filenotify functions
Date: Sun, 26 Nov 2017 17:39:31 +0200	[thread overview]
Message-ID: <83lgit6ocs.fsf@gnu.org> (raw)
In-Reply-To: <m2y3mt5zs0.fsf@newartisans.com> (johnw@gnu.org)

> From: "John Wiegley" <johnw@gnu.org>
> Date: Sat, 25 Nov 2017 22:18:07 -0800
> 
> 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:

Maybe I'm blind, but I cannot find any place in filenotify where the
handler is used without checking, including in the case you show:

>     (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)

What am I missing?

> 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.

Can you show a full backtrace like that?





  reply	other threads:[~2017-11-26 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83lgit6ocs.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=29450@debbugs.gnu.org \
    --cc=johnw@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.