Subject: bug#26127: 26.0.50; Using file-notify-rm-watch on invalid descriptor raises invalid-function

From: Michael Albinus <[email-masked]>
Date: Fri, 17 Mar 2017 10:31:59 +0100

Andreas Politz <[email-masked]> writes:

Hi Andreas,

Thanks for the bug report!

> Calling file-notify-rm-watch on an invalid descriptor may throw a
> invalid-function error, but it should throw a file-notify-error instead.

`file-notify-error' shall appear only from `file-notify-add-watch'.
`file-notify-rm-watch' shall not raise an error at all.

> For example, this may occur when calling the function multiple times on
> the same descriptor.
>
> The error stems from file-notify--rm-descriptor, which contains the expression
>
>       (funcall
>        (cdr (assoc file (cdr registered)))
>        `(,descriptor stopped ,(if file (expand-file-name file dir)
>        dir)))
>
> , but (assoc file (cdr registered)) is nil.  I think this error is
> confusing.

I've fixed this in the master branch; there shouldn't be an error anymore.

> Attached you'll find a test case for this.

Thanks also for this. I've added it, modified, to filenotify-tests.el.

> -ap

Best regards, Michael.