GNU bug report logs - #79079
31.0.50; Piped command output is sometimes lost in Eshell

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Daniel Mendler <mail@HIDDEN>; dated Wed, 23 Jul 2025 09:57:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 79079 <at> debbugs.gnu.org:


Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 14:56:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 24 10:56:48 2025
Received: from localhost ([127.0.0.1]:57465 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uexNH-0008Fi-IQ
	for submit <at> debbugs.gnu.org; Thu, 24 Jul 2025 10:56:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34136)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uexNE-0008FB-TN
 for 79079 <at> debbugs.gnu.org; Thu, 24 Jul 2025 10:56:45 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1uexN8-0005NN-0b; Thu, 24 Jul 2025 10:56:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=aWkv5GJTVUZ07qrcouJ4ZKUw64OYSiaZ5NrvtQKqh3k=; b=Ow7PDF8iRsrT
 UQ1VJo/WkHS3ibCw2Gq3WP379n/ux9HWCyhNYGY1ZRWgxVdzoKv5S4Jzfv5CMax8FstGdJGs3i+bZ
 nB1/fV1O90OweAkjdlcFMImp58+dJBQMO4ILIMAqrEBDIvrVgI8oJrI+ebq7/8aj67cbQd4R2B8mI
 XZVbdlOlezOzmJ+skUQvGb5r9uynm4BHDRi9MHguB7Z9/XHR9JP5R/G1DCd/1LTj65LvZVZWcKMmc
 VTW5AIYPoHfDrD7jNNn96QHDy4bGTHQfDxul6AiliynWn3ovIE6vlDPxzm2/H03XanLZDO9sOb0pD
 g9spxgWQvKJ9BokB0o7izA==;
Date: Thu, 24 Jul 2025 17:56:35 +0300
Message-Id: <86cy9p63j0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <fa47910e-efad-4b4d-b56c-f0f47d6085b8@HIDDEN> (message from
 Paul Eggert on Thu, 24 Jul 2025 06:52:39 -0700)
Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in
 Eshell
References: <87pldr5iza.fsf@HIDDEN>
 <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
 <f48fb759-2a23-19be-5a76-6d2f32f35478@HIDDEN> <864iv26tkk.fsf@HIDDEN>
 <fa47910e-efad-4b4d-b56c-f0f47d6085b8@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79079
Cc: jporterbugs@HIDDEN, mail@HIDDEN, 79079 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Thu, 24 Jul 2025 06:52:39 -0700
> Cc: mail@HIDDEN, 79079 <at> debbugs.gnu.org,
>  Jim Porter <jporterbugs@HIDDEN>
> From: Paul Eggert <eggert@HIDDEN>
> 
> >> I think in this case, we'd just want to let the rest of our code handle
> >> deactivating the process in the usual way. That helps fix this bug, plus
> >> I think it makes sense in general. If a process closes stdin, I believe
> >> we'd get the EPIPE error, but that process might want to continue
> >> working (though it does mean that you could only interact with that
> >> process via signaling it).
> 
> Yes, that makes sense.
> 
> 
> > What about calling the filter with the data we still have?  Isn't that
> > what a Posix shell would do -- flush any buffers?
> 
> Not sure what you man by that, but I suspect it wouldn't handle the 
> scenario Jim describes, where the other process closes its end of the 
> pipe but keeps running. Emacs shouldn't assume that EPIPE means the 
> other process has died or has closed any pipes other than the one Emacs 
> got EPIPE on.

I guess I'm confused: if the other process closed its end of the pipe,
why do we care about the stuff we have in our buffers that wasn't yet
piped to that other process?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79079; Package emacs. Full text available.

Message received at 79079 <at> debbugs.gnu.org:


Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 13:52:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 24 09:52:49 2025
Received: from localhost ([127.0.0.1]:55777 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uewNN-0003G0-5N
	for submit <at> debbugs.gnu.org; Thu, 24 Jul 2025 09:52:49 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:46008)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1uewNJ-0003FZ-UB
 for 79079 <at> debbugs.gnu.org; Thu, 24 Jul 2025 09:52:47 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 45CD93C01084A;
 Thu, 24 Jul 2025 06:52:40 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
 id nP6OunJTDlfU; Thu, 24 Jul 2025 06:52:40 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 19FEF3C010841;
 Thu, 24 Jul 2025 06:52:40 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 19FEF3C010841
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753365160;
 bh=BqGXE9X9HvCb167X23q9wBgiciAa14REhEt9S/BWREo=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=qz+ykQMPKwGROaqLO9FhjLLcJHOXp9JnSh7tkYr/U6nyThb04L49lcdqvRZjDt8Cu
 8sEK21b5/iQzO3wEbKzdFydfStXza8MWbPeSO/mrGYcPajL9CzHWUVmBsL9WZDFv40
 FwsPRgvIr6szuPUDKzIIJRoEdeK88R6EBWlLSfQAwYXpBDMmMiI6Nrc9/giIAbcpL7
 WdHtUJG4RRWSbHxe9AKj4bUqJ6edwTNMtSDE0ptcB2u2DMw1yhOpgK/SG/qbDN6EtE
 sL5icG1RQBMwKgZi7NHoiLCQ4O1ggcBqn4Bc4+1nXUoxLUi5ZLvqVVyqRloy8yBvNm
 zeH/Z3rsm592A==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
 id ZCWPRofmc9Ot; Thu, 24 Jul 2025 06:52:40 -0700 (PDT)
Received: from penguin.cs.ucla.edu (unknown [47.154.30.222])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id E31873C01084A;
 Thu, 24 Jul 2025 06:52:39 -0700 (PDT)
Message-ID: <fa47910e-efad-4b4d-b56c-f0f47d6085b8@HIDDEN>
Date: Thu, 24 Jul 2025 06:52:39 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in
 Eshell
To: Eli Zaretskii <eliz@HIDDEN>
References: <87pldr5iza.fsf@HIDDEN>
 <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
 <f48fb759-2a23-19be-5a76-6d2f32f35478@HIDDEN> <864iv26tkk.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <864iv26tkk.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79079
Cc: Jim Porter <jporterbugs@HIDDEN>, mail@HIDDEN,
 79079 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 2025-07-23 22:34, Eli Zaretskii wrote:
>> Date: Wed, 23 Jul 2025 11:06:24 -0700
>> From: Jim Porter<jporterbugs@HIDDEN>

>> In process.c,
>> when we write to a process, we handle EPIPE errors by calling
>> 'deactivate_process'. However, that can lead to us dropping any data
>> written*by* that process, since we don't call the process's filter
>> function for any remaining output still in our internal buffer.
>>
>> I think in this case, we'd just want to let the rest of our code handle
>> deactivating the process in the usual way. That helps fix this bug, plus
>> I think it makes sense in general. If a process closes stdin, I believe
>> we'd get the EPIPE error, but that process might want to continue
>> working (though it does mean that you could only interact with that
>> process via signaling it).

Yes, that makes sense.


> What about calling the filter with the data we still have?  Isn't that
> what a Posix shell would do -- flush any buffers?

Not sure what you man by that, but I suspect it wouldn't handle the 
scenario Jim describes, where the other process closes its end of the 
pipe but keeps running. Emacs shouldn't assume that EPIPE means the 
other process has died or has closed any pipes other than the one Emacs 
got EPIPE on.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79079; Package emacs. Full text available.

Message received at 79079 <at> debbugs.gnu.org:


Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 05:34:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 24 01:34:15 2025
Received: from localhost ([127.0.0.1]:54015 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ueoat-0008J2-4c
	for submit <at> debbugs.gnu.org; Thu, 24 Jul 2025 01:34:15 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40616)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1ueoar-0008IZ-98
 for 79079 <at> debbugs.gnu.org; Thu, 24 Jul 2025 01:34:13 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1ueoak-00049o-6r; Thu, 24 Jul 2025 01:34:06 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=b/iqVqCuTmeMDiOy7zlurQWb1vwTxWkdnDH1BHYXTwc=; b=UlPHWMsd6IhM
 S9c80USA5Ea9sGQ+Jm4GE0dWeKGgHRcYqV8nDo6TrsHYVxwcwK5wSHvdLfjAPqbRET+uxcrlRh3uL
 8jKazHchZzhwFDMqtBNbu4RUwPGRS0gBFJSNRAAUqNpvGMHxbyvaP9jwmpZbf++FtoQSZ7NXup0eG
 RZMreYc9+i3ImRFK9CjEyQhjgbivGExjnufpVq6IL7dlnFGQXdCcNO8DDepzFo7/KLmhzZu7EV3Ej
 UU/Cs5VvY9WbNCHRStZsYlM35u+pVk1Hm6jHCYnpfmO/Jc0D+PNsg6nvrQEDd/6jK4TIBExwePcpa
 MRTwDzfdzP05KsIqGEX6Sw==;
Date: Thu, 24 Jul 2025 08:34:03 +0300
Message-Id: <864iv26tkk.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>,
 Paul Eggert <eggert@HIDDEN>
In-Reply-To: <f48fb759-2a23-19be-5a76-6d2f32f35478@HIDDEN> (message from
 Jim Porter on Wed, 23 Jul 2025 11:06:24 -0700)
Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in
 Eshell
References: <87pldr5iza.fsf@HIDDEN>
 <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
 <f48fb759-2a23-19be-5a76-6d2f32f35478@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 79079
Cc: mail@HIDDEN, 79079 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 23 Jul 2025 11:06:24 -0700
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> On 7/23/2025 8:52 AM, Jim Porter wrote:
> > I'm not able to reproduce this locally, but if you first run 
> > "eshell-debug process", that will log a bunch of process-related 
> > information to the buffer "*eshell last cmd*". That would probably have 
> > some details that at least show where the I/O went missing.
> 
> After a few more tries, I was able to reproduce this very rarely. Does 
> the following patch help?
> 
> Eli: maybe you can help with some of the details here. In process.c, 
> when we write to a process, we handle EPIPE errors by calling 
> 'deactivate_process'. However, that can lead to us dropping any data 
> written *by* that process, since we don't call the process's filter 
> function for any remaining output still in our internal buffer.
> 
> I think in this case, we'd just want to let the rest of our code handle 
> deactivating the process in the usual way. That helps fix this bug, plus 
> I think it makes sense in general. If a process closes stdin, I believe 
> we'd get the EPIPE error, but that process might want to continue 
> working (though it does mean that you could only interact with that 
> process via signaling it).
> 
> Does that make sense?

Sounds a somewhat scary change, since this code was last touched 13
years ago.  Paul, WDYT?

What about calling the filter with the data we still have?  Isn't that
what a Posix shell would do -- flush any buffers?

And why do we get EPIPE in the recipe in this bug, anyway?  I'd like
to understand better at least one situation where we get EPIPE while
the data received before that still matters.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79079; Package emacs. Full text available.

Message received at 79079 <at> debbugs.gnu.org:


Received: (at 79079) by debbugs.gnu.org; 23 Jul 2025 18:17:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 23 14:17:59 2025
Received: from localhost ([127.0.0.1]:51778 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uee2Q-0004x8-Kd
	for submit <at> debbugs.gnu.org; Wed, 23 Jul 2025 14:17:58 -0400
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:33517 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mail@HIDDEN>)
 id 1uee2O-0004we-3x
 for 79079 <at> debbugs.gnu.org; Wed, 23 Jul 2025 14:17:57 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date:
 References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:
 List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=UPFmLFIAUKmkG8DOjrpDizJcw/qswhPMmH9RQAgFLBk=; b=UpaCgETmFx+JFJ+5vnL2uFsqTA
 aGtRoOvEczRpd0HuQoF7amybw+/hLnC0afbwjQTdxujQEYBM7685QxPwq40Y+V7JIoLr2l8rnc3Ks
 cZJhXxCJgxgfPWPG0OEmZ8qXV+woABhPBasBLGDVmxF4BlKI3oQVOmsvlPtBlqtcwTjI=;
From: Daniel Mendler <mail@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in
 Eshell
In-Reply-To: <f48fb759-2a23-19be-5a76-6d2f32f35478@HIDDEN>
References: <87pldr5iza.fsf@HIDDEN>
 <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
 <f48fb759-2a23-19be-5a76-6d2f32f35478@HIDDEN>
Date: Wed, 23 Jul 2025 20:17:47 +0200
Message-ID: <87cy9q6ab8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79079
Cc: eliz@HIDDEN, 79079 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Jim Porter <jporterbugs@HIDDEN> writes:

> On 7/23/2025 8:52 AM, Jim Porter wrote:
>> I'm not able to reproduce this locally, but if you first run "eshell-debug
>> process", that will log a bunch of process-related information to the buffer
>> "*eshell last cmd*". That would probably have some details that at least show
>> where the I/O went missing.
>
> After a few more tries, I was able to reproduce this very rarely. Does the
> following patch help?

Thanks for looking into this so quickly and coming up with a patch! I
can check this earliest end of next week. Recompiling Emacs always takes
me a little bit longer than simply evaluating some Elisp.

> Eli: maybe you can help with some of the details here. In process.c, when we
> write to a process, we handle EPIPE errors by calling 'deactivate_process'.
> However, that can lead to us dropping any data written *by* that process, since
> we don't call the process's filter function for any remaining output still in
> our internal buffer.
>
> I think in this case, we'd just want to let the rest of our code handle
> deactivating the process in the usual way. That helps fix this bug, plus I think
> it makes sense in general. If a process closes stdin, I believe we'd get the
> EPIPE error, but that process might want to continue working (though it does
> mean that you could only interact with that process via signaling it).

Maybe this also needs some test to avoid regressions? Did you find a way
to reliably reproduce the problem?

> Does that make sense?
>
> diff --git a/src/process.c b/src/process.c
> index e61ec425f7e..258bee21b5e 100644
> --- a/src/process.c
> +++ b/src/process.c
> @@ -6876,7 +6876,6 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
>                   p->raw_status_new = 0;
>                   pset_status (p, list2 (Qexit, make_fixnum (256)));
>                   p->tick = ++process_tick;
> -                 deactivate_process (proc);
>                   error ("Process %s no longer connected to pipe; closed it",
>                          SDATA (p->name));
>                 }




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79079; Package emacs. Full text available.

Message received at 79079 <at> debbugs.gnu.org:


Received: (at 79079) by debbugs.gnu.org; 23 Jul 2025 18:06:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 23 14:06:32 2025
Received: from localhost ([127.0.0.1]:51752 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uedrM-0004EX-4X
	for submit <at> debbugs.gnu.org; Wed, 23 Jul 2025 14:06:32 -0400
Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:42360)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <jporterbugs@HIDDEN>)
 id 1uedrJ-0004Ds-Tc
 for 79079 <at> debbugs.gnu.org; Wed, 23 Jul 2025 14:06:30 -0400
Received: by mail-pl1-x62c.google.com with SMTP id
 d9443c01a7336-2350fc2591dso2492025ad.1
 for <79079 <at> debbugs.gnu.org>; Wed, 23 Jul 2025 11:06:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1753293984; x=1753898784; darn=debbugs.gnu.org;
 h=in-reply-to:references:to:from:content-language:subject
 :mime-version:date:message-id:from:to:cc:subject:date:message-id
 :reply-to; bh=iirs8EQ41rW4tyh/S1Wuq+3up8gtkefEdyqmNgAeNUA=;
 b=Ksc9d+S8Zlz6NdE2zLZZ7PjkfQZoXXnGfP9oInHjpVMIeJie58JqyG9ie2sL1yo3Gi
 Yyza1Cl7y6p/dEKzar5F+kmwDGgqyecg5ZQfArStb2+u2L6aoNWUBulot2KwPwzQo0p2
 daNhvGm5r6vYVwMCnEVq04vKC6jSTOHB3NeicjE8UmuCPm+qBlcsNOWVTt4iRutmXj8T
 GU5+7lhSRhnCD6NNGRrmZ9CHh9rwpwBYqiou5KG9FasKDAlfwuiKyfTWyViw2j0IEv5o
 Wog9+SzgSsepd7kgcpLUnw05bq0zzMjon9iYhg4d6Siytn/49/b5/OD5rPJ9ge/RAFnt
 mmGQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1753293984; x=1753898784;
 h=in-reply-to:references:to:from:content-language:subject
 :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
 :date:message-id:reply-to;
 bh=iirs8EQ41rW4tyh/S1Wuq+3up8gtkefEdyqmNgAeNUA=;
 b=g+6wGpryMJlZJWSO5FlT8/9/7+ja0A6HSz8A8U18cQjC7eXBiYxMLZt3RiL8WifYW8
 1u0Llj53DDEVXFlVdg0LDjXiDPDa8K3ORUEErdlroiFdeUKE5OpXuuPYxdjGcnNyznsF
 PjIrYU5wPyw5MFE8MpFrphi0mGBzVHjWnH2DyIwu/OEGTNBDccO/1C/CuzSnSYOP7lPp
 rpSJD2O6FM6PK60xxCO9kQkhE8LfSj4Albzx0OAgHJmAUOtE/EWfpo8INwfRFVF1w7by
 /mspNmxFg8ZFSU7rEBprAzVQL+SwjJaQhrFPID3zrEbrYPaN/9+p4AxDkbplnWotrHro
 hAAw==
X-Forwarded-Encrypted: i=1;
 AJvYcCVZYzAZLKmAdkGR0375JarK6+7vxNxBXt8bgoslrNeHHTuS0Jm1Lei0oK0muYs8fRSJqjL6gw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxMN95J39liCKEYSWyysCtg1hO8QBrUD4rgY0pIwoobd6Nsmk1W
 tSWP1UQ8NIE/kzetkgrCEE9B06N5LlZrK20t5Rqy5LXL6L9peJN6wAKM
X-Gm-Gg: ASbGncttakOq2NGMeh2npXmpIkZNlAbeStqozlv2Z4oolElrx4mdQ0wD5Ef4Hh36/Tb
 t8MR93l2ut0bUVomNY5pYyDLiRb5zU62YiwAWog+/aWlUqNXDV8dB6uSt4dPoJpWoNM0XCQLocU
 gRgQMXWWzj7NxBBd6h8Gjp7rBXYlCo+EhevEmzWYgN3UTVvUjT8N9UW2/hk0NVd2nv3jbrlKYBr
 OY0X63ACYarfzGBw7NHY/CB32cy6YC+YnBNtO5oLT/pwC0BiqbbGZeBuYsZL65HRDZOBz04r6kR
 xwPb+fthLS7NfVAS39DB8Zp/Z4NAbR5xgHdIB7iElnadN3IpyQg0qMnS/xVG8703te2AWFMXqVV
 5FYR3b1/jIrOA8nObu1C6cvvTS9WbIdkTQrrIMY4SPauog0rrQVfFIcEGafKptIYBvWlnX7Kg/8
 VyiA==
X-Google-Smtp-Source: AGHT+IGx+RR/9JuXFN7xmGjbqps4g081jVw2IX4YBkSWvYpDdYbfC/jACYoeESwvzWO5g4R9MW8/5w==
X-Received: by 2002:a17:903:8cc:b0:235:278c:7d06 with SMTP id
 d9443c01a7336-23f98293fbdmr61826995ad.8.1753293983582; 
 Wed, 23 Jul 2025 11:06:23 -0700 (PDT)
Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com.
 [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id
 d9443c01a7336-23e3bdfe68csm100271005ad.183.2025.07.23.11.06.22
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 23 Jul 2025 11:06:22 -0700 (PDT)
Content-Type: multipart/mixed; boundary="------------3BvCia0jq3tE7vWYEGLLS1x1"
Message-ID: <f48fb759-2a23-19be-5a76-6d2f32f35478@HIDDEN>
Date: Wed, 23 Jul 2025 11:06:24 -0700
MIME-Version: 1.0
Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in
 Eshell
Content-Language: en-US
From: Jim Porter <jporterbugs@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>, 79079 <at> debbugs.gnu.org,
 eliz@HIDDEN
References: <87pldr5iza.fsf@HIDDEN>
 <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
In-Reply-To: <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79079
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------3BvCia0jq3tE7vWYEGLLS1x1
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 7/23/2025 8:52 AM, Jim Porter wrote:
> I'm not able to reproduce this locally, but if you first run 
> "eshell-debug process", that will log a bunch of process-related 
> information to the buffer "*eshell last cmd*". That would probably have 
> some details that at least show where the I/O went missing.

After a few more tries, I was able to reproduce this very rarely. Does 
the following patch help?

Eli: maybe you can help with some of the details here. In process.c, 
when we write to a process, we handle EPIPE errors by calling 
'deactivate_process'. However, that can lead to us dropping any data 
written *by* that process, since we don't call the process's filter 
function for any remaining output still in our internal buffer.

I think in this case, we'd just want to let the rest of our code handle 
deactivating the process in the usual way. That helps fix this bug, plus 
I think it makes sense in general. If a process closes stdin, I believe 
we'd get the EPIPE error, but that process might want to continue 
working (though it does mean that you could only interact with that 
process via signaling it).

Does that make sense?
--------------3BvCia0jq3tE7vWYEGLLS1x1
Content-Type: text/plain; charset=UTF-8; name="epipe.diff"
Content-Disposition: attachment; filename="epipe.diff"
Content-Transfer-Encoding: base64

ZGlmZiAtLWdpdCBhL3NyYy9wcm9jZXNzLmMgYi9zcmMvcHJvY2Vzcy5jCmluZGV4IGU2MWVj
NDI1ZjdlLi4yNThiZWUyMWI1ZSAxMDA2NDQKLS0tIGEvc3JjL3Byb2Nlc3MuYworKysgYi9z
cmMvcHJvY2Vzcy5jCkBAIC02ODc2LDcgKzY4NzYsNiBAQCBzZW5kX3Byb2Nlc3MgKExpc3Bf
T2JqZWN0IHByb2MsIGNvbnN0IGNoYXIgKmJ1ZiwgcHRyZGlmZl90IGxlbiwKICAgICAgICAg
ICAgICAgICAgcC0+cmF3X3N0YXR1c19uZXcgPSAwOwogICAgICAgICAgICAgICAgICBwc2V0
X3N0YXR1cyAocCwgbGlzdDIgKFFleGl0LCBtYWtlX2ZpeG51bSAoMjU2KSkpOwogICAgICAg
ICAgICAgICAgICBwLT50aWNrID0gKytwcm9jZXNzX3RpY2s7Ci0gICAgICAgICAgICAgICAg
IGRlYWN0aXZhdGVfcHJvY2VzcyAocHJvYyk7CiAgICAgICAgICAgICAgICAgIGVycm9yICgi
UHJvY2VzcyAlcyBubyBsb25nZXIgY29ubmVjdGVkIHRvIHBpcGU7IGNsb3NlZCBpdCIsCiAg
ICAgICAgICAgICAgICAgICAgICAgICBTREFUQSAocC0+bmFtZSkpOwogICAgICAgICAgICAg
ICAgfQ==

--------------3BvCia0jq3tE7vWYEGLLS1x1--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79079; Package emacs. Full text available.

Message received at 79079 <at> debbugs.gnu.org:


Received: (at 79079) by debbugs.gnu.org; 23 Jul 2025 16:37:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 23 12:37:17 2025
Received: from localhost ([127.0.0.1]:51257 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uecSy-0003mC-6A
	for submit <at> debbugs.gnu.org; Wed, 23 Jul 2025 12:37:16 -0400
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:55549 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mail@HIDDEN>)
 id 1uecSn-0003lH-9T
 for 79079 <at> debbugs.gnu.org; Wed, 23 Jul 2025 12:37:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=daniel-mendler.de; s=key; h=Content-Transfer-Encoding:Content-Type:
 MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender
 :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:
 Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:
 List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=FMVPeLZb2hrAhdW9liaGUtLEOrhR6BS1ungrVwmrbgI=; b=qThM1vsS0wDhgE5Qi9HGAS/DqA
 5WpNf/uZBlJFx26/kCn1BvZvhvbppgWOJTM/P2V2yrdBiGY6XZp7gNtpNC63IeIIJU0M5KWt7mcH7
 We7mJRnuPIFJ7YuQjPp2lDZ+W6jzsuO4hRQh4A+hzbEKYtQaWoVlSr3PfIy+Go+/fmaw=;
From: Daniel Mendler <mail@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in
 Eshell
In-Reply-To: <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
References: <87pldr5iza.fsf@HIDDEN>
 <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
Date: Wed, 23 Jul 2025 18:36:56 +0200
Message-ID: <87ikji6ezb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79079
Cc: 79079 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Jim Porter <jporterbugs@HIDDEN> writes:

> On 7/23/2025 2:55 AM, Daniel Mendler via Bug reports for GNU Emacs, the S=
wiss
> army knife of text editors wrote:
>> sometimes when executing commands in Eshell with pipes the output seems
>> to get lost, for example:
> [snip]
>> Can someone confirm these problems? Thanks!
>
> I'm not able to reproduce this locally, but if you first run "eshell-debug
> process", that will log a bunch of process-related information to the buf=
fer
> "*eshell last cmd*". That would probably have some details that at least =
show
> where the I/O went missing.

Thanks. I tried your suggestion. What stood out is that in the failed
runs, the output from the git process is received, and passed on to the
head process, but no output is received from head. It seems that the
head filter function is never called? This would hint at a lower-level
problem. See the logs of the runs below.

The problem occurs in particular for this command:

git log --color=3Dalways --decorate=3Dyes | head -n 1

While it does not happen (or not so often) for this:

git log --color=3Dalways --decorate=3Dyes | cat | head -n 1

Did you try the loop with the echo and the command? Do you have any
further suggestions on how to debug this? Maybe it has something to do
with my specific build.

Daniel

### Good run
[process] started external process =E2=80=98head=E2=80=99
[process] started external process =E2=80=98git=E2=80=99
[process] received output from process =E2=80=98git=E2=80=99
[process] forwarding output from process =E2=80=98git=E2=80=99
[process] received output from process =E2=80=98head=E2=80=99 <=3D=3D=3D=3D=
=3D received output
[process] received output from process =E2=80=98git=E2=80=99
[process] forwarding output from process =E2=80=98git=E2=80=99
[process] received output from process =E2=80=98git=E2=80=99
[process] forwarding output from process =E2=80=98git=E2=80=99
[process] sentinel for external process =E2=80=98git=E2=80=99: "broken pipe
[process] i/o busy for process =E2=80=98git=E2=80=99
[process] sentinel for external process =E2=80=98git-stderr=E2=80=99: "fini=
shed
[process] finished external process =E2=80=98git-stderr=E2=80=99
[process] sentinel for external process =E2=80=98head=E2=80=99: "finished <=
=3D=3D=3D=3D=3D finished
[process] finished external process =E2=80=98head=E2=80=99
[process] finished external process =E2=80=98git=E2=80=99

### Bad run
[process] started external process =E2=80=98head=E2=80=99
[process] started external process =E2=80=98git=E2=80=99
[process] received output from process =E2=80=98git=E2=80=99
[process] forwarding output from process =E2=80=98git=E2=80=99
[process] received output from process =E2=80=98git=E2=80=99
[process] forwarding output from process =E2=80=98git=E2=80=99
[process] received output from process =E2=80=98git=E2=80=99
[process] forwarding output from process =E2=80=98git=E2=80=99
[process] sentinel for external process =E2=80=98head=E2=80=99: "finished
[process] finished external process =E2=80=98head=E2=80=99 <=3D=3D=3D=3D=3D=
 finished without output
[process] sentinel for external process =E2=80=98git=E2=80=99: "broken pipe
[process] i/o busy for process =E2=80=98git=E2=80=99
[process] sentinel for external process =E2=80=98git-stderr=E2=80=99: "fini=
shed
[process] finished external process =E2=80=98git-stderr=E2=80=99
[process] finished external process =E2=80=98git=E2=80=99




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79079; Package emacs. Full text available.

Message received at 79079 <at> debbugs.gnu.org:


Received: (at 79079) by debbugs.gnu.org; 23 Jul 2025 15:52:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 23 11:52:45 2025
Received: from localhost ([127.0.0.1]:51049 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uebls-0000g6-Kv
	for submit <at> debbugs.gnu.org; Wed, 23 Jul 2025 11:52:45 -0400
Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:48504)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <jporterbugs@HIDDEN>)
 id 1ueblp-0000fR-DG
 for 79079 <at> debbugs.gnu.org; Wed, 23 Jul 2025 11:52:42 -0400
Received: by mail-pj1-x102f.google.com with SMTP id
 98e67ed59e1d1-3141b84bf65so6400449a91.1
 for <79079 <at> debbugs.gnu.org>; Wed, 23 Jul 2025 08:52:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1753285955; x=1753890755; darn=debbugs.gnu.org;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:mime-version:date:message-id:from:to:cc
 :subject:date:message-id:reply-to;
 bh=l+Pp4nDh2+ltybzKKcKjZAL0j2goA4dVOk1Q1pb+fKE=;
 b=UVoHNsVTpts3AKM6Kd3xlCX17ihL88MZOSMqWtoGwWX15No2SJ+ZD2O9vYPoDHecaW
 tMK1kmIFmmYPncC1vTKpuijqnvNaXG6D6l2dpjt0qSFXzXg9t3OsaIXjaiTHhz9J91QU
 kqlitNCWkcf/bya6VYldCbGSVNSlAxRk+Ca+C0TTgMt+3DpD0oRHyL+t+xxUfiGJSm+0
 7Kt282mDYrzfNnUE7B5LAH9IN/3XzauX15p3mGAdIZB8TK5/937LZ/GCWrEiMG4/yKI7
 yG0Oyv9sMnJ0PRr4vdkcZLx4GgdUkUZ6zVtETJQ2a4QW+ZWcsCAJTXvpD1hiAr0KtvEX
 /bfw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1753285955; x=1753890755;
 h=content-transfer-encoding:in-reply-to:from:references:to
 :content-language:subject:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=l+Pp4nDh2+ltybzKKcKjZAL0j2goA4dVOk1Q1pb+fKE=;
 b=oZR+X5gYXf6LNz0toHobBP8O5x+BX3onttsG4MQGDN2dscYA7FQub5ZhZc4FRy4gMV
 XpKzNoOdcfWuHyWrd/YEP9oqqLm08rU7TfcRIUc44dm2BLh7/ElmbwpBZdOvd3GFs+5f
 G7nPqhRUmae9lmpP//3OUQCFR3U4H/XaeimxvDKxgPJFOcG8PM5jcSxBl5E4M/PGkWYB
 k2G73pKE4s5leuCWYPm+K4K4msnwhtv8wf2fG4+G11aV6md/+oBnxRPn7Z5XOp2SzF3A
 NgxA4OuvGtEMTpwUXYUnRjTwy3gKF6/2f/YEqxHAHu1ReX9IdxlEO/RzX/SvJB/Kck6k
 0u7w==
X-Forwarded-Encrypted: i=1;
 AJvYcCWqKZ7vHdFAWcqHxZ2g+Mqky11M5SUvPsj9c4h1+1P1ahqEjOAFnslXoqsFwk87fHHY/OgxAg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwbefFa4A89xu9GchNgAFcSLZo5164JhcfYstEv+NC5THOlTADV
 7hJbHzo+IpUxycSh+bUtQJHrxe7jmW7m6FLGMU15LPMha3ovH+qNz1LsFuyqmg==
X-Gm-Gg: ASbGnctrEUbb17lkwlVIQmCCtXtbXTUsQlpNc/swoFBJaTpJCtBpl2Sc9+cpWjeyf9W
 UsVh/cPiFUjFnU4mndct79n1enUmqGGja/1BewHaCoyfJIjfnjy5pEGJtk024VKr0cZn5QGbrmL
 Vk3Hz+JZ0STw+AQRdbvaq8jMMkGD3gYn2ocRRKjgtWcHG9BsUQl2+KlWuebKSYHlBfWQmJHy9UK
 k5V0LkuikHag1EyewresbQqdA0cvewWBCFOjGqi9xdvJLT7Z3xYlIp0xYhcWubZ5A+QSvBnntA/
 vgyMA9o1bbHtPiTUX6qJI9HcnP+OuReJxiSSE4ey/guGkM8kvZEJjNGJE0Zkb2tbQ/lc9i+n2tP
 /haR9LEA78iOP7eLYdHP+Kh+lcnFzwofkNmKUc0bXdPQq8u4N93W3qvFxMMrR5c/DgiYMpVd2Tl
 NKng==
X-Google-Smtp-Source: AGHT+IExnna1CVcZ8i40b6dgB0Cp1kTZEiMOvhEktXYsOFgeIMlQS8/MLfCOSynECj5TI4mq0trm5A==
X-Received: by 2002:a17:90b:1f81:b0:31c:ad57:b97a with SMTP id
 98e67ed59e1d1-31e507ab2admr5145795a91.13.1753285955141; 
 Wed, 23 Jul 2025 08:52:35 -0700 (PDT)
Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com.
 [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id
 98e67ed59e1d1-31e519f4f0fsm1950053a91.10.2025.07.23.08.52.34
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 23 Jul 2025 08:52:34 -0700 (PDT)
Message-ID: <26784dc3-a846-b880-a023-c3e7d8da3399@HIDDEN>
Date: Wed, 23 Jul 2025 08:52:36 -0700
MIME-Version: 1.0
Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in
 Eshell
Content-Language: en-US
To: Daniel Mendler <mail@HIDDEN>, 79079 <at> debbugs.gnu.org
References: <87pldr5iza.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <87pldr5iza.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79079
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 7/23/2025 2:55 AM, Daniel Mendler via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> sometimes when executing commands in Eshell with pipes the output seems
> to get lost, for example:
[snip]
> Can someone confirm these problems? Thanks!

I'm not able to reproduce this locally, but if you first run 
"eshell-debug process", that will log a bunch of process-related 
information to the buffer "*eshell last cmd*". That would probably have 
some details that at least show where the I/O went missing.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79079; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Jul 2025 09:56:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 23 05:56:13 2025
Received: from localhost ([127.0.0.1]:48477 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ueWCq-0003fr-Nj
	for submit <at> debbugs.gnu.org; Wed, 23 Jul 2025 05:56:13 -0400
Received: from lists.gnu.org ([2001:470:142::17]:43644)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mail@HIDDEN>)
 id 1ueWCl-0003f6-99
 for submit <at> debbugs.gnu.org; Wed, 23 Jul 2025 05:56:09 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mail@HIDDEN>)
 id 1ueWCf-0001dN-Uj
 for bug-gnu-emacs@HIDDEN; Wed, 23 Jul 2025 05:56:01 -0400
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1] helo=mail.qxqx.de)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mail@HIDDEN>)
 id 1ueWCb-0003od-IT
 for bug-gnu-emacs@HIDDEN; Wed, 23 Jul 2025 05:56:01 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date:
 Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=mA6bB64ytMUQ/WmYpboa6CiGSeTtsenNCWfjZhPLGfg=; b=EGB3ESl1a7dh3swTLqHwNEgon+
 6uur7HNHCVrNqdNntYDG4/Kd0mtuH6pqJGZqqQrgc3C/9kE/2SVvfcXG5p7FWhavWYxWJp/AeTnUD
 J4ApBC6TQs5+tH9pNvWUK9NzAAbMPtZ4jUVK1+0B+OuOYsPWuh373xFv/bUyZpMT/NdY=;
From: Daniel Mendler <mail@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; Piped command output is sometimes lost in Eshell
X-Debbugs-Cc: Jim Porter <jporterbugs@HIDDEN>
Date: Wed, 23 Jul 2025 11:55:53 +0200
Message-ID: <87pldr5iza.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a01:4f8:c012:9177::1;
 envelope-from=mail@HIDDEN; helo=mail.qxqx.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

Hello,

sometimes when executing commands in Eshell with pipes the output seems
to get lost, for example:

git log | head -n 10 | cat

Instead of the expected ten lines of output, there is no output. This
problem does not happen always, but from time to time, so maybe there is
some timing issue regarding the process handling? In case the issue does
not occur immediately one can try this:

while true { echo "test"; git log | head -n 1 | cat }

For such loops the following error might occur:

Creating pipe: Too many open files
Cannot redirect stderr: Too many open files, /dev/null

I tested this with emacs -Q on Emacs 31 with a relatively recent commit
from a few days ago (1e3d76af5a7a16682e71f9df46f6788c0880cccd).

Can someone confirm these problems? Thanks!

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.4) of 2025-07-15
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Debian GNU/Linux 13 (trixie)

Configured using:
 'configure --prefix=$HOME/.local/share/emacs
 --without-compress-install --with-tree-sitter --with-native-compilation
 --with-dbus --without-selinux --without-threads --disable-gc-mark-trace
 --without-gsettings --without-gpm --with-cairo --with-cairo-xcb
 --with-xinput2 --with-x-toolkit=gtk3 --without-toolkit-scroll-bars
 'CFLAGS=-O3 -mtune=native -march=native''

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSYSTEMD
LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 TIFF TREE_SITTER WEBP X11 XDBE XIM XINERAMA XINPUT2 XPM
XRANDR GTK3 ZLIB




Acknowledgement sent to Daniel Mendler <mail@HIDDEN>:
New bug report received and forwarded. Copy sent to jporterbugs@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to jporterbugs@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#79079; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 24 Jul 2025 15:00:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.