unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: emacs-devel@gnu.org
Subject: Re: some accept-process-output races fixed; Tramp FIXMEs
Date: Wed, 16 Jan 2019 16:15:09 -0800	[thread overview]
Message-ID: <f3a1c668-e1b0-9cce-1c84-f1fdb5505c0a@cs.ucla.edu> (raw)
In-Reply-To: <jwva7k0h1fz.fsf-monnier+gmane.emacs.devel@gnu.org>

On 1/16/19 11:07 AM, Stefan Monnier wrote:
> I think we should make sure that
>
>      (if (not (process-live-p p))
>          (progn
>            (accept-process-output p)
>            ;; Here we should be sure that we processed all the output
>
> whereas IIUC currently we need
>
>      (if (not (process-live-p p))
>          (progn
>            (while (accept-process-output p))
>            ;; Here we are presumably sure that we processed all the output

Both those approaches should work now. In my earlier email I was worried 
about the slightly-different case where P exits just before 
(accept-process-output P DELAY) is called. In this case 
accept-process-output might not slurp all the data from P even if P has 
already exited. However, in the above scenarios, where Emacs "knows" 
that P has exited before (accept-process-output P) is called with no 
DELAY, no data should go missing on any sane POSIX platform (though 
admittedly I can't cite chapter and verse on this and I suspect POSIX 
does not strictly require it).

However, I'm still puzzled by Tramp's use of (while (or 
(accept-process-output p 0.1) (process-live-p p))) to get all P's 
output. Why not use (while (accept-process-output p)) instead, which is 
simpler and avoids the race condition I mentioned? Maybe something to do 
with timers? I'm at a loss there.




  reply	other threads:[~2019-01-17  0:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-15 18:33 some accept-process-output races fixed; Tramp FIXMEs Paul Eggert
2019-01-16  8:32 ` Michael Albinus
2019-01-16  8:38   ` Paul Eggert
2019-01-16  8:49     ` Michael Albinus
2019-01-16 13:03   ` Michael Albinus
2019-01-16 13:25 ` Stefan Monnier
2019-01-16 18:39   ` Paul Eggert
2019-01-16 19:07     ` Stefan Monnier
2019-01-17  0:15       ` Paul Eggert [this message]
2019-01-20  9:57     ` Michael Albinus
2019-01-21 23:02       ` Daniel Colascione
2019-01-22 16:54         ` Eli Zaretskii
2019-01-22  7:09       ` Paul Eggert
2019-01-22 16:56       ` Eli Zaretskii
2019-01-22 18:58         ` Michael Albinus
2019-01-22 22:06       ` Stefan Monnier
2019-01-22 22:45         ` Michael Albinus
2019-01-23 16:18           ` Eli Zaretskii
2019-01-23 18:35             ` Michael Albinus
2019-01-23 22:19               ` Daniel Pittman
2019-01-23 16:47           ` Stefan Monnier
2019-01-23 17:36             ` Paul Eggert
2019-01-28 15: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=f3a1c668-e1b0-9cce-1c84-f1fdb5505c0a@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /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).