GNU bug report logs -
#53191
29.0.50; file-notify-add-watch fails for socket files on MacOS
Previous Next
Reported by: "Troy de Freitas" <me <at> ntdef.com>
Date: Tue, 11 Jan 2022 17:18:02 UTC
Severity: normal
Tags: notabug
Found in version 29.0.50
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 53191 <at> debbugs.gnu.org (full text, mbox):
"Troy de Freitas" <me <at> 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.
This bug report was last modified 3 years and 126 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.