From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#54062: 29.0.50; [PATCH] Eshell should inform processes when a pipe is broken Date: Tue, 22 Feb 2022 08:49:06 -0800 Message-ID: <88900d29-fef0-6361-eb9f-b50a76e6e50b@gmail.com> References: <7da3e8b2-7400-dca6-6d92-0a60e3d9c215@gmail.com> <83mtinz222.fsf@gnu.org> <83ley6y5gx.fsf@gnu.org> <83a6emxak3.fsf@gnu.org> <272c6d13-6d35-a896-1468-2c9bc3befe87@gmail.com> <83a6ekuomt.fsf@gnu.org> <87k0dof7az.fsf@gnus.org> <835yp8ul58.fsf@gnu.org> <71c773bd-1166-8d36-5dac-8d6b81240a2a@gmail.com> <83o82zt5dy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27676"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 54062@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 22 18:02:14 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nMYYH-0006ux-W2 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Feb 2022 18:02:13 +0100 Original-Received: from localhost ([::1]:41406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMYYG-0002o3-Vh for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Feb 2022 12:02:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMYMU-0004dm-E5 for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 11:50:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMYMU-0002XV-4T for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 11:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nMYMT-0002pZ-Q3 for bug-gnu-emacs@gnu.org; Tue, 22 Feb 2022 11:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Feb 2022 16:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54062 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 54062-submit@debbugs.gnu.org id=B54062.164554855310806 (code B ref 54062); Tue, 22 Feb 2022 16:50:01 +0000 Original-Received: (at 54062) by debbugs.gnu.org; 22 Feb 2022 16:49:13 +0000 Original-Received: from localhost ([127.0.0.1]:42476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMYLh-0002oE-3a for submit@debbugs.gnu.org; Tue, 22 Feb 2022 11:49:13 -0500 Original-Received: from mail-pf1-f174.google.com ([209.85.210.174]:39865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMYLf-0002nz-6e for 54062@debbugs.gnu.org; Tue, 22 Feb 2022 11:49:11 -0500 Original-Received: by mail-pf1-f174.google.com with SMTP id y11so12633316pfa.6 for <54062@debbugs.gnu.org>; Tue, 22 Feb 2022 08:49:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=oA6mCN29l0lPQC68mCLFPuAI9vg91fhfvlIxCP+U3FU=; b=kfF6GbQF/sLMHZqZik2CTVNgUwOPj8sXmTUEPbWDwxja96V+s70seuLoIxt9lODPJx MmFz43tAeAw7GKmsQy0+VStK5SFOyAidmXnit8PdxAlTk6taXB9yRsDtwsjAjxMY3Soe 0N3Ygz2aCXRHFQX58OVggYV5Zpco5T4iuMYr6qqtlhlpvmwv5bEnldqNeX1fXwCx0lf/ orh/mOEzVu+CMrk2hEmwot4Rp9rX8dRkAJF55Hgg9l1UrhRaOfvrV/sfgzqUsM1/S4B9 fAQYCV2JG99jzo5mi8BX2PWvr1dLw6Kir3cgu9QddB37fNfuEUu3DIQEn0z7iQPpoL37 hqHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=oA6mCN29l0lPQC68mCLFPuAI9vg91fhfvlIxCP+U3FU=; b=CA2vGGp0uVjf4Xr2LPOvYEubWWPvTSd1Ou2advgDLdiv0z2NF6C/MBIKqcZRB7RQKX KAjF0BrNACTjujsbSmQDUFs9zwSmJ4uhn1e7RCAgwb+iiaPascxiPhOcIFGgIJspxzco sFlfj1tIxJRj8UzCZuHXehKFjtW9r/uKrp6rinIazz6gPwomX8EAuuDi2mVz4lTWeb4H xss9i//nl/z6pCoZbWYwXG1DVaGXudB0lbdM8kK1s7DmCkNdJ+pajypQ3LH73nKyaBID kvi0OyrK0mMl9kAkUt9v+fDJTu+FKl6cyBbZs5cy/PwumlBm4/p0qJAssObkbHbTv7th HdBg== X-Gm-Message-State: AOAM530TbkqKe2kw6CHyMbCIf+pTY3NL0KfDshMlx45kjF5SFK6zoZFU qbb8SEkZw7UeT49RdYQh+qZa9alBVNA= X-Google-Smtp-Source: ABdhPJwUgFKQ79Ypu7Jc025ctIkI9mwaGaF+c10eB0avtpGBp6O4JAkRs3e3lbYGXykkpYybTIPDtg== X-Received: by 2002:a05:6a00:2341:b0:4e1:5aa4:9aff with SMTP id j1-20020a056a00234100b004e15aa49affmr25905157pfj.8.1645548545065; Tue, 22 Feb 2022 08:49:05 -0800 (PST) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id q8sm16886616pfk.168.2022.02.22.08.49.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Feb 2022 08:49:04 -0800 (PST) In-Reply-To: <83o82zt5dy.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:227447 Archived-At: On 2/22/2022 5:09 AM, Eli Zaretskii wrote: >> Cc: 54062@debbugs.gnu.org >> From: Jim Porter >> Date: Mon, 21 Feb 2022 12:37:59 -0800 >> >> Attached is a patch that ignores the `eshell-pipe-broken' error in >> `eshell-sentinel'. It's not really an error in that case anyway, since >> we only want to write the last bit of output *if we can*. > > Thanks, this fixes the test. However, I'm unsure we should fix this > inside eshell-sentinel: do we always want to ignore "broken pipe" > errors in Eshell subprocesses, and never show them to the user? I think we do want to ignore that error here. In `eshell-sentinel', we only run the `finish-io' code when the subprocess's state has already changed; in this case, that means the subprocess has already been terminated, since Eshell doesn't handle cases like SIGSTOP or SIGCONT yet (see the commented out functions at the bottom of lisp/eshell/esh-proc.el). Normally, if we detect a broken pipe, we'd want to signal the subprocess that tried to write, but since we know it's already been terminated, there's no (living) process to signal anymore. It would be good to support cases like SIGSTOP/SIGCONT in the future, but `eshell-sentinel' already fails to account for that, so this patch doesn't make things worse in that regard. For example, this function always calls `eshell-remove-process-entry', whose docstring says: Record the process ENTRY as fully completed. That's definitely not right for a process being continued with SIGCONT, and probably isn't right for SIGSTOP either.