unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jim Porter <jporterbugs@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jschmidt4gnu@vodafonemail.de, 66186@debbugs.gnu.org
Subject: bug#66186: "make lisp/eshell/esh-proc-tests" fails intermittently since 7e50861ca7ed3f620fe62ac6572f6e88b3600ece
Date: Sun, 24 Sep 2023 22:34:55 -0700	[thread overview]
Message-ID: <0bf05269-a8b4-3457-95e1-0c1916f33b22@gmail.com> (raw)
In-Reply-To: <83fs323ldl.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 832 bytes --]

On 9/24/2023 9:52 PM, Eli Zaretskii wrote:
>> Date: Sun, 24 Sep 2023 16:02:03 -0700
>> From: Jim Porter <jporterbugs@gmail.com>
>>
>> However, I don't understand why this would cause an abort though;
>> normally, 'process-send-string' should just signal an Elisp error (which
>> Eshell then catches and does the right thing with it). Maybe there's a
>> bug somewhere in process.c where it's not correctly handling the (real)
>> SIGPIPE signal and converting it to an Elisp signal?
> 
> In batch mode, SIGPIPE is not ignored by Emacs, see init_signals.
> This was changed 11 years ago, see commit 4d7e6e51dd.

Thanks, I didn't realize that.

> 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?

[-- Attachment #2: 0001-Check-for-process-liveness-before-calling-process-se.patch --]
[-- Type: text/plain, Size: 1423 bytes --]

From e9d961f0b1debed82fc004d6631ffe6adff7c19f Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Sun, 24 Sep 2023 22:30:34 -0700
Subject: [PATCH] Check for process liveness before calling
 'process-send-string' in Eshell

In other words, seek permission instead of asking for forgiveness
(bug#66186).

* lisp/eshell/esh-io.el (eshell-output-object-to-target): Check
'process-live-p' first.
---
 lisp/eshell/esh-io.el | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index cd0cee6e21d..668ff13b825 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -644,15 +644,10 @@ eshell-output-object-to-target
   "Output OBJECT to the process TARGET."
   (unless (stringp object)
     (setq object (eshell-stringify object)))
-  (condition-case err
+  (if (process-live-p target)
       (process-send-string target object)
-    (error
-     ;; If `process-send-string' raises an error and the process has
-     ;; finished, treat it as a broken pipe.  Otherwise, just
-     ;; re-throw the signal.
-     (if (process-live-p target)
-         (signal (car err) (cdr err))
-       (signal 'eshell-pipe-broken (list target)))))
+    ;; If the process is already dead, treat that as a broken pipe.
+    (signal 'eshell-pipe-broken (list target)))
   object)
 
 (cl-defmethod eshell-output-object-to-target (object
-- 
2.25.1


  reply	other threads:[~2023-09-25  5:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-24 21:35 bug#66186: "make lisp/eshell/esh-proc-tests" fails intermittently since 7e50861ca7ed3f620fe62ac6572f6e88b3600ece Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-24 23:02 ` Jim Porter
2023-09-25  4:52   ` Eli Zaretskii
2023-09-25  5:34     ` Jim Porter [this message]
2023-09-25  5:47       ` Jim Porter
2023-09-25  6:47         ` Eli Zaretskii
2023-09-25  7:18           ` Paul Eggert
2023-09-25  7:43             ` Eli Zaretskii
2023-09-25 19:12           ` Jim Porter
2023-09-28 20:33             ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-01 20:13               ` Jim Porter
2023-09-25  9:01       ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=0bf05269-a8b4-3457-95e1-0c1916f33b22@gmail.com \
    --to=jporterbugs@gmail.com \
    --cc=66186@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jschmidt4gnu@vodafonemail.de \
    /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).