bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56025: 29.0.50; em-extpipe-test-2 times out on EMBA and Cygwin


From: Ken Brown
Subject: bug#56025: 29.0.50; em-extpipe-test-2 times out on EMBA and Cygwin
Date: Mon, 27 Jun 2022 09:25:23 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

Thanks to all of you for working on this while I was gone. Unfortunately, the problem is still present on Cygwin. In my haste to get away, I neglected to mention that there is apparently a timing issue in Eshell on Cygwin, so that even three EOFs do not always suffice to kill the process.

My test case is to run

  echo bar | sh -c rev

in Eshell. For reasons I don't understand, EOF almost always has to be sent more than 3 times times before the "sh" process dies. The maximum I've observed is 93. Inserting "(sit-for 0.01)" after each EOF eliminates the need for extra EOFs; this is why I referred to the problem as a timing issue.

I propose the following workaround:

--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -284,10 +284,16 @@ eshell-close-target
     ;; end-of-file to the reading process.  However, some platforms
     ;; (e.g. Solaris) actually require sending a *third* EOF.  Since
     ;; sending extra EOFs while the process is running shouldn't break
-    ;; anything, we'll just send the maximum we'd ever need.  See
-    ;; bug#56025 for further details.
-    (let ((i 0))
-      (while (and (<= (cl-incf i) 3)
+    ;; anything, we'll send up to three on all platforms.
+
+    ;; There's an extra wrinkle on Cygwin where, apparently due to an
+    ;; unknown timing issue, it sometimes takes more than three EOFs
+    ;; to kill the process.  (This only happens in Eshell, not in an
+    ;; ordinary Cygwin shell.)  We work around this problem by sending
+    ;; up to 1000 EOFs on Cygwin.  See bug#56025 for further details.
+    (let ((i 0)
+          (n (if (eq system-type 'cygwin) 1000 3)))
+      (while (and (<= (cl-incf i) n)
                   (eq (process-status target) 'run))
         (process-send-eof target))))


Ken

P.S. Has anyone checked to see if the extpipe tests are now passing on EMBA? If not, maybe the workaround is needed there too. Alternatively, we could simply use the workaround on all platforms. I don't see what harm it could do.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]