Subject: 30.0.50; accept-process-output and async connect

From: Helmut Eller <[email-masked]>
Date: Mon, 31 Jul 2023 15:31:00 +0200

This example fails:

(ert-deftest async-connect ()
  (let* ((host 'local)
	 (family 'ipv4)
	 (port 57869)
	 (server (make-network-process
		  :name "server" :server t :noquery t :reuseaddr t
		  :host host :service port :family family))
	 (proc (make-network-process
		:name "async-connect" :nowait t
		:host host :service port :family family)))
    (should (eq (process-status proc) 'connect))
    (should (accept-process-output proc 2))
    (should (eq (process-status proc) 'open))))

when executed with
  emacs --batch -Q -l async-connect.el -f ert-run-tests-batch-and-exit

It seems that accept-process-output correctly updates the process-status
but it forgets to break out of the loop.

With the following change, the test passes:

diff --git a/src/process.c b/src/process.c
index 2d6e08f16b5..159d39aeabc 100644
--- a/src/process.c
+++ b/src/process.c
@@ -6024,6 +6024,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 #endif
 		    {
 		      pset_status (p, Qrun);
+		      got_some_output = 1;
 		      /* Execute the sentinel here.  If we had relied on
 			 status_notify to do it later, it will read input
 			 from the process before calling the sentinel.  */

In GNU Emacs 30.0.50 (build 73, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.16.0) of 2023-07-31 built on caladan
Repository revision: 1f3995f65a065a28e108653128b31a2fb7eeb01c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-xpm=ifavailable --with-jpeg=ifavailable
 --with-gif=ifavailable --with-tiff=ifavailable'

Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX
LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 GTK3
ZLIB

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix