all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mike Kazantsev <mk.fraggod@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	npostavs@gmail.com, 31901@debbugs.gnu.org
Subject: bug#31901: Incorrect make-network-process + nowait state handling for non-existing unix sockets in emacs-26.1
Date: Sun, 22 Jul 2018 21:42:07 +0500	[thread overview]
Message-ID: <20180722214207.1ccaff3d@malediction> (raw)
In-Reply-To: <83pnzfw9g0.fsf@gnu.org>

On Sun, 22 Jul 2018 18:56:31 +0300
Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Lars Ingebrigtsen <larsi@gnus.org>
> > Cc: Eli Zaretskii <eliz@gnu.org>,  npostavs@gmail.com,  31901@debbugs.gnu.org
> > Date: Sun, 22 Jul 2018 17:23:45 +0200
> > 
> > Mike Kazantsev <mk.fraggod@gmail.com> writes:
> >   
> > > Given either of these guidelines, it'd be more surprising to not get
> > > error state in the sentinel call with ":nowait t" in emacs-26.  
> > 
> > I agree, it would be better to get a sentinel callback.  But I don't
> > think that's how it's ever worked, so that's not a regression.  But it
> > could be a new feature for Emacs 27...  
> 
> Yes, I think we should just fix the bug on emacs-26, and introduce the
> sentinel callback on master.

I just built emacs from git to test how it works, and have to report
that unfortunately current behavior is not consistent with what
emacs had either before this bug was introduced.

More details follow.


== How it worked in emacs-25:

  (make-network-process
    ...
    :family 'local
    :service "/tmp/does-not-exist.sock"
    :nowait t
    :sentinel #'unix-socket-test-func)

  => nil
  [sentinel never called]

  (process-live-p socket) => nil (because "socket" will be nil)
  (process-status socket) => error

I.e. nil was returned to indicate failure to create network process.


== How it works in emacs-26.1 (with the bug in question):

  (make-network-process
    ...
    :family 'local
    :service "/tmp/does-not-exist.sock"
    :nowait t
    :sentinel #'unix-socket-test-func)

  => #<process unix-socket-test>
  [sentinel never called]

  (process-live-p socket) => [non-nil value]
  (process-status socket) => 'open

This is the case described in the original bug report.


== How it works in emacs-26.1 with ":nowail nil":

  (make-network-process
    ...
    :family 'local
    :service "/tmp/does-not-exist.sock"
    :nowait nil
    :sentinel #'unix-socket-test-func)

  => [file-missing signaled]
  [sentinel never called]

  (process-live-p socket) => [no socket value]
  (process-status socket) => [no socket value]

Provided here to illustrate the difference with current ":nowait t"
case.


== How it works in current emacs-git [8f3bca3ad51]:

  (make-network-process
    ...
    :family 'local
    :service "/tmp/does-not-exist.sock"
    :nowait t
    :sentinel #'unix-socket-test-func)

  => #<process unix-socket-test>
  [sentinel never called]

  (process-live-p socket) => nil
  (process-status socket) => 'file-missing

Note that this is:

- Not consistent with what emacs did before this bug.

- Not consistent with what emacs-26 does with ":nowait nil".

- Does not seem to be consistent with what documentation describes
  (as indicated in this thread earlier, might be subjective).


So wanted to note that as it is, entirely new unexpected behavior was
introduced, which does not line up neither with how this worked
previously (and will certainly break the code there), nor how you'd
expect it to work after emacs-26 changes (either signal error same as
":nowait nil" does, or via sentinel).

As far as I can tell, this applies to both missing unix socket and when
it exists, but connection to it is refused (nothing listening there).


-- 
Mike Kazantsev // fraggod.net





  reply	other threads:[~2018-07-22 16:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19  5:43 bug#31901: Incorrect make-network-process + nowait state handling for non-existing unix sockets in emacs-26.1 Mike Kazantsev
2018-07-01 15:21 ` Noam Postavsky
2018-07-06  8:59   ` Eli Zaretskii
2018-07-14  8:20     ` Eli Zaretskii
2018-07-20  9:16       ` Eli Zaretskii
2018-07-20 10:08         ` Lars Ingebrigtsen
2018-07-20 12:17           ` Eli Zaretskii
2018-07-22 11:40             ` Lars Ingebrigtsen
2018-07-22 14:11               ` Eli Zaretskii
2018-07-22 14:31                 ` Lars Ingebrigtsen
2018-07-22 14:54               ` Mike Kazantsev
2018-07-22 15:23                 ` Lars Ingebrigtsen
2018-07-22 15:38                   ` Mike Kazantsev
2018-07-22 15:56                   ` Eli Zaretskii
2018-07-22 16:42                     ` Mike Kazantsev [this message]
2018-07-22 16:55                       ` Mike Kazantsev
2018-08-06 20:36                         ` Noam Postavsky
2018-08-07 15:48                           ` Eli Zaretskii
2018-08-08 23:51                             ` Noam Postavsky

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

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

  git send-email \
    --in-reply-to=20180722214207.1ccaff3d@malediction \
    --to=mk.fraggod@gmail.com \
    --cc=31901@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=npostavs@gmail.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.