bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#53191: 29.0.50; file-notify-add-watch fails for socket files on MacO


From: Michael Albinus
Subject: bug#53191: 29.0.50; file-notify-add-watch fails for socket files on MacOS
Date: Wed, 12 Jan 2022 10:01:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

"Troy de Freitas" <me@ntdef.com> writes:

Hi Troy,

> This bug affects MacOS (and most likely FreeBSD and OpenBSD as well).
> On MacOS running `file-notify-add-watch' throws an error when attached to a 
> UNIX socket
> file but works fine on Linux. To reproduce, using 'emacs -Q', evaluate the 
> following elisp:
>
>     (let* ((sock "/tmp/netproc.sock")
>            (p (make-network-process
>                :name "test"
>                :family 'local
>                :local sock
>                :server t)))
>       (unwind-protect
>           (file-notify-add-watch sock '(change)
>                                  (lambda (_) (message (format "%s changed." 
> sock))))
>         (delete-process p)
>         (delete-file sock)))
>
> It throws the error:
>
>    edebug-signal: File cannot be opened: Operation not supported on
>    socket, /tmp/netproc.sock
>
> The issue appears to be in the underlying call to `kqueue-add-watch',
> which uses `openat()' (by way of `emacs_open()`) to get a
> file-descriptor. According to the BSD docs for `openat()', calling
> `openat()' on socket files is not supported.

Thanks for the report. The incrimed behavior is due to unconditional
using of the EVFILT_VNODE filter, calling EV_SET in
Fkqueue_add_watch. This requires a file descriptor.

I'll investigate, whether another filter, like EVFILT_READ, is better
suited for sockets, using a sockfd. This might take some days, though.

See kqueue(2) for details, if you're interested in.

> - Troy

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]