Subject: Re: bug#66186: "make lisp/eshell/esh-proc-tests" fails intermittently since 7e50861ca7ed3f620fe62ac6572f6e88b3600ece

From: Eli Zaretskii <[email-masked]>
Date: Mon, 25 Sep 2023 09:47:42 +0300

> Date: Sun, 24 Sep 2023 22:47:58 -0700
> From: Jim Porter <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> >> Perhaps Eshell should check that the process is still alive before
> >> calling process-send-string?
> > 
> > Ok, how about this? Jens, could you try this patch out to see if it 
> > fixes things for you?
> 
> I forgot to add: Is there potential for a race condition here? I think 
> I'd written it the other way because there's a chance that the process 
> exits in between checking 'process-live-p' and calling 
> 'process-send-string'.

Yes, and therefore I think you should also keep the old code that
wrapped the call in condition-case.

> I guess we could check liveness both before *and* 
> after 'process-send-string'. That would probably still leave a small 
> chance of the regression tests crashing though, which isn't great.

Perhaps process-send-string should install a temporary SIGPIPE
handler, at least optionally?  Paul, WDYT?

> I could probably also write the test to avoid this race condition 
> entirely, since it's not actually trying to trigger a SIGPIPE (though in 
> general, Eshell should do the right thing in response to SIGPIPE). That 
> would make the regression tests happy.

That's always a good thing, thanks.