unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: "Troy de Freitas" <me@ntdef.com>
Cc: 53191@debbugs.gnu.org
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	[thread overview]
Message-ID: <87mtk1pbss.fsf@gmx.de> (raw)
In-Reply-To: <ef7d4635-1868-43e4-be73-c701d6f6ce1b@www.fastmail.com> (Troy de Freitas's message of "Tue, 11 Jan 2022 10:22:01 -0600")

"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	other threads:[~2022-01-12  9:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 16:22 bug#53191: 29.0.50; file-notify-add-watch fails for socket files on MacOS Troy de Freitas
2022-01-12  9:01 ` Michael Albinus [this message]
2022-01-15 14:45   ` Michael Albinus
2022-01-15 16:49     ` Troy de Freitas
2022-01-15 17:37       ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87mtk1pbss.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=53191@debbugs.gnu.org \
    --cc=me@ntdef.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).