From: Helmut Eller <eller.helmut@gmail.com>
To: Robert Pluim <rpluim@gmail.com>
Cc: 64975@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#64975: 30.0.50; accept-process-output and async connect
Date: Tue, 08 Aug 2023 16:36:00 +0200 [thread overview]
Message-ID: <m2pm3x1u0f.fsf@gmail.com> (raw)
In-Reply-To: <87o7jhaohx.fsf@gmail.com> (Robert Pluim's message of "Tue, 08 Aug 2023 11:10:18 +0200")
On Tue, Aug 08 2023, Robert Pluim wrote:
> I think itʼs correct, as I have a change locally setting
> got_some_output for a different test case, but Iʼm going to be a pain,
> and ask Helmut to explain why, and see if I agree with his explanation
> (thatʼs a very hairy loop)
Setting got_some_output=1, was the first thing that came to mind that
made the test case pass :-). A reasonable strategy, if we have a
comprehensive test suite. If the test suite is lacking, then writing
more tests is a good investment too. Ahem.
Setting got_some_output=1 will terminate the while(1) loop, but only on
the next iteration (around line process.c:5753) and only after another
useless call to xg_select. So maybe a change like below might be
better.
The variable got_some_output is also the return value of
wait_reading_process_output. So I thought that 1 is a reasonable value
to indicate "some event happened". 0 and negative values are converted
to nil in accept-process-output, so there isn't an obvious way to
indicate "not a timeout, 0 bytes read, but some other event". Maybe
MAX_INT could be used.
If you're asking why accept-process-output should return at all, then
the answer is that the socket is now writable and the caller probably
want's to know that.
Helmut
diff --git a/src/process.c b/src/process.c
index 2d6e08f16b5..f5fec84b53c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6028,6 +6028,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
status_notify to do it later, it will read input
from the process before calling the sentinel. */
exec_sentinel (proc, build_string ("open\n"));
+ got_some_output = max (got_some_output, 1);
+ if (p == wait_proc)
+ goto done_waiting;
}
if (0 <= p->infd && !EQ (p->filter, Qt)
@@ -6038,6 +6041,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
} /* End for each file descriptor. */
} /* End while exit conditions not met. */
+
+ done_waiting:
unbind_to (count, Qnil);
/* If calling from keyboard input, do not quit
next prev parent reply other threads:[~2023-08-08 14:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 13:31 bug#64975: 30.0.50; accept-process-output and async connect Helmut Eller
2023-08-05 9:26 ` Eli Zaretskii
2023-08-08 9:10 ` Robert Pluim
2023-08-08 12:15 ` Eli Zaretskii
2023-08-08 12:32 ` Robert Pluim
2023-08-08 14:36 ` Helmut Eller [this message]
2023-08-08 15:16 ` Robert Pluim
2023-08-08 15:33 ` Eli Zaretskii
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=m2pm3x1u0f.fsf@gmail.com \
--to=eller.helmut@gmail.com \
--cc=64975@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=rpluim@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 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).