From: Ken Brown <kbrown@cornell.edu>
To: Jim Porter <jporterbugs@gmail.com>,
Sean Whitton <spwhitton@email.arizona.edu>,
56025@debbugs.gnu.org, Lars Magne Ingebrigtsen <larsi@gnus.org>
Subject: bug#56025: 29.0.50; em-extpipe-test-2 times out on EMBA and Cygwin
Date: Thu, 23 Jun 2022 21:18:24 -0400 [thread overview]
Message-ID: <040b3a36-459b-a94d-f879-7f45aac50bda@cornell.edu> (raw)
In-Reply-To: <e14c3b37-fa3d-7793-d6f4-5f2b7f29ea70@cornell.edu>
On 6/19/2022 12:02 PM, Ken Brown wrote:
> On 6/18/2022 6:00 PM, Jim Porter wrote:
>> On 6/18/2022 1:51 PM, Ken Brown wrote:
>>> On 6/18/2022 3:02 PM, Jim Porter wrote:
>>>> On 6/18/2022 10:52 AM, Ken Brown wrote:
>>>>> No, I'm seeing the same results on Emacs 28. On both Emacs 28 and Emacs
>>>>> 29, rev is apparently not seeing EOF unless echo outputs a newline, so rev
>>>>> keeps waiting for input.
>>>>
>>>> Ah ha! Thanks for debugging this. The minimal fix then would be to change
>>>> the command in em-extpipe-test-2 to either of these:
>>>>
>>>> echo -N "bar" | rev *>temp
>>>
>>> This doesn't work. It still hangs when run interactively...
>>
>> Just to confirm, the above command hangs, but the following works, correct?
>>
>> echo -N "bar" | rev
>
> Correct.
>
>>>> *echo "bar" | rev *>temp
>>>
>>> This works interactively...
>>
>> All this makes me think that we could be dealing with a race condition in how
>> Eshell pipes I/O around. Maybe there's a timing issue in `eshell-close-target'
>> where we end up not sending EOF to the "rev" (or "sh") process?
>
> I think I've just discovered an anomaly in "rev" on Cygwin that could partially
> explain what I'm seeing. I'll investigate that before proceeding further.
OK, I think I've got it sorted out now. The anomaly I referred to above is
actually an anomaly in the stdio routines, not in "rev". It's discussed in item
2 below. There are two issues.
1. I think there's a bug in eshell-close-target, in which it's assumed that
sending C-d indicates end-of-file. This is only true if there's no input waiting
to be read. [In an interactive situation, this means we're at the beginning of
a line.] Otherwise, it takes a second C-d to indicate EOF. So one C-d should
suffice in the "echo -N bar" situation, but two are needed after "echo bar".
This bug probably went unnoticed because eshell-close-target was called twice in
the case we were discussing, so process-send-eof was called twice.
2. On Cygwin and some other platforms, including Solaris 11.4 I think, it
actually takes a third C-d, for reasons explained in the email thread starting
at https://cygwin.com/pipermail/cygwin/2022-June/251672.html. We're probably
going to change this on Cygwin, but that still leaves other platforms.
The following patch resolves both issues:
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index 3644c1a18b..1c4131cb07 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -276,8 +276,8 @@ eshell-close-target
;; If we're redirecting to a process (via a pipe, or process
;; redirection), send it EOF so that it knows we're finished.
((eshell-processp target)
- (if (eq (process-status target) 'run)
- (process-send-eof target)))
+ (while (eq (process-status target) 'run)
+ (process-send-eof target)))
;; A plain function redirection needs no additional arguments
;; passed.
I'm about to go AFK for a few days. If the eshell people agree that something
like this patch should be installed, please go ahead. I think it would then be
worth re-enabling the extpipe tests on EMBA to see if the problem is fixed there
too.
Ken
next prev parent reply other threads:[~2022-06-24 1:18 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 18:30 bug#56025: 29.0.50; em-extpipe-test-2 times out on EMBA and Cygwin Ken Brown
2022-06-16 19:30 ` Sean Whitton
2022-06-16 22:01 ` Ken Brown
2022-06-17 13:39 ` Ken Brown
2022-06-18 0:57 ` Sean Whitton
2022-06-18 2:07 ` Ken Brown
2022-06-18 2:35 ` Ken Brown
2022-06-18 3:50 ` Jim Porter
2022-06-18 17:52 ` Ken Brown
2022-06-18 19:02 ` Jim Porter
2022-06-18 20:51 ` Ken Brown
2022-06-18 22:00 ` Jim Porter
2022-06-18 23:46 ` Sean Whitton
2022-06-19 16:02 ` Ken Brown
2022-06-24 1:18 ` Ken Brown [this message]
2022-06-24 4:40 ` Sean Whitton
2022-06-24 6:07 ` Eli Zaretskii
2022-06-24 16:53 ` Jim Porter
2022-06-24 22:23 ` Sean Whitton
2022-06-24 23:03 ` Jim Porter
2022-06-25 5:34 ` Eli Zaretskii
2022-06-25 16:13 ` Jim Porter
2022-06-25 16:53 ` Eli Zaretskii
2022-06-26 16:27 ` Lars Ingebrigtsen
2022-06-26 17:12 ` Sean Whitton
2022-06-26 17:22 ` Jim Porter
2022-06-26 21:11 ` Sean Whitton
2022-06-27 13:25 ` Ken Brown
2022-06-27 15:51 ` Michael Albinus
2022-06-27 16:22 ` Ken Brown
2022-06-27 19:13 ` bug#56025: [EXT]Re: " Sean Whitton
2022-06-27 21:17 ` Ken Brown
2022-06-27 19:18 ` Jim Porter
2022-06-27 21:19 ` Ken Brown
2022-07-01 3:52 ` Jim Porter
2022-07-01 3:58 ` Jim Porter
2022-07-06 22:33 ` Ken Brown
2022-07-07 4:35 ` Jim Porter
2022-07-07 4:42 ` Jim Porter
2022-07-07 12:42 ` Ken Brown
2022-07-17 2:35 ` bug#56025: [WIP PATCH] " Jim Porter
2022-07-17 6:03 ` Eli Zaretskii
2022-07-17 17:44 ` Jim Porter
2022-07-17 18:26 ` Eli Zaretskii
2022-07-17 18:51 ` Jim Porter
2022-07-18 8:09 ` Michael Albinus
2022-07-19 1:58 ` Jim Porter
2022-07-19 7:59 ` Michael Albinus
2022-07-17 21:59 ` Ken Brown
2022-07-18 5:26 ` Jim Porter
2022-07-22 4:16 ` bug#56025: [PATCH v2] " Jim Porter
2022-07-22 19:00 ` Ken Brown
2022-07-24 4:05 ` Jim Porter
2022-07-24 5:19 ` bug#56025: [PATCH v3] " Jim Porter
2022-07-24 5:29 ` bug#56025: [PATCH v4] " Jim Porter
2022-07-24 9:08 ` Lars Ingebrigtsen
2022-07-24 9:48 ` Eli Zaretskii
2022-07-24 21:04 ` Ken Brown
2022-07-24 9:47 ` Eli Zaretskii
2022-07-24 17:36 ` bug#56025: [PATCH v5] " Jim Porter
2022-07-24 20:30 ` Ken Brown
2022-07-31 1:01 ` Jim Porter
2022-08-06 1:10 ` Jim Porter
2022-08-06 12:17 ` Lars Ingebrigtsen
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=040b3a36-459b-a94d-f879-7f45aac50bda@cornell.edu \
--to=kbrown@cornell.edu \
--cc=56025@debbugs.gnu.org \
--cc=jporterbugs@gmail.com \
--cc=larsi@gnus.org \
--cc=spwhitton@email.arizona.edu \
/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).