GNU bug report logs - #80760
process-send-string to broken network socket kills Emacs (SIGPIPE)

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: "Marten Lienen" <ml@HIDDEN>; dated Tue, 7 Apr 2026 18:51:07 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 19:41:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 15:41:34 2026
Received: from localhost ([127.0.0.1]:55867 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAYmM-0007fs-FS
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 15:41:34 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:48392)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1wAYmH-0007fG-Kh
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 15:41:33 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id A1AF13C033C2B;
 Wed,  8 Apr 2026 12:41:22 -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 k-RxXmMj7Y5h; Wed,  8 Apr 2026 12:41:22 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 79FE33C033C30;
 Wed,  8 Apr 2026 12:41:22 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 79FE33C033C30
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1775677282;
 bh=rVm8qkZAT7fAr+jNR7MWpaZbBWeRueOPuTubE0GLsQY=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=Xl6WZ6WwHQ6YtjKNKzPieLrQ5rCEvtkJMZQeikT0QQEN/g8bcnt6HfsnC4eguQBHs
 CtSiXtsuW537g1Xrcjiwbby9nbaAF7X99NS3z258WLLgf7EMMP0lf4nuVH/yWNEX2M
 giD/veAhE4usNPSH3Kd6VF7If5cJ2bo+pHbw3imNgi5AZaJC6ckvnMwsPry2x+aTvd
 ItXfxIGB3JyGbr0nEBmjKxa8umg6t5OKBzGB3pesdT/tY5AXmNOGT3tzT0Zpw47zJf
 13NZWVl92/Q7izbgsouQfFl/zePoBmFYtDyfgK0xvueHdSrXJ7AnMWaoBnCSMVlWfG
 F95QhrJVZSjkQ==
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 bgATxy_gNAPN; Wed,  8 Apr 2026 12:41:22 -0700 (PDT)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 5CD4F3C033C2B;
 Wed,  8 Apr 2026 12:41:22 -0700 (PDT)
Message-ID: <2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN>
Date: Wed, 8 Apr 2026 12:41:21 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
To: Pip Cet <pipcet@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <87ldexbgks.fsf@HIDDEN>
 <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
 <87fr55b8fj.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Autocrypt: addr=eggert@HIDDEN; keydata=
 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
Organization: UCLA Computer Science Department
In-Reply-To: <87fr55b8fj.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80760
Cc: 80760 <at> debbugs.gnu.org, Marten Lienen <ml@HIDDEN>
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 2026-04-08 11:42, Pip Cet wrote:
> where's the harm in throwing a proper Lisp error which, when
> uncaught, kills emacs anyway? We can add the code to make the kill a
> SIGPIPE-induced one, if that is desirable.

Yes, it's desirable, and it sounds like a good way to go.




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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 18:42:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 14:42:15 2026
Received: from localhost ([127.0.0.1]:54436 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAXqw-0002SW-NJ
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 14:42:15 -0400
Received: from mail-244116.protonmail.ch ([109.224.244.116]:50043)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1wAXqu-0002Rn-14
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 14:42:13 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1775673724; x=1775932924;
 bh=1H7MKUO5zcqySsBzNzPQLAgO8wD6tQz/JBQEz/OeNCU=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector;
 b=dI676OZVxMVa4nGLPgYWCJHZr524BifBsSBVO2Ekvit5CMg/dILphg9SKp3kFTGZV
 WjUknYngQsB2CURyGtE0cPcE/W2anw2lmEEL/PgocUne2GilYAeotZbQmYW+Afdzr4
 WwlS5wYuOt/NsdJOHId20vIAyYMaihX84M5uS+5M8qJarkZVl8quOg743VFTlrk3es
 +h8t/TUPFk8Udj3h2peASTxiQQZIZHrZX7hppXKVBO1FHtshT7uuEvJFKwoR17oxZi
 9y2UVI1pE2OCcehivDmfdrjClLmkmGvmbnq04xkUJzJy6b/7c/U1m+MNXElPFXRLIW
 Hl9xsbJ3Bq2CQ==
Date: Wed, 08 Apr 2026 18:42:00 +0000
To: Paul Eggert <eggert@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
Message-ID: <87fr55b8fj.fsf@HIDDEN>
In-Reply-To: <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <87ldexbgks.fsf@HIDDEN>
 <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: bbff52b8093f428673a72fd25735a55681b2d57b
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: 80760
Cc: 80760 <at> debbugs.gnu.org, Marten Lienen <ml@HIDDEN>
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 (-)

"Paul Eggert" <eggert@HIDDEN> writes:

> On 2026-04-08 08:46, Pip Cet wrote:
>> I don't think it's "typical" for batch applications to die on SIGPIPE,
>> except for stdin and stdout.
>
> Perhaps you meant stdout and stderr? SIGPIPE on stdin would be pretty wei=
rd.

Let's pretend I did mean that (I actually was confused about when
SIGPIPE happens, but what made the confusion worse is a bug in
read_minibuf_noninteractive).

> But you're wrong about typical batch applications: they commonly die on
> SIGPIPE regardless of file descriptor, because POSIX says the default
> action on SIGPIPE is to die.

Hmm, I think we're thinking of different things: I was thinking about a
"typical" programming language which runs noninteractively; what you
talk about are primitive programs used in batch scripts. I agree "batch
application" sounds more like the latter, but Emacs is more like the
former.

> For example, on current Ubuntu here's 'cp' dying due to SIGPIPE on
> file descriptor 4:
>
>    $ mkfifo fifo
>    $ strace -o tr cp /usr/bin/emacs fifo &
>    [1] 217221
>    $ <fifo
>    [1]+  Broken pipe             strace -o tr cp /usr/bin/emacs fifo
>    $ tail -n4 tr
>    read(3,
> "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\25\6\0\0\0\0\0"...,
> 262144) =3D 262144
>    write(4,
> "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\25\6\0\0\0\0\0"...,
> 262144) =3D -1 EPIPE (Broken pipe)
>    --- SIGPIPE {si_signo=3DSIGPIPE, si_code=3DSI_USER, si_pid=3D217224,
> si_uid=3D1000} ---
>    +++ killed by SIGPIPE +++

> That being said, some batch applications do ignore or trap SIGPIPE. For
> example, GNU 'sort' traps SIGPIPE so that it can remove temporary files
> before killing itself with SIGPIPE. Batch Emacs should be able to do the
> same, and this suggests that we should add a new primitive to Emacs. But
> for sanity's sake the default should be like POSIX, i.e., die on SIGPIPE.

I think that might make sense for stderr (what else are we going to do,
print an error message?) but not for network processes or pipelines we
opened.

So where's the harm in throwing a proper Lisp error which, when
uncaught, kills emacs anyway? We can add the code to make the kill a
SIGPIPE-induced one, if that is desirable.

Pip





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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 17:23:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 13:23:44 2026
Received: from localhost ([127.0.0.1]:53415 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAWcy-0004io-DV
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 13:23:44 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:59914)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1wAWcv-0004iN-DU
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 13:23:42 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 23C783C033C2D;
 Wed,  8 Apr 2026 10:23:35 -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 Je3x80GoFV0G; Wed,  8 Apr 2026 10:23:35 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id EA6A13C033C2F;
 Wed,  8 Apr 2026 10:23:34 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu EA6A13C033C2F
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1775669015;
 bh=0UAWkUAQDkVSrjmcOAvmkBDdsd+O86r0nHGeuhz7Lsc=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=mUXHJUVGtX0BjkRbmsmRKwtjShO1Tf244NmYyYea9Uahx5BHpTur8V4Tr1Zl+Aqfk
 ZjMjusTWQJgzk79FFn2PuMEVuLX7Xy+ZCZu2sbQ+U74AhcN3+CWzpodspy/kY90VRU
 8eXd9k62NTfhc/bxjdri7lzliiEL7SHsFkFN1H5rOyEzyEzAILnsXu0HY9UCBnxlwZ
 DYqgC4Vhw3eK7ICFRD8viIQFJaFrSPEGpTpqhaHRSOTqgtGDv2LeKmhTHzbhdrV1cu
 iRyLV0Cvc9NQcQWU43ExtUzATnyrovjtqPDpohyktY53Q+qidAClUTSjY1fCmeH0Ma
 QgPsxDc7t5Aqw==
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 s7dRV64T2YmA; Wed,  8 Apr 2026 10:23:34 -0700 (PDT)
Received: from penguin.cs.ucla.edu
 (47-154-25-11.fdr01.snmn.ca.ip.frontiernet.net [47.154.25.11])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id BDE943C033C2D;
 Wed,  8 Apr 2026 10:23:34 -0700 (PDT)
Message-ID: <3065d862-ad69-4da4-8e7c-ccdc112e1649@HIDDEN>
Date: Wed, 8 Apr 2026 10:23:34 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
To: Marten Lienen <ml@HIDDEN>, Pip Cet <pipcet@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <87ldexbgks.fsf@HIDDEN>
 <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
 <d6dc5467-4872-434b-8841-f0c0f293919f@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <d6dc5467-4872-434b-8841-f0c0f293919f@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80760
Cc: 80760 <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 2026-04-08 10:11, Marten Lienen wrote:
> If Emacs would behave the same for batch as for interactive use, i.e. convert SIGPIPE into a lisp error, it would still be compatible, wouldn't it? Because the Emacs lisp program and thus Emacs would still terminate if the error is not caught. But it would give people the option to handle it.

Something like that could work, yes. But in the batch case when the Lisp 
error is not caught Emacs should terminate by killing itself with 
SIGPIPE (i.e., raise (SIGPIPE)), so that the parent process sees the 
proper exit/signal status.




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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 17:12:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 13:12:23 2026
Received: from localhost ([127.0.0.1]:53249 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAWRy-0003xk-Lp
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 13:12:23 -0400
Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]:58483)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ml@HIDDEN>)
 id 1wAWRw-0003xL-7M
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 13:12:21 -0400
Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
 by mailfhigh.stl.internal (Postfix) with ESMTP id 367597A0184;
 Wed,  8 Apr 2026 13:12:14 -0400 (EDT)
Received: from phl-imap-11 ([10.202.2.101])
 by phl-compute-05.internal (MEProxy); Wed, 08 Apr 2026 13:12:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 martenlienen.com; h=cc:cc:content-transfer-encoding:content-type
 :content-type:date:date:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to; s=fm3; t=1775668333; x=1775754733; bh=EQ/7okhEqgoflUR50L4Yo
 eqfqIruTSGkEdvDCLewojc=; b=XB2wm6XaubLMFjEtREJ2ckLDvVBgHdfzfjzJX
 a0qgd7Rm/OqWbiFXpv3iVVO8pYnL7i6oGWWQpf4op0ynDN0wOA8Zk+Vm26q7YlQ2
 Zd0Ewiejutvt6qEt82+5rbv4h+pPYcCXb8+0A3Q3frdKhPGo9NaiItmRKBMaRMCC
 ohjkRS5BPvntfkh4N7JzzsRgH+SDb7f2zcNaYH1IV+8BJiET/fxmASdNSmwpvEOd
 GcEYx+sJY9S7DlWjmpb13z7euIbc5Zgx7Swl+QPOZQvMfbzkWc6mnI6U9BPtQ00T
 PQreIevlllbrOUjpqkh7fwGV78+fq2/x2OoUb/y71N94TRpiQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1775668333; x=
 1775754733; bh=EQ/7okhEqgoflUR50L4YoeqfqIruTSGkEdvDCLewojc=; b=P
 FEfwI6xjAkKBZIl7jiVQ9BanFoYOfV82v5dxdX2iGBlFGqpEWuBa5nr5K6//sU/i
 CPgH9zFeXtPg/gtAY/h4P2IzfdyqJSKlMbJH3yOUVjSnztlIhuUDElGZSYuuWO0a
 kIa6VLkOMtl7/6Z0J4VCM4F7baEQzQj+8L7hbKRbMn6BimJs1zG2yhwUAn2NrsCR
 z20UFv+nFHw1AN45wx1XvbrW50pc6Zwt6qXwU81IsXnCP0AU2DrZRRA8261G6syI
 i6C6i8XRatVnV5FLrblpfFuAtHDhHge99wW9xYMUv7dh3OHeR2ksyip3F8cG7ftk
 LTzzyN9KuBwhQ800RISug==
X-ME-Sender: <xms:bYzWaT-QeGLaAGyniYq0K0_U9OIRKlEC4ydce6BydhXben91p8g6SQ>
 <xme:bYzWaajYkLY08yosaWAIiuhxC1CATmTn3ShN68e5Hi73MWVYLSC-AyoRCm4S6RdQa
 iZtEgjw1KRPagGwgGCs56LHNlFDUj2k7rMuME8NW42aW_OM_kLof0w>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvgedugecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug
 hrpefoggffhffvvefkjghfufgtgfesthejredtredttdenucfhrhhomhepfdforghrthgv
 nhcunfhivghnvghnfdcuoehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmqeenucggtf
 frrghtthgvrhhnpeetvddvudeutedtffelvdegvdfggfefieegfffghfevveegveetfedt
 teehueehkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh
 hmpehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmpdhnsggprhgtphhtthhopeefpdhm
 ohguvgepshhmthhpohhuthdprhgtphhtthhopegvghhgvghrthestghsrdhutghlrgdrvg
 guuhdprhgtphhtthhopeektdejiedtseguvggssghughhsrdhgnhhurdhorhhgpdhrtghp
 thhtohepphhiphgtvghtsehprhhothhonhhmrghilhdrtghomh
X-ME-Proxy: <xmx:bYzWafhdENlUDliE848KzElBOPt5ll7ZGX1hP5DDhkA1M3CowV1hTQ>
 <xmx:bYzWacJTltuKZSdvKIdgSKhxqMGiB08otsEDQTmHNJn68dEPD5VJaQ>
 <xmx:bYzWaXD_7G51Cnw1429RdmfmfuW_rBAflxWD8C8n-fSlQHJPJf_Kwg>
 <xmx:bYzWaUgj1iYNQhmP0UcwhRKgKgDQItlF_0il_79bOMltg7O6ON6p9Q>
 <xmx:bYzWaWj8c2KV81gmpd-d_SHRVZetqG-MRiHUF2iWsFM-DzjzeH18UE6G>
Feedback-ID: i94d648c4:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
 id 81D7D1B4006D; Wed,  8 Apr 2026 13:12:13 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
MIME-Version: 1.0
X-ThreadId: A6KMJG7fQHCB
Date: Wed, 08 Apr 2026 19:11:53 +0200
From: "Marten Lienen" <ml@HIDDEN>
To: "Paul Eggert" <eggert@HIDDEN>, "Pip Cet" <pipcet@HIDDEN>
Message-Id: <d6dc5467-4872-434b-8841-f0c0f293919f@HIDDEN>
In-Reply-To: <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <87ldexbgks.fsf@HIDDEN>
 <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80760
Cc: 80760 <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 (-)

> That being said, some batch applications do ignore or trap SIGPIPE. For 
> example, GNU 'sort' traps SIGPIPE so that it can remove temporary files 
> before killing itself with SIGPIPE. Batch Emacs should be able to do the 
> same, and this suggests that we should add a new primitive to Emacs. But 
> for sanity's sake the default should be like POSIX, i.e., die on SIGPIPE.

If Emacs would behave the same for batch as for interactive use, i.e. convert SIGPIPE into a lisp error, it would still be compatible, wouldn't it? Because the Emacs lisp program and thus Emacs would still terminate if the error is not caught. But it would give people the option to handle it.




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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 16:59:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 12:59:25 2026
Received: from localhost ([127.0.0.1]:53127 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAWFR-00029v-30
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 12:59:25 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:60464)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1wAWFO-00028t-ES
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 12:59:23 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 7C2D23C033C2D;
 Wed,  8 Apr 2026 09:59:16 -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 dHJMnHh-7xSs; Wed,  8 Apr 2026 09:59:16 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 535093C033C31;
 Wed,  8 Apr 2026 09:59:16 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 535093C033C31
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1775667556;
 bh=Y3ZAUgvpKfuVSxyXKXOgZj/0vYxBx/UgSya/AYsQArQ=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=MU/VJz2VE85bIYG8JxMrSIeNv8/thanc/1aR6BvhMtRAxUi/KpcAnr2aIjTCX0bgM
 lA5idHIKt3siXLH4t41uaTtPNJrwAvY+NZ4kAOguuyt3us8l9zE0qj2HwS33WEwvSF
 2T9vJ2MjGruWb56FQbZMDEMunb31gI+tnpbWzNLueIERy30Kc5P0Rzr1OpJKogXqcl
 S6BzN5K+5ZCn9A4lrR7t9zHwHE92KVbTR2WQ2RPv5KAmEljEchMc1TXWA6s4j3LJMK
 4+wA50Hi4CHins44/6iz5lUpk6tsioO5VVh6MOhteIrYZMSB6lstl0C2xNOHa69Iip
 2tTgTUyQOJwdw==
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 JbZxMJUDczUe; Wed,  8 Apr 2026 09:59:16 -0700 (PDT)
Received: from penguin.cs.ucla.edu
 (47-154-25-11.fdr01.snmn.ca.ip.frontiernet.net [47.154.25.11])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 338873C033C2D;
 Wed,  8 Apr 2026 09:59:16 -0700 (PDT)
Message-ID: <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
Date: Wed, 8 Apr 2026 09:59:15 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
To: Pip Cet <pipcet@HIDDEN>, Marten Lienen <ml@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <87ldexbgks.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <87ldexbgks.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80760
Cc: 80760 <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 2026-04-08 08:46, Pip Cet wrote:
> I don't think it's "typical" for batch applications to die on SIGPIPE,
> except for stdin and stdout.

Perhaps you meant stdout and stderr? SIGPIPE on stdin would be pretty weird.

But you're wrong about typical batch applications: they commonly die on 
SIGPIPE regardless of file descriptor, because POSIX says the default 
action on SIGPIPE is to die. For example, on current Ubuntu here's 'cp' 
dying due to SIGPIPE on file descriptor 4:

   $ mkfifo fifo
   $ strace -o tr cp /usr/bin/emacs fifo &
   [1] 217221
   $ <fifo
   [1]+  Broken pipe             strace -o tr cp /usr/bin/emacs fifo
   $ tail -n4 tr
   read(3, 
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\25\6\0\0\0\0\0"..., 
262144) = 262144
   write(4, 
"\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\25\6\0\0\0\0\0"..., 
262144) = -1 EPIPE (Broken pipe)
   --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=217224, 
si_uid=1000} ---
   +++ killed by SIGPIPE +++

That being said, some batch applications do ignore or trap SIGPIPE. For 
example, GNU 'sort' traps SIGPIPE so that it can remove temporary files 
before killing itself with SIGPIPE. Batch Emacs should be able to do the 
same, and this suggests that we should add a new primitive to Emacs. But 
for sanity's sake the default should be like POSIX, i.e., die on SIGPIPE.




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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 16:52:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 12:52:02 2026
Received: from localhost ([127.0.0.1]:53050 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAW8H-0001Gx-8U
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 12:52:01 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:55518)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
 id 1wAW8E-0001GB-FR
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 12:51:59 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 6AA553C033C2D;
 Wed,  8 Apr 2026 09:51:52 -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 YYSOAEEXC-dC; Wed,  8 Apr 2026 09:51:52 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 428843C033C31;
 Wed,  8 Apr 2026 09:51:52 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 428843C033C31
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1775667112;
 bh=Iqxd8juLHgDZXBgd8fbKsLM5yObEGmwuWzluixZGPlQ=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=mF96mcdyDIsna/agFlssqpNz7y5tMiskhCTjSCkktAKN7GPk4Ql3+york0i03hUEQ
 afiIWAEZXm6GvW0bfB6+IL9DRuGE3/gwQexlonj1GNYUD6lUAVGnTif2vbPtpnrv0u
 0zYEqyZNlC3L/6bB/T0PruwwXoOceeVtNI6a8VzXwSEv1le1mJgRZ9NkM43CaqzxGc
 ReIh3LEMqL4uCrysU+gNctc+EETpAK6AeYL8LgPRVgzpu8Mm/jQe0a0V6tgWPvpe/2
 ELXMT1bmxxJirtYOxnTCndK5W9NcCdo2vGMi4b5lAsm0LVQX7vTxWQEcfK1NXlqSjF
 OQFZMb1mXpkoQ==
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 zwtDEI6c0B3i; Wed,  8 Apr 2026 09:51:52 -0700 (PDT)
Received: from penguin.cs.ucla.edu
 (47-154-25-11.fdr01.snmn.ca.ip.frontiernet.net [47.154.25.11])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 1F0833C033C2D;
 Wed,  8 Apr 2026 09:51:52 -0700 (PDT)
Message-ID: <fede848c-5aa7-4982-8b5f-5985721271c8@HIDDEN>
Date: Wed, 8 Apr 2026 09:51:51 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
To: Marten Lienen <ml@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <865x62xbzm.fsf@HIDDEN>
 <290af2f0-c1c7-4d22-8bf7-ff5c9434ab6a@HIDDEN>
 <86se95wzua.fsf@HIDDEN>
 <cd3a71b4-dc87-47ff-90e0-629e67e57627@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <cd3a71b4-dc87-47ff-90e0-629e67e57627@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 80760
Cc: 80760 <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 2026-04-08 02:59, Marten Lienen wrote:
> curl, for example, ignores sigpipe:https://github.com/curl/curl/ 
> blob/5d84aa41a0f1ee0f786fa0d113eba1b813b9886a/lib/sigpipe.h#L42-L46

libcurl's SIGPIPE handing is a bit of a disaster in multithreaded 
applications. libcurl uses sigaction to temporarily disable SIGPIPE, and 
sigaction has process-global effect, so this can screw up other threads. 
Multithreaded applications that use libcurl should enable its 
CURLOPT_NOSIGNAL option, which causes libcurl to not ignore SIGPIPE, but 
then of course the app itself needs to deal with SIGPIPE.

This libcurl issue should not be a problem for the curl executable, 
which as I understand it is single-threaded. But it is a problem for 
multithreaded apps like Emacs, and it means curl's approach is not a 
good model for Emacs.




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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 15:46:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 11:46:17 2026
Received: from localhost ([127.0.0.1]:51970 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAV6f-0004po-A1
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 11:46:17 -0400
Received: from mail-106118.protonmail.ch ([79.135.106.118]:26977)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
 id 1wAV6c-0004pS-23
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 11:46:15 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1775663167; x=1775922367;
 bh=m/Gt7C60dguBDCP9JF5rf4dmUFGLTL5HkRLNL56K3Po=;
 h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:
 Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:
 Message-ID:BIMI-Selector;
 b=K5WH2VJULUWvYACWo92Y1yyYktc4X/4O9/9/s5rhJol0yb6U3O0jzYrf13v/BViXE
 CsLK2RKM1dBDA5158weEyfpgyLuvbEmNp9uhRHvPIgt6a+NChMJOxL6gg4praxur3m
 AXORFlJIIbo8yWDsV4ofHEzIDfG93jjGpQ4B1fV6kqxLg+9wVPH8OO8CSh/G/Mil3i
 z7GbD/lhOrHfp2Pk2D0/T0aSeNrJOh0UPYM7HXRZrOHmolocslx8BTTjpNnVPRgDEl
 mLrljMTl+6Y8y/WdPPTaAQ1ShaBj9EPYayFKpxdTLSi47n+/3gu45CZJcMgriuG1kZ
 aCjrIyscJ8hlg==
Date: Wed, 08 Apr 2026 15:46:02 +0000
To: Marten Lienen <ml@HIDDEN>, Paul Eggert <eggert@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
Message-ID: <87ldexbgks.fsf@HIDDEN>
In-Reply-To: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: 5242bdeeefcc60c5eb5d8caca3fba8af8107ef21
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: 80760
Cc: 80760 <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 (-)

"Marten Lienen" <ml@HIDDEN> writes:

> I have just hit the following crash:
>
> `process-send-string` to a network connection whose peer has closed kills=
 the Emacs process with SIGPIPE (exit 141) instead of signaling a Lisp erro=
r.
>
> ```elisp
> ;;; -*- lexical-binding: t; -*-
> (let (conn)
>   (let ((server (make-network-process
>                  :name "srv" :server t
>                  :host "127.0.0.1" :service 0
>                  :log (lambda (_ proc _) (setq conn proc)))))
>     (let ((client (make-network-process
>                    :name "cli"
>                    :host "127.0.0.1"
>                    :service (process-contact server :service))))
>       (accept-process-output nil 0.1)
>       (delete-process client)
>       (process-send-string conn "first")
>       (process-send-string conn "second")
>       (message "OK =E2=80=94 no crash"))))
> ```
>
> Run with `emacs --batch -Q -l bug.el`.
>
> Expected: the second `process-send-string` signals a Lisp error ("Process=
 not running" or similar).
>
> Actual: Emacs exits with code 141 (128 + SIGPIPE).
>
> I have verified the problem on both my installed GNU Emacs 30.2 (build 1,=
 x86_64-pc-linux-gnu, GTK+ Version 3.24.52, cairo version 1.18.4) and on a =
version just I just compiled from master a few minutes ago.
>
> I have let an LLM investigate the problem. While I am not familiar with s=
trace, I will append the following cause that it identified by strace-ing t=
he reproducer above anyway, as it might be helpful for fixing it:
>
> ```
> strace confirms the cause:
>
> write(7, "first", 5)  =3D 5
> write(7, "second", 6) =3D -1 EPIPE (Broken pipe)
> --- SIGPIPE {si_signo=3DSIGPIPE, si_code=3DSI_USER, ...} ---
> +++ killed by SIGPIPE +++
>
> Tracing signal setup at startup (`strace -e rt_sigaction`) shows that
> Emacs installs handlers for SIGHUP, SIGINT, SIGTERM, SIGCHLD, and many
> others, but never calls `sigaction(SIGPIPE, SIG_IGN)`.  SIGPIPE is left
> at `SIG_DFL`, so the first `write(2)` that returns EPIPE also terminates
> the process.
> ```

sysdep.c contains this:

  /* Emacs checks for write errors, so it can safely ignore SIGPIPE.
     However, in batch mode leave SIGPIPE alone, as that causes Emacs
     to behave more like typical batch applications do.  */
  if (! noninteractive)
    signal (SIGPIPE, SIG_IGN);

I don't think it's "typical" for batch applications to die on SIGPIPE,
except for stdin and stdout. Maybe we should remove the condition and
see what happens?

Pip





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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 09:59:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 05:59:42 2026
Received: from localhost ([127.0.0.1]:49683 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAPhF-0004u3-Q0
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 05:59:42 -0400
Received: from fout-b6-smtp.messagingengine.com ([202.12.124.149]:43619)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ml@HIDDEN>)
 id 1wAPhD-0004tt-HW
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 05:59:40 -0400
Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
 by mailfout.stl.internal (Postfix) with ESMTP id 04E121D001B6;
 Wed,  8 Apr 2026 05:59:33 -0400 (EDT)
Received: from phl-imap-11 ([10.202.2.101])
 by phl-compute-05.internal (MEProxy); Wed, 08 Apr 2026 05:59:34 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 martenlienen.com; h=cc:cc:content-transfer-encoding:content-type
 :content-type:date:date:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to; s=fm3; t=1775642373; x=1775728773; bh=yMDHqwkRg09SiSZJyvfHt
 vZk6ZtvxIjpPA4LB9Vd65w=; b=rwdlXnVHD/LnbbLaXAdikQEcMS6eMAftXm2+w
 qxTnIvG6UJNw9twdtvD8dfb8tTIVVMsXBdKAxg3mQ+veiXo9xqp0csRWoNkX6/4N
 RbXq5fARcjazVJVvWCG05CTpnAzJt8x+ka//HmtZHqXBy7TNCoJEF4SDn0Wp8pNf
 bICqSpJMqMYYjnJeKm5OLBtRjJERNKpARiR/JhRE8mUcMgSmTl/2NkI2hPnG4wfv
 cPALS5aogsIbG4w4cludr9CmvHh41fWjv94kH4dpo2WtTcuBqRV6A0cP6VZSUTzQ
 xCOkNC6HPoe4O+Loe10HtmrHaFTAEtdFtqYOsoNFccVdp0GvQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1775642373; x=
 1775728773; bh=yMDHqwkRg09SiSZJyvfHtvZk6ZtvxIjpPA4LB9Vd65w=; b=I
 kNd0R1+kklDU55GTWUqGrdhe52w0nZvIIvVKGrAgxkwVETrAxNJwxsn9fgG0IcKk
 CcbVyn7IJ2GuzMcYNyqlWnVEpsE8rqwtgEiAKjLSKl3JBhqEbFf8jPIgdBeO8tHU
 cp4+QSiF8Wtt+vA+x2ThqwbPNE6dNQBCGm5kg+elOCLDIDafG+q0rCJiwxoDS8bj
 Y5avNaiOEff8Aodcnj/o4O8oCtq+03wUJ9MyUeiTz/TMf7EVLYvWIn8yvs04ROOp
 zrKQVBo8IFxDJQxhW+LBSlwtjbp0XkAho1mFm7Ptf35oF2iDVMv4pjcQx1WZRC7/
 99jEzhuXKzvppim1ggpVg==
X-ME-Sender: <xms:BSfWabr5rWd8qEy-C-I_8shM8QDhfaZgt7Wm1fJfBtbs1ipqilNV0w>
 <xme:BSfWaQdEd9KFnhuk8ja-iQ4gZuwabuMYA-Ab6JC2CRciiLTU3SEPNfTjKo89vHweF
 4bTnmsCIbfP4dZOq9By3DFv5zyQgolG7kZct0FbXs5583nY9F6EvPU>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvfedvjecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug
 hrpefoggffhffvvefkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdforghrthgv
 nhcunfhivghnvghnfdcuoehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmqeenucggtf
 frrghtthgvrhhnpeekudekgeegveffkedugfdvleehheevkeejteeihefhlefhieeikefh
 vdehgffgvdenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuih
 iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhlsehmrghrthgvnhhlihgvnhgv
 nhdrtghomhdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpth
 htohepvghgghgvrhhtsegtshdruhgtlhgrrdgvughupdhrtghpthhtohepkedtjeeitdes
 uggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrgh
X-ME-Proxy: <xmx:BSfWaZOItOGcFMxoPqgt7NajM1QAG-pD8idERwU6QSOgXQ3lxsLacg>
 <xmx:BSfWacG5p7h7o2qwXj--4UbuJa0gOxBXyuGhYkqlXpX3G9-W3MDTPA>
 <xmx:BSfWaQOHDFqoQ0iLxsfmP5bIGPYaJwHgcNcl3RPzzVQ08ax_9YN9cQ>
 <xmx:BSfWad_ulAz8RkSFoVgPJCEjwgPcjZ1gx4p9IgYoW6l3Oo2sZ9Op1g>
 <xmx:BSfWaWv7jj8uiFDr2iDghnDaveJKDsPu-kfSn8A1jwN9ibFTu7xh5rvX>
Feedback-ID: i94d648c4:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
 id 293521B4006D; Wed,  8 Apr 2026 05:59:33 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
MIME-Version: 1.0
X-ThreadId: A6KMJG7fQHCB
Date: Wed, 08 Apr 2026 11:59:12 +0200
From: "Marten Lienen" <ml@HIDDEN>
To: "Eli Zaretskii" <eliz@HIDDEN>
Message-Id: <cd3a71b4-dc87-47ff-90e0-629e67e57627@HIDDEN>
In-Reply-To: <86se95wzua.fsf@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <865x62xbzm.fsf@HIDDEN>
 <290af2f0-c1c7-4d22-8bf7-ff5c9434ab6a@HIDDEN>
 <86se95wzua.fsf@HIDDEN>
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80760
Cc: Paul Eggert <eggert@HIDDEN>, 80760 <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 (-)

curl, for example, ignores sigpipe: https://github.com/curl/curl/blob/5d=
84aa41a0f1ee0f786fa0d113eba1b813b9886a/lib/sigpipe.h#L42-L46

Okay, it exits without a chance for me to intervene. From the perspectiv=
e of my program, these are the same thing. I think, if I open a network =
connection, my program should be able to react to a lost connection.

If I insert an accept-process-output before the second send to force Ema=
cs to recognize the closed connection, I get an error as expected. Howev=
er, it seems unreasonable and fragile to me to protect every process-sen=
d-string with an accept-process-output just to get a robust program that=
 does not exit abruptly and unrecoverably due to a fatal signal.

;;; -*- lexical-binding: t; -*-
(let (conn)
  (let ((server (make-network-process
                 :name "srv" :server t
                 :host "127.0.0.1" :service 0
                 :log (lambda (_ proc _) (setq conn proc)))))
    (let ((client (make-network-process
                   :name "cli"
                   :host "127.0.0.1"
                   :service (process-contact server :service))))
      (accept-process-output nil 0.1)
      (delete-process client)
      (process-send-string conn "first")
      (accept-process-output nil 0.1)
      (process-send-string conn "second")
      (message "OK =E2=80=94 no crash"))))

Error: error ("Process srv <127.0.0.1:48100> not running: connection bro=
ken by remote peer
")
  process-send-string(#<process srv <127.0.0.1:48100>> "second")
  (let ((client (make-network-process :name "cli" :host "127.0.0.1" :ser=
vice (process-contact server :service)))) (accept-process-output nil 0.1=
) (delete-process client) (process-send-string conn "first") (accept-pro=
cess-output nil 0.1) (process-send-string conn "second") (message "OK =E2=
=80=94 no crash"))
  (let ((server (make-network-process :name "srv" :server t :host "127.0=
.0.1" :service 0 :log #'(lambda (_ proc _) (setq conn proc))))) (let ((c=
lient (make-network-process :name "cli" :host "127.0.0.1" :service (proc=
ess-contact server :service)))) (accept-process-output nil 0.1) (delete-=
process client) (process-send-string conn "first") (accept-process-outpu=
t nil 0.1) (process-send-string conn "second") (message "OK =E2=80=94 no=
 crash")))
  (let (conn) (let ((server (make-network-process :name "srv" :server t =
:host "127.0.0.1" :service 0 :log #'(lambda (_ proc _) (setq conn proc))=
))) (let ((client (make-network-process :name "cli" :host "127.0.0.1" :s=
ervice (process-contact server :service)))) (accept-process-output nil 0=
.1) (delete-process client) (process-send-string conn "first") (accept-p=
rocess-output nil 0.1) (process-send-string conn "second") (message "OK =
=E2=80=94 no crash"))))
  load-with-code-conversion("/home/marten/x.el" "/home/marten/x.el" nil =
t)
  command-line-1(("-l" "x.el"))
  command-line()
  normal-top-level()
Process srv <127.0.0.1:48100> not running: connection broken by remote p=
eer

On Wed, Apr 8, 2026, at 11:44, Eli Zaretskii wrote:
>> Date: Wed, 08 Apr 2026 08:51:08 +0200
>> From: "Marten Lienen" <ml@HIDDEN>
>> Cc: 80760 <at> debbugs.gnu.org
>>=20
>> It doesn=E2=80=99t have to be an error but at least it shouldn=E2=80=99=
t crash. I tried to prevent it by checking process-live-p and buffer-liv=
e-p, but it did not work without without a round of accept-process-outpu=
t in between.
>
> Emacs doesn't crash, it exits due to a fatal signal SIGPIPE.  The
> comment I've shown seems to indicate that other batch applications
> also show this behavior.  E.g., what does wget do if the remote site
> closes the connection?




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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 09:45:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 05:45:04 2026
Received: from localhost ([127.0.0.1]:49652 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAPT6-0004Hm-5n
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 05:45:04 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:36650)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wAPT3-0004Gg-VH
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 05:45:02 -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 1wAPSx-0003La-LT; Wed, 08 Apr 2026 05:44:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=hc92JUEpmWlT/YLAWmPmU7O8P/12xjLscjXNn8atzRw=; b=XQ8N7cfzIANUy5+y11aJ
 bV9G/odsHS1GTCmmCWUcqKe+Q6OWIjN4/FVSonfqA3WmOJ/udbq2QvW0Pi/3UFgPbcTAzFHRT0oxm
 6ByxAIyWWpgb7fChwVNVBWK534MTMG6BqxZ5+9ts5GTX9L/a/9KOSFQpptV6XZFvetjy7fnvjVHf3
 PBDeLZ5eiVbN/+Kxd0/MRzf/BmaniSJfvxsJ+FwU3Ggcq2YUrnl+THML5Ww/wv3Hbc3JmT0wwRDhw
 5bNKIUVfAYSXtBbDDTMtnMccB+CcnWK4sqcsZAiAv57PlJzVHaUMfpBmM6FQ+ozCC96/8D1yMHsCx
 wg718j8xaCZWRw==;
Date: Wed, 08 Apr 2026 12:44:45 +0300
Message-Id: <86se95wzua.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Marten Lienen" <ml@HIDDEN>
In-Reply-To: <290af2f0-c1c7-4d22-8bf7-ff5c9434ab6a@HIDDEN>
 (ml@HIDDEN)
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <865x62xbzm.fsf@HIDDEN>
 <290af2f0-c1c7-4d22-8bf7-ff5c9434ab6a@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80760
Cc: eggert@HIDDEN, 80760 <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, 08 Apr 2026 08:51:08 +0200
> From: "Marten Lienen" <ml@HIDDEN>
> Cc: 80760 <at> debbugs.gnu.org
> 
> It doesn’t have to be an error but at least it shouldn’t crash. I tried to prevent it by checking process-live-p and buffer-live-p, but it did not work without without a round of accept-process-output in between.

Emacs doesn't crash, it exits due to a fatal signal SIGPIPE.  The
comment I've shown seems to indicate that other batch applications
also show this behavior.  E.g., what does wget do if the remote site
closes the connection?




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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 06:51:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 02:51:38 2026
Received: from localhost ([127.0.0.1]:49054 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wAMlF-0004zI-Ug
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 02:51:38 -0400
Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]:48251)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ml@HIDDEN>)
 id 1wAMlD-0004yn-IC
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 02:51:36 -0400
Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
 by mailfout.stl.internal (Postfix) with ESMTP id CBA971D0025F;
 Wed,  8 Apr 2026 02:51:29 -0400 (EDT)
Received: from phl-imap-11 ([10.202.2.101])
 by phl-compute-05.internal (MEProxy); Wed, 08 Apr 2026 02:51:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 martenlienen.com; h=cc:cc:content-transfer-encoding:content-type
 :content-type:date:date:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to; s=fm3; t=1775631089; x=1775717489; bh=uB6GQFOuFNYS7g7Dj93TY
 lYvg/XovxPoqXpYR5H4ovU=; b=qcuP4OJO7XqcumioIhn8U4kaE9Sqc4e/zDjlo
 YnfC5+4D1toFKTMfMX/lfdSd9BybxxpljSEhhjzfBxmulO9qISCYwlqK01hHlLwb
 AFXmOv+CM6GNve77Tkaj4BTmJSEhEyb3XSP3jkPXOqVaxdQrSUUGSi1D7oHRHEl0
 5lGlhl5m0F2LnYxcdyJ2h9YHSZaL5hjRSu7Qx+PR0A2ue0Gm13by980LVpERc+W1
 E1vzr/Bi5gr7399lhGQfSqJGAJgU6wwFM+XKeCrL9uwr9DAfDLXUKnDU3tB4Lv4P
 uxdZCMXdjez2+HExcZy6XC4z/30iC2ccDhRhsHRkkUn58FJeA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:content-type:date:date:feedback-id:feedback-id
 :from:from:in-reply-to:in-reply-to:message-id:mime-version
 :references:reply-to:subject:subject:to:to:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1775631089; x=
 1775717489; bh=uB6GQFOuFNYS7g7Dj93TYlYvg/XovxPoqXpYR5H4ovU=; b=o
 wJ08KQKtPBK19BZbwLCjMGKH+of3QgCIOOL4Hj/pg0nbojXgCZ+yXntr3I79ULZa
 IP78iaPfpnmd19i2aL4T4dNqYJDqerVW692DBT957wQqenx6WpG1kqEreBzxHLkQ
 RF9mdxdUyDYPR9iL4J1wT9FQH6ZxYpLMzvZR7q1GaD923szz8qeSshZ5Paav777Y
 1/8enzmq+I3pN3dPNDhDOOz9t8nVWB0Iq/bUeFcXMJgwpms48+kSCddwoS1LUFH7
 763Iwe3X+sIdFu6UCw9pYSBPbtAWNv2K/8OkcCARg3Q7Jn8Z3qmotcwEg/5nOYvo
 GS8eILlSz1ogxeI1otPqg==
X-ME-Sender: <xms:8frVadxnuz2AiduOdMit9vGjbwEWd5UXZjQ921K2U5RfGsGi_awh-Q>
 <xme:8frVaYG0eQo7VjNoIPsuJBHTRWrv0U2xFmnXX3CUniVdI3EUWLmEbhouCYE7w5ra-
 TyPmgIpXCdLUahk6NqfB5buryst65w23yuxu3PFkn3n7p3h9tIJFw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvvdeltdcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug
 hrpefoggffhffvvefkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdforghrthgv
 nhcunfhivghnvghnfdcuoehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmqeenucggtf
 frrghtthgvrhhnpeefveehjefgiedtfffhueekfeegieeiffevtdekhfefgfejtdegleeg
 ieeufefgtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh
 hmpehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmpdhnsggprhgtphhtthhopeefpdhm
 ohguvgepshhmthhpohhuthdprhgtphhtthhopegvghhgvghrthestghsrdhutghlrgdrvg
 guuhdprhgtphhtthhopeektdejiedtseguvggssghughhsrdhgnhhurdhorhhgpdhrtghp
 thhtohepvghlihiisehgnhhurdhorhhg
X-ME-Proxy: <xmx:8frVaXW13SFh4UkvDBG5AGQ_RcSOyXwVc86qN2KnwkBGZIi_Cb_sDw>
 <xmx:8frVafvh2mRjXBV-z1HU3TRHpdk4vt58uxDRXw9-Ox8qyZpy1p8DkQ>
 <xmx:8frVabXDcANwJk_fwCAH_NHnysSboXVoGG66FjHyYFwZrLBGQCwUDQ>
 <xmx:8frVaamy4opns54u-nXOVg9FVcQ4AL8ptGqrl7BjYgJdvqgE5F2hkg>
 <xmx:8frVafSIKUgUIBoUAl_xKE0i8JUGG5am0WPbZkjOF6SL5L9u9nYYHyR0>
Feedback-ID: i94d648c4:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
 id 24A8A1B4006D; Wed,  8 Apr 2026 02:51:29 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
MIME-Version: 1.0
X-ThreadId: A6KMJG7fQHCB
Date: Wed, 08 Apr 2026 08:51:08 +0200
From: "Marten Lienen" <ml@HIDDEN>
To: "Eli Zaretskii" <eliz@HIDDEN>, "Paul Eggert" <eggert@HIDDEN>
Message-Id: <290af2f0-c1c7-4d22-8bf7-ff5c9434ab6a@HIDDEN>
In-Reply-To: <865x62xbzm.fsf@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 <865x62xbzm.fsf@HIDDEN>
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80760
Cc: 80760 <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 (-)

It doesn=E2=80=99t have to be an error but at least it shouldn=E2=80=99t=
 crash. I tried to prevent it by checking process-live-p and buffer-live=
-p, but it did not work without without a round of accept-process-output=
 in between.

On Wed, Apr 8, 2026, at 07:22, Eli Zaretskii wrote:
>> Date: Tue, 07 Apr 2026 13:18:50 +0200
>> From: "Marten Lienen" <ml@HIDDEN>
>>=20
>> I have just hit the following crash:
>>=20
>> `process-send-string` to a network connection whose peer has closed k=
ills the Emacs process with SIGPIPE (exit 141) instead of signaling a Li=
sp error.
>>=20
>> ```elisp
>> ;;; -*- lexical-binding: t; -*-
>> (let (conn)
>>   (let ((server (make-network-process
>>                  :name "srv" :server t
>>                  :host "127.0.0.1" :service 0
>>                  :log (lambda (_ proc _) (setq conn proc)))))
>>     (let ((client (make-network-process
>>                    :name "cli"
>>                    :host "127.0.0.1"
>>                    :service (process-contact server :service))))
>>       (accept-process-output nil 0.1)
>>       (delete-process client)
>>       (process-send-string conn "first")
>>       (process-send-string conn "second")
>>       (message "OK =E2=80=94 no crash"))))
>> ```
>>=20
>> Run with `emacs --batch -Q -l bug.el`.
>>=20
>> Expected: the second `process-send-string` signals a Lisp error ("Pro=
cess not running" or similar).
>>=20
>> Actual: Emacs exits with code 141 (128 + SIGPIPE).
>>=20
>> I have verified the problem on both my installed GNU Emacs 30.2 (buil=
d 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.52, cairo version 1.18.4) an=
d on a version just I just compiled from master a few minutes ago.
>>=20
>> I have let an LLM investigate the problem. While I am not familiar wi=
th strace, I will append the following cause that it identified by strac=
e-ing the reproducer above anyway, as it might be helpful for fixing it:
>>=20
>> ```
>> strace confirms the cause:
>>=20
>> write(7, "first", 5)  =3D 5
>> write(7, "second", 6) =3D -1 EPIPE (Broken pipe)
>> --- SIGPIPE {si_signo=3DSIGPIPE, si_code=3DSI_USER, ...} ---
>> +++ killed by SIGPIPE +++
>>=20
>> Tracing signal setup at startup (`strace -e rt_sigaction`) shows that
>> Emacs installs handlers for SIGHUP, SIGINT, SIGTERM, SIGCHLD, and many
>> others, but never calls `sigaction(SIGPIPE, SIG_IGN)`.  SIGPIPE is le=
ft
>> at `SIG_DFL`, so the first `write(2)` that returns EPIPE also termina=
tes
>> the process.
>> ```
>
> The comment in sysdep.c seems to explain why we do it:
>
>   /* Emacs checks for write errors, so it can safely ignore SIGPIPE.
>      However, in batch mode leave SIGPIPE alone, as that causes Emacs
>      to behave more like typical batch applications do.  */
>   if (! noninteractive)
>     signal (SIGPIPE, SIG_IGN);
>
> So this is specific to batch sessions.  Why did you expect a Lisp
> error instead in this case?
>
> Paul, any comments or suggestions?




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

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


Received: (at 80760) by debbugs.gnu.org; 8 Apr 2026 05:22:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 08 01:22:40 2026
Received: from localhost ([127.0.0.1]:47968 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wALNA-00072h-0R
	for submit <at> debbugs.gnu.org; Wed, 08 Apr 2026 01:22:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:48344)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wALN7-00072P-CJ
 for 80760 <at> debbugs.gnu.org; Wed, 08 Apr 2026 01:22:38 -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 1wALN0-0003RJ-Qn; Wed, 08 Apr 2026 01:22:31 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=e8xMAMaNU1++0YQ1Lwc6uH5HzSg6cXDjlcH1MriBfO4=; b=P7eOq8corYHonRkvAeFm
 CAUJjM1hMjS4gMqZqRSxtf3IjfsF4J27Qwgs9M8XizMmTfn9sTrzmhKCffLcayhZ15RWEr8Jd0ElN
 mSCGQVdBIC2PSFr8EtJsJeS52i212LTQ4hpU/VnNo+qzIcPsEYsr8PO7SamntaRyOIxLxaF8eG7DF
 7nfu9DmORLgug0KyjWa8tnmWdcBftnUGp8WNdiFu4B4rmpgYIVGwb7aK5WCOR6SNa6Nfq4dT8Ff86
 qphB1KkMktozSpDZyILKyW+8LXiiyNjQS//ZDl61xoZBGNnSMv/RdmyALk3x0c13gbqKClksxGF2d
 PtD4T0QZX1lTkA==;
Date: Wed, 08 Apr 2026 08:22:21 +0300
Message-Id: <865x62xbzm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: "Marten Lienen" <ml@HIDDEN>,
 Paul Eggert <eggert@HIDDEN>
In-Reply-To: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
 (ml@HIDDEN)
Subject: Re: bug#80760: process-send-string to broken network socket kills
 Emacs (SIGPIPE)
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80760
Cc: 80760 <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: Tue, 07 Apr 2026 13:18:50 +0200
> From: "Marten Lienen" <ml@HIDDEN>
> 
> I have just hit the following crash:
> 
> `process-send-string` to a network connection whose peer has closed kills the Emacs process with SIGPIPE (exit 141) instead of signaling a Lisp error.
> 
> ```elisp
> ;;; -*- lexical-binding: t; -*-
> (let (conn)
>   (let ((server (make-network-process
>                  :name "srv" :server t
>                  :host "127.0.0.1" :service 0
>                  :log (lambda (_ proc _) (setq conn proc)))))
>     (let ((client (make-network-process
>                    :name "cli"
>                    :host "127.0.0.1"
>                    :service (process-contact server :service))))
>       (accept-process-output nil 0.1)
>       (delete-process client)
>       (process-send-string conn "first")
>       (process-send-string conn "second")
>       (message "OK — no crash"))))
> ```
> 
> Run with `emacs --batch -Q -l bug.el`.
> 
> Expected: the second `process-send-string` signals a Lisp error ("Process not running" or similar).
> 
> Actual: Emacs exits with code 141 (128 + SIGPIPE).
> 
> I have verified the problem on both my installed GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.52, cairo version 1.18.4) and on a version just I just compiled from master a few minutes ago.
> 
> I have let an LLM investigate the problem. While I am not familiar with strace, I will append the following cause that it identified by strace-ing the reproducer above anyway, as it might be helpful for fixing it:
> 
> ```
> strace confirms the cause:
> 
> write(7, "first", 5)  = 5
> write(7, "second", 6) = -1 EPIPE (Broken pipe)
> --- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, ...} ---
> +++ killed by SIGPIPE +++
> 
> Tracing signal setup at startup (`strace -e rt_sigaction`) shows that
> Emacs installs handlers for SIGHUP, SIGINT, SIGTERM, SIGCHLD, and many
> others, but never calls `sigaction(SIGPIPE, SIG_IGN)`.  SIGPIPE is left
> at `SIG_DFL`, so the first `write(2)` that returns EPIPE also terminates
> the process.
> ```

The comment in sysdep.c seems to explain why we do it:

  /* Emacs checks for write errors, so it can safely ignore SIGPIPE.
     However, in batch mode leave SIGPIPE alone, as that causes Emacs
     to behave more like typical batch applications do.  */
  if (! noninteractive)
    signal (SIGPIPE, SIG_IGN);

So this is specific to batch sessions.  Why did you expect a Lisp
error instead in this case?

Paul, any comments or suggestions?




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

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


Received: (at submit) by debbugs.gnu.org; 7 Apr 2026 18:50:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 07 14:50:09 2026
Received: from localhost ([127.0.0.1]:40447 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1wABV0-0005xz-2q
	for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 14:50:09 -0400
Received: from lists.gnu.org ([2001:470:142::17]:33344)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ml@HIDDEN>)
 id 1wABTq-0005jR-O9
 for submit <at> debbugs.gnu.org; Tue, 07 Apr 2026 14:49:08 -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 <ml@HIDDEN>)
 id 1wABTj-00042B-A5
 for bug-gnu-emacs@HIDDEN; Tue, 07 Apr 2026 14:48:47 -0400
Received: from fout-b2-smtp.messagingengine.com ([202.12.124.145])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ml@HIDDEN>)
 id 1wA4Sf-000383-A4
 for bug-gnu-emacs@HIDDEN; Tue, 07 Apr 2026 07:19:14 -0400
Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45])
 by mailfout.stl.internal (Postfix) with ESMTP id 073301D00209
 for <bug-gnu-emacs@HIDDEN>; Tue,  7 Apr 2026 07:19:10 -0400 (EDT)
Received: from phl-imap-11 ([10.202.2.101])
 by phl-compute-05.internal (MEProxy); Tue, 07 Apr 2026 07:19:11 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 martenlienen.com; h=cc:content-transfer-encoding:content-type
 :content-type:date:date:from:from:in-reply-to:message-id
 :mime-version:reply-to:subject:subject:to:to; s=fm3; t=
 1775560750; x=1775647150; bh=Ndwerg04s5VgqtpCHafNOT6Jlorlg7n2l9o
 hecpAhW8=; b=OGuDflJkJFe1dFYouL1bdhSAkLEuMgMKJiybgscbPm1Y2WsPgvb
 wAijgKSHrZbPnCALrp0BCm6uzOmoad5PMjFhdtmrGx//kpxVwH1Jr2j8cR8t/NEB
 ykHhYDabYC4NQdX8omADXzXu9VbTDHKaQrNWRIJGfpr4EyDFXXHRChx4ltfnb9AF
 wLnukLlXBy0amWEPSuYIz1hU+akMO4vyZJ9a0KuFVljpnhZ7CDPHbNgJ3aPxkzbe
 YPw6Pj0aysuOgBTlai0W0tc6GWjfFnfdBJpYGdAUv+Y0/R5uJKiz6p3EUd5EQ5Q1
 KG7T50CI4oOC2fQ/rA6yL1XhaqAIEknWtCA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:message-id:mime-version:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=
 1775560750; x=1775647150; bh=Ndwerg04s5VgqtpCHafNOT6Jlorlg7n2l9o
 hecpAhW8=; b=qpVwOQqGMxj+l7n3vwE3pzPBQ/IzIPdBNWCvxOncvVpXrT5P68C
 sYkF5Rt4f1EMUG33NFd8FqkCf8VSgQmgHBKxKEQXUg5Nj8DrylxnmDTFsDDjPKZ2
 YJO/pMLonllP4bpr6nVR84NEVnmQN/+5SS/01RNtaPB+RY4YhrqfdLYb6nesu5qk
 WgfKuKhQam+59d4XOpZqONfldPH/NDrI4vDhE9agEHUIHNMvvKiTOKUPpnDCvbjt
 xbMd1QYyBG32iLrkxvMpfpsDj2IRb5oUZ4wzx+/u4DO9+hElIur1WbQ6nvHqajwg
 Ic8m5y11S6mbtqZKF8Pu3RuG012bMJ65LTQ==
X-ME-Sender: <xms:LujUaSFEYf5IybZkD9Udq-5raXPiVEUht-lgF633ENEDKPOsqelHcA>
 <xme:LujUaeJ7mvpY7rKYAVIa0yPTrsouGKTCQOJA556SdnuK2VqLv8Wr82ZfNiAnYbxyM
 uZBMQ3mkn8QsxhyH2kh3OjUxPK1c9EW6MKsJYEGhsSaZxwKCQ3P07FH>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddvtdehtdcutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
 ihhlohhuthemuceftddtnecunecujfgurhepofggfffhvffkufgtgfesthhqredtredtje
 enucfhrhhomhepfdforghrthgvnhcunfhivghnvghnfdcuoehmlhesmhgrrhhtvghnlhhi
 vghnvghnrdgtohhmqeenucggtffrrghtthgvrhhnpeffudetueevfeeifeefjeegjeejte
 ejgfevfeekvdelgfekteehteffgfetheekueenucevlhhushhtvghrufhiiigvpedtnecu
 rfgrrhgrmhepmhgrihhlfhhrohhmpehmlhesmhgrrhhtvghnlhhivghnvghnrdgtohhmpd
 hnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegsuhhg
 qdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg
X-ME-Proxy: <xmx:LujUaVoS_XcOGogObyZNf9WhXm3eG-M13dYHas3jyEKErsBM3uEy2w>
 <xmx:LujUaenA1RIq6i1eaImIAcLdHPxQHc7OCy5sq4mRo_VSbgdk85S_9Q>
 <xmx:LujUaX3kQnEkpgkq0WaCbmYPJyz8hd9n-v0rfUSYlzofITYHjs0DyQ>
 <xmx:LujUaWAYdcTqjZvaxBXG8SJ0F95lcqf6mRbF9lBUDAm9j_pDNfG0dQ>
 <xmx:LujUabAwN95-QlVpJ5ZMAA9v98EUVmfcVRwUuXwwJ3-nXzL7DcAQuAUU>
Feedback-ID: i94d648c4:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
 id 824DD1B4006F; Tue,  7 Apr 2026 07:19:10 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
MIME-Version: 1.0
Date: Tue, 07 Apr 2026 13:18:50 +0200
From: "Marten Lienen" <ml@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Message-Id: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
Subject: process-send-string to broken network socket kills Emacs (SIGPIPE)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=202.12.124.145; envelope-from=ml@HIDDEN;
 helo=fout-b2-smtp.messagingengine.com
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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
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.3 (/)

I have just hit the following crash:

`process-send-string` to a network connection whose peer has closed kill=
s the Emacs process with SIGPIPE (exit 141) instead of signaling a Lisp =
error.

```elisp
;;; -*- lexical-binding: t; -*-
(let (conn)
  (let ((server (make-network-process
                 :name "srv" :server t
                 :host "127.0.0.1" :service 0
                 :log (lambda (_ proc _) (setq conn proc)))))
    (let ((client (make-network-process
                   :name "cli"
                   :host "127.0.0.1"
                   :service (process-contact server :service))))
      (accept-process-output nil 0.1)
      (delete-process client)
      (process-send-string conn "first")
      (process-send-string conn "second")
      (message "OK =E2=80=94 no crash"))))
```

Run with `emacs --batch -Q -l bug.el`.

Expected: the second `process-send-string` signals a Lisp error ("Proces=
s not running" or similar).

Actual: Emacs exits with code 141 (128 + SIGPIPE).

I have verified the problem on both my installed GNU Emacs 30.2 (build 1=
, x86_64-pc-linux-gnu, GTK+ Version 3.24.52, cairo version 1.18.4) and o=
n a version just I just compiled from master a few minutes ago.

I have let an LLM investigate the problem. While I am not familiar with =
strace, I will append the following cause that it identified by strace-i=
ng the reproducer above anyway, as it might be helpful for fixing it:

```
strace confirms the cause:

write(7, "first", 5)  =3D 5
write(7, "second", 6) =3D -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=3DSIGPIPE, si_code=3DSI_USER, ...} ---
+++ killed by SIGPIPE +++

Tracing signal setup at startup (`strace -e rt_sigaction`) shows that
Emacs installs handlers for SIGHUP, SIGINT, SIGTERM, SIGCHLD, and many
others, but never calls `sigaction(SIGPIPE, SIG_IGN)`.  SIGPIPE is left
at `SIG_DFL`, so the first `write(2)` that returns EPIPE also terminates
the process.
```




Acknowledgement sent to "Marten Lienen" <ml@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#80760; 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: Wed, 8 Apr 2026 19:45:05 UTC

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