GNU bug report logs - #29450
26.0.90; No check for nil in some filenotify functions

Previous Next

Package: emacs;

Reported by: "John Wiegley" <johnw <at> gnu.org>

Date: Sun, 26 Nov 2017 06:19:01 UTC

Severity: minor

Tags: moreinfo, wontfix

Found in version 26.0.90

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: "John Wiegley" <johnw <at> gnu.org>
Subject: bug#29450: closed (Re: bug#29450: 26.0.90; No check for nil in
 some filenotify functions)
Date: Mon, 05 Feb 2018 07:46:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#29450: 26.0.90; No check for nil in some filenotify functions

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

-- 
29450: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=29450
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: John Wiegley <johnw <at> gnu.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 29450-done <at> debbugs.gnu.org
Subject: Re: bug#29450: 26.0.90; No check for nil in some filenotify functions
Date: Mon, 05 Feb 2018 08:45:27 +0100
John Wiegley <johnw <at> gnu.org> writes:

Hi John,

> I've had file-notify back on for a few days now, and this has not happened
> again, so I'm fine with closing this issue.

I do it herewith.

> However -- and this is a separate bug -- I had to disable it again because it
> was stalling out Emacs regularly. I'd ran an operation that changed the state
> of the disk, and then Emacs would be locked up for minutes at a time until I
> hit C-g repeatedly. Finally, I ran Instruments to see what was going on, and
> it was stuck in a busy loop reading directories, spending 92% of its time
> calling delq over and over again.

In function `file-notify-handle-event', there's a commented `message'
call. Could you enable this, and send the output when this problem
happens, again?

> But that's a separate issue, and disabling file-notify cured the performance
> problem.

Do you write another bug report for this?

Best regards, Michael.

[Message part 3 (message/rfc822, inline)]
From: "John Wiegley" <johnw <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.90; No check for nil in some filenotify functions
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:

    (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



This bug report was last modified 7 years and 109 days ago.

Previous Next


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