Subject: bug#31901: Incorrect make-network-process + nowait state handling for non-existing unix sockets in emacs-26.1

From: Noam Postavsky <[email-masked]>
Date: Sun, 01 Jul 2018 11:21:06 -0400

tags 31901 + confirmed
quit

Mike Kazantsev <[email-masked]> writes:

> As far as I can tell, this is not documented behavior, definitely
> unexpected, breaks all old code that used unix sockets, and probably
> unintentional, i.e. a bug.

It seems to be due to this is_non_blocking_client check in
connect_network_socket:

  if (s < 0)
    {
      /* If non-blocking got this far - and failed - assume non-blocking is
         not supported after all.  This is probably a wrong assumption, but
         the normal blocking calls to open-network-stream handles this error
         better.  */
      if (p->is_non_blocking_client)
        return;

      report_file_errno ((p->is_server
                          ? "make server process failed"
                          : "make client process failed"),
                         contact, xerrno);
    }

In Emacs 25, this check was directly in Fmake_network_process before the
process object creation code, so we would just return nil in that case.
Seems to have changed, I assume accidentally, in [1: e09c0972c3].

[1: e09c0972c3]: 2016-01-28 23:50:47 +0100
  Refactor make_network_process
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e09c0972c350e9411683b509414fc598cbf387d3