Received: (at 80760) by debbugs.gnu.org; 20 May 2026 15:39:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 20 11:39:45 2026 Received: from localhost ([127.0.0.1]:56189 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wPj1N-0003R2-1P for submit <at> debbugs.gnu.org; Wed, 20 May 2026 11:39:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35660) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wPj1K-0003Qo-7n for 80760 <at> debbugs.gnu.org; Wed, 20 May 2026 11:39:43 -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 1wPj1C-00083P-RV; Wed, 20 May 2026 11:39:36 -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=G4+l2n91iUD/cwL1cIbjxBAhDlp5MUb9Haf/6LIiovo=; b=sMQJBKOWUCWv 9t8KZ9z16HbYqpz/8ovAbx+reRsRzeR4fW9iMEMzXTXjMSG0fxMTYb0l3ZCDHYqSm0nvRr25eUpTa QVwa6vmdGURnRnyWSETfEZoUvow7h0jmri/57mmbk9MC3MLpAC9vV0I3NMZTIljjWRtR5aDgQKLda P70aAdi/l5d3/Rh3kqprYv/1Ln/0aDKfeM9+vJRm4wG8u/Hdybaj7oWRbdDh50rOd+CSRDnDAjFfq pp7Jr5saYQajWzq3Tciiul/3QQ1qaGRxOqld+dki5ZNPDtW3r9qIR4VyQBSqugGjWzHAZxtJffWEQ jBvDp1wg3DGkyVMNOesuRw==; Date: Wed, 20 May 2026 18:39:19 +0300 Message-Id: <861pf61460.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Pip Cet <pipcet@HIDDEN> In-Reply-To: <87zf1udznp.fsf@HIDDEN> (message from Pip Cet on Wed, 20 May 2026 12:37:42 +0000) Subject: Re: bug#80760: process-send-string to broken network socket kills Emacs (SIGPIPE) References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN> <87fr55b8fj.fsf@HIDDEN> <2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN> <871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN> <b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN> <86qzn71mgf.fsf@HIDDEN> <87mrxufx40.fsf@HIDDEN> <868q9e1f2t.fsf@HIDDEN> <87zf1udznp.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80760 Cc: eggert@HIDDEN, 80760 <at> debbugs.gnu.org, 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: -3.3 (---) > Date: Wed, 20 May 2026 12:37:42 +0000 > From: Pip Cet <pipcet@HIDDEN> > Cc: eggert@HIDDEN, 80760 <at> debbugs.gnu.org, ml@HIDDEN > > "Eli Zaretskii" <eliz@HIDDEN> writes: > > > But it is not enough to fix this for Windows, where NSIG > > is 23, but not every value between 1 and 22 is a valid signal. > > I think I may have missed something, but I'm still not sure I understand > why an invalid signal number passed to signal or raise is an issue. > w32_raise does assume the argument is in range, but is the underlying > 'raise' similarly limited? The underlying 'raise' can invoke an invalid argument handler from the MS runtime, which we don't want. So we will need to fix w32_raise not to pass through such values. > > As I wrote earlier, we should fix sys_signal and w32_raise, and make > > sure they are called here. > > I'm not sure about those: if I'm reading the code correctly, sys_signal > installs a signal handler both using the underlying 'signal' > implementation and in its own table. w32_raise then raises the signal > and runs the table handler directly. Doesn't that end up running the > signal handler twice? No. We only install our handler for signals that MS runtime doesn't handle.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.Received: (at 80760) by debbugs.gnu.org; 20 May 2026 12:37:56 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 20 08:37:56 2026 Received: from localhost ([127.0.0.1]:53994 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wPgBP-00032D-Oi for submit <at> debbugs.gnu.org; Wed, 20 May 2026 08:37:56 -0400 Received: from mail-4316.protonmail.ch ([185.70.43.16]:39391) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <pipcet@HIDDEN>) id 1wPgBN-00030z-Mr for 80760 <at> debbugs.gnu.org; Wed, 20 May 2026 08:37:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1779280667; x=1779539867; bh=oMNwDgp1MPrEwU2lBtGsdHIyfWvRouO7VHTpwsPj9Ro=; 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=f1mCvPTGzeYRJ6rkk1/dlkCzY1ftPnBXihGfS4G0eOylnbLdUoA0HdpcGGrQKRHnv NcI+dgx+7Rxe8tXrmr/RL0TUYbibMfsrlhpG+/1Lxwx7+OgTaK5guaBBlB3xKE9IwI BKD1yrOv2cJohPhi+/meveAaYO5+sOBa4PUqp5OYwrURTgstRa8z7vpmPRJuhtuMs0 ivnKYsnMTEsnO/dpSQHwknfgJpAmAwARXmvlQ43jsfh1cdpoU/pxtezs8ooOSQQfEr lr4lCzVq9X48fAw4J9gbmeqMC+GQYWQr4P0ejrS/oPM8Sg1VtZQuLCDzUITeQOTOj6 fgN06/PSMhYsQ== Date: Wed, 20 May 2026 12:37:42 +0000 To: Eli Zaretskii <eliz@HIDDEN> From: Pip Cet <pipcet@HIDDEN> Subject: Re: bug#80760: process-send-string to broken network socket kills Emacs (SIGPIPE) Message-ID: <87zf1udznp.fsf@HIDDEN> In-Reply-To: <868q9e1f2t.fsf@HIDDEN> References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN> <87fr55b8fj.fsf@HIDDEN> <2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN> <871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN> <b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN> <86qzn71mgf.fsf@HIDDEN> <87mrxufx40.fsf@HIDDEN> <868q9e1f2t.fsf@HIDDEN> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: e49d710c144730dac10503cdddd39412c31f471c 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: eggert@HIDDEN, 80760 <at> debbugs.gnu.org, 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 (-) "Eli Zaretskii" <eliz@HIDDEN> writes: >> Date: Wed, 20 May 2026 05:49:47 +0000 >> From: Pip Cet <pipcet@HIDDEN> >> Cc: Paul Eggert <eggert@HIDDEN>, 80760 <at> debbugs.gnu.org, ml@martenli= enen.com >> >> "Eli Zaretskii" <eliz@HIDDEN> writes: >> >> > . is it safe to pass an arbitrary 'int' value to 'signal' and >> > 'raise'? >> >> I think we should limit this to ints less than NSIG when NSIG is >> defined. Would that work for you? > > That's probably a prudent measure anyway, so I think we should do it > regardless. Okay. It kind of sounds like we want to restrict ourselves to a known set of signals (1..NSIG-1 on POSIX, either SIGPIPE or possibly no signals at all on Windows) anyway, I think. > But it is not enough to fix this for Windows, where NSIG > is 23, but not every value between 1 and 22 is a valid signal. I think I may have missed something, but I'm still not sure I understand why an invalid signal number passed to signal or raise is an issue. w32_raise does assume the argument is in range, but is the underlying 'raise' similarly limited? > As I wrote earlier, we should fix sys_signal and w32_raise, and make > sure they are called here. I'm not sure about those: if I'm reading the code correctly, sys_signal installs a signal handler both using the underlying 'signal' implementation and in its own table. w32_raise then raises the signal and runs the table handler directly. Doesn't that end up running the signal handler twice? Pip
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.Received: (at 80760) by debbugs.gnu.org; 20 May 2026 11:43:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 20 07:43:57 2026 Received: from localhost ([127.0.0.1]:53711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wPfL9-00044y-UK for submit <at> debbugs.gnu.org; Wed, 20 May 2026 07:43:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43852) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wPfL3-00043O-Of for 80760 <at> debbugs.gnu.org; Wed, 20 May 2026 07:43:52 -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 1wPfKx-0007eD-89; Wed, 20 May 2026 07:43:43 -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=CZQpqEeK8Bohj/EFRHwIbQPRmOG5oPMXaGSuZaB25QU=; b=fdfxkxMkGSkQ LHbIhZDqIQjXhAAfL/Bhu5LBHQ6pXUdWyoFPu+ysa/8t2ghgjc9mCx6/CSEzO5+lnGJ3QZKMCXhh6 xqilnuWSPp/+4RJ7UuxuJmXI2l73+6xTUcmdCzAGt4U6/MkRsqTwVR+KC9o4/R7zLDYxoKvt7r3Sn 3N2O+gSraRgRfWSc7MzXCYBaimM/bhTat4z7v2mOqbIrzb7M57K9tEdmRjkUTvGKGtIfbncf032Ag cNwcpCl4R6hUCnh7BKI+5ulU7gkTByTe48mAO0kGpZTZuJl9M9d2IaSZOEM4D8RCacK4rduMDOKZb niSv2KdQBfO9k8CpyXaogw==; Date: Wed, 20 May 2026 14:43:38 +0300 Message-Id: <868q9e1f2t.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Pip Cet <pipcet@HIDDEN> In-Reply-To: <87mrxufx40.fsf@HIDDEN> (message from Pip Cet on Wed, 20 May 2026 05:49:47 +0000) Subject: Re: bug#80760: process-send-string to broken network socket kills Emacs (SIGPIPE) References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN> <87ldexbgks.fsf@HIDDEN> <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN> <87fr55b8fj.fsf@HIDDEN> <2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN> <871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN> <b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN> <86qzn71mgf.fsf@HIDDEN> <87mrxufx40.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80760 Cc: eggert@HIDDEN, 80760 <at> debbugs.gnu.org, 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: -3.3 (---) > Date: Wed, 20 May 2026 05:49:47 +0000 > From: Pip Cet <pipcet@HIDDEN> > Cc: Paul Eggert <eggert@HIDDEN>, 80760 <at> debbugs.gnu.org, ml@HIDDEN > > "Eli Zaretskii" <eliz@HIDDEN> writes: > > > . is it safe to pass an arbitrary 'int' value to 'signal' and > > 'raise'? > > I think we should limit this to ints less than NSIG when NSIG is > defined. Would that work for you? That's probably a prudent measure anyway, so I think we should do it regardless. But it is not enough to fix this for Windows, where NSIG is 23, but not every value between 1 and 22 is a valid signal. As I wrote earlier, we should fix sys_signal and w32_raise, and make sure they are called here.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
Received: (at 80760) by debbugs.gnu.org; 20 May 2026 05:50:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 20 01:50:07 2026
Received: from localhost ([127.0.0.1]:50981 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wPZoj-0005pX-4X
for submit <at> debbugs.gnu.org; Wed, 20 May 2026 01:50:06 -0400
Received: from mail-4316.protonmail.ch ([185.70.43.16]:61459)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
id 1wPZof-0005nh-40
for 80760 <at> debbugs.gnu.org; Wed, 20 May 2026 01:50:03 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
s=protonmail3; t=1779256194; x=1779515394;
bh=SDB8tEZmQsifnGEEOgWXjmZWDUaKKC+lTX7Wk7yQK8c=;
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=nOrcbK16uNNzdtwWYcocvv39PPneSH5Hoy4D30cfkxw5OPUErBWX2uQ/nHazGEYUv
9LJcA4A2ppR6SERUGMwkNKwcc78Gt4eQmmoN4Yf4XI8wtzMe8iyPrjRwBNwu/8Fp39
W9liETZF1kkcgj+/qgQI3o/Q4Wr+kiVY90+DqY+3Dh/yJhKe2GfGZkmm1PyoQ+KCM5
jV55nbchqtQ9vNBddd1w8Z6tYfhg87z0AcnO/Px/Y/yGkDLpCpf8b9+BrUYt5lg+ov
lagiiDEmIYGBfGUSzTJ4L6VFkV4fJS4yxVtP1wliOJA0kVbRXl5Gv3EYYA6eorswmW
ntJd8zKYPmXow==
Date: Wed, 20 May 2026 05:49:47 +0000
To: Eli Zaretskii <eliz@HIDDEN>
From: Pip Cet <pipcet@HIDDEN>
Subject: Re: bug#80760: process-send-string to broken network socket kills
Emacs (SIGPIPE)
Message-ID: <87mrxufx40.fsf@HIDDEN>
In-Reply-To: <86qzn71mgf.fsf@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
<87ldexbgks.fsf@HIDDEN>
<6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
<87fr55b8fj.fsf@HIDDEN>
<2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN>
<871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN>
<b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN> <86qzn71mgf.fsf@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: 5546b841300f9e3c5e0b19dc54e547e0d3400c28
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: Paul Eggert <eggert@HIDDEN>, 80760 <at> debbugs.gnu.org,
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 (-)
"Eli Zaretskii" <eliz@HIDDEN> writes:
>> Date: Tue, 19 May 2026 07:13:16 -0700
>> Cc: 80760 <at> debbugs.gnu.org, ml@HIDDEN
>> From: Paul Eggert <eggert@HIDDEN>
>>
>> On 2026-05-19 06:06, Eli Zaretskii wrote:
>> >> Cc: 80760 <at> debbugs.gnu.org, Marten Lienen <ml@HIDDEN>
>> >> Date: Tue, 19 May 2026 12:44:28 +0000
>> >> From: Pip Cet via "Bug reports for GNU Emacs,
>> >> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>> >>
>> >> + if (! NILP (Fboundp (Qerror_quit_signal)))
>> >> + {
>> >> + Lisp_Object quit_signal =3D Fsymbol_value (Qerror_quit_signal)=
;
>> >> + if (FIXNUMP (quit_signal))
>> >> +=09{
>> >> +=09 signal (XFIXNUM (quit_signal), SIG_DFL);
>> >> +=09 raise (XFIXNUM (quit_signal));
>> >> +=09}
>> >
>> > This calls 'signal' and 'raise' with arbitrary signal values. Is that
>> > safe?
>> >
>> > And why does the value have to be a fixnum, btw?
>>
>> Is this a concern that a valid argument to signal/raise might not be a
>> fixnum? I don't know of any OS that does that.
>
> No, I was expressing two separate concerns:
>
> . is it safe to pass an arbitrary 'int' value to 'signal' and
> 'raise'?
I think we should limit this to ints less than NSIG when NSIG is
defined. Would that work for you?
Pip
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.Received: (at 80760) by debbugs.gnu.org; 19 May 2026 16:47:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 19 12:47:21 2026 Received: from localhost ([127.0.0.1]:46154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wPNbE-00052m-1C for submit <at> debbugs.gnu.org; Tue, 19 May 2026 12:47:21 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:48084) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1wPNav-0004z9-L4 for 80760 <at> debbugs.gnu.org; Tue, 19 May 2026 12:47:14 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id E3A173C033C2E; Tue, 19 May 2026 09:46:54 -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 QcqG1sk6d0RO; Tue, 19 May 2026 09:46:54 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id B93E53C033C2F; Tue, 19 May 2026 09:46:54 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu B93E53C033C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1779209214; bh=+AkLJ+SCwqiyGmHAt6p/qiQeQo2DGg/4/GxpJF/BIR0=; h=Message-ID:Date:MIME-Version:To:From; b=QUt+Vriba/nRrV8EPryvYMI+4o7102DczvNGfakR6KhINmvfLpx7yK2qVcCaGTOaJ WviYzMMEoRtniqEPuImC4cTWmERhphPTdCUprlf8LPp0S2YxYXYTEsKmV1tUpzB2ZV zjNjih4R9/aKPsPKZrsUAadVAlk221uivqlEYSpHzcAUw6eGMQdRA0BW2AwHa+4B5F 0v5E5AXlDWOnN64Tro7+83UAkYIkJaaevNkIZs8uApiT9v87slksSrzP8MqFaKnfcD wQnNvL3Z0aMyWqr8dIxenpJTSo4hSPP/19dqoG0Y5KKjr3ADoYc7FxM+YPBvCH0bhV gr63n/DWPdZKA== 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 HAdZzCafpRpk; Tue, 19 May 2026 09:46:54 -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 8E58B3C033C2E; Tue, 19 May 2026 09:46:54 -0700 (PDT) Message-ID: <f4509508-ab83-4424-b459-67ce895bf00c@HIDDEN> Date: Tue, 19 May 2026 09:46:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#80760: process-send-string to broken network socket kills Emacs (SIGPIPE) To: Eli Zaretskii <eliz@HIDDEN> References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN> <87ldexbgks.fsf@HIDDEN> <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN> <87fr55b8fj.fsf@HIDDEN> <2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN> <871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN> <b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN> <86qzn71mgf.fsf@HIDDEN> <e6c3a4ff-8a66-4b03-b21f-0e07ae251512@HIDDEN> <86pl2r1jye.fsf@HIDDEN> Content-Language: en-US From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <86pl2r1jye.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80760 Cc: pipcet@HIDDEN, 80760 <at> debbugs.gnu.org, 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: -3.3 (---) On 2026-05-19 08:46, Eli Zaretskii wrote: > Do we automatically convert a bignum into a fixnum when its value, > which once was large, gets small enough? Yes. >> And other non-fixnums are invalid regardless. > > I can see nothing wrong with floats, for example. I wouldn't bother with floats, as they're not useful here and attempting to support them will add complexity (how do you send the signal number 10.5, for example?) for no real purpose. At the low level, signal numbers have always been integers and they'll never be floats. We don't support floats for aref, for example; similarly, we needn't support floats for signal numbers.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.Received: (at 80760) by debbugs.gnu.org; 19 May 2026 15:47:02 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 19 11:47:02 2026 Received: from localhost ([127.0.0.1]:45546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wPMer-00008y-P0 for submit <at> debbugs.gnu.org; Tue, 19 May 2026 11:47:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54880) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wPMem-00008F-Ta for 80760 <at> debbugs.gnu.org; Tue, 19 May 2026 11:47:00 -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 1wPMee-0006VN-5d; Tue, 19 May 2026 11:46:49 -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=d0oA5qs9knkbaHzWnaxhMaLH9xdlNA3+9gdDIYQO7vw=; b=pvYj4tEF6B/7 lv0rVVQcC20Qk1O1epXm5NZdN+LbVGS1GqEKObqmffIK1ihS3RASph4I2s4peuOXObLq9P4Y0Z3VY tE5uagSh1H+5ifnvHK4iAO5mXGubMS1mjlTl+dg0+370mxhIVoL2hOMl65DgH32vTcdWxNNRx4gyy 8w12AeSy54/QGX9m1tvltFRhJE+SK8qGyyrQhe3E/bNwgG2RxYuufeL6LanBk/DwxlexZBb0HaDl0 HVVxylJhoivIHLNRNf4+pBf6P790ms6mSNuvxZXJ4E8CIa1WaBtCNTe+0eJYIJtzlHniiww1Y89oT QTmkYlIGxczMgNw6aySlgw==; Date: Tue, 19 May 2026 18:46:01 +0300 Message-Id: <86pl2r1jye.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Paul Eggert <eggert@HIDDEN> In-Reply-To: <e6c3a4ff-8a66-4b03-b21f-0e07ae251512@HIDDEN> (message from Paul Eggert on Tue, 19 May 2026 08:04:41 -0700) Subject: Re: bug#80760: process-send-string to broken network socket kills Emacs (SIGPIPE) References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN> <87ldexbgks.fsf@HIDDEN> <6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN> <87fr55b8fj.fsf@HIDDEN> <2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN> <871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN> <b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN> <86qzn71mgf.fsf@HIDDEN> <e6c3a4ff-8a66-4b03-b21f-0e07ae251512@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80760 Cc: pipcet@HIDDEN, 80760 <at> debbugs.gnu.org, 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: -3.3 (---) > Date: Tue, 19 May 2026 08:04:41 -0700 > Cc: pipcet@HIDDEN, 80760 <at> debbugs.gnu.org, ml@HIDDEN > From: Paul Eggert <eggert@HIDDEN> > > > No, I was expressing two separate concerns: > > > > . is it safe to pass an arbitrary 'int' value to 'signal' and > > 'raise'? > > . why do we force the value of quit_signal to be a fixnum? > > > > Regarding the first one, maybe Posix requires that undefined values > > are silently ignored, but what do we know about the actual behavior of > > the supported platforms in this regard? > > Oh, I see the point now. Here's what we know. POSIX requires invalid > values to cause 'signal' and 'raise' to return a failure value (SIG_ERR > and -1, respectively). As I understand it, all Emacs targets do that > except native MS-Windows, where 'signal' and 'raise' can crash. So > presumably we'd need an #if for MS-Windows here, or (nicer for the > mainline code) wrap 'signal' and 'raise' on MS-Windows. We already wrap them (see sys_signal and w32_raise), so all we need is to make sure they are called in these new places. And w32_raise might need to be augmented not to call 'raise' for signals unknown to the Windows runtime. > > Regarding the second one, I understand that the value should fit in an > > 'int', but non-fixnum values could be small, no? > > Sorry, I'm not following. You can't mean bignums here, as bignums cannot > be small. Do we automatically convert a bignum into a fixnum when its value, which once was large, gets small enough? > And other non-fixnums are invalid regardless. I can see nothing wrong with floats, for example. > As I understand it, on all practical platforms (including MS-Windows), > valid signal values comfortably fit in a fixnum, even on 32-bit platforms. Yes, that's not the problem I had in mind.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
Received: (at 80760) by debbugs.gnu.org; 19 May 2026 15:04:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 19 11:04:51 2026
Received: from localhost ([127.0.0.1]:45051 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wPM02-0001gh-Vs
for submit <at> debbugs.gnu.org; Tue, 19 May 2026 11:04:51 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:58872)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
id 1wPM00-0001gS-LK
for 80760 <at> debbugs.gnu.org; Tue, 19 May 2026 11:04:49 -0400
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 4CF533C011BD8;
Tue, 19 May 2026 08:04:42 -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 Aoz3G5wTDUcq; Tue, 19 May 2026 08:04:42 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 2346D3C033C30;
Tue, 19 May 2026 08:04:42 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 2346D3C033C30
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1779203082;
bh=ehiczSxRnjVCBan6kK3JxcnYV9+0fixA0/AWzGRJdWM=;
h=Message-ID:Date:MIME-Version:To:From;
b=daPA4dgX+Hm2aj6RHuDP5b9IpzojmIs1jiuol5+/6OyX5wZViOmrFPh69gxtR70C/
v2ZhWx8uAbFdRGQRKrrlPUK+uwHJl85tx/tkXl64Dane8JM63PQsiokicdfq8P4qY8
QNKV+a3fn9LVM9dCI69oMJK7XQTiaLEuNtPOPKgSurGSnpuRqFtFBFsdpgrZoX0SNT
LhMKxDV7IdXZ8pJmskrbT0Fk2bhVVimG9QKALuUbjsuQ97LGnq7ngLKZ0XPHiBmFeu
1pKKFomtVoEdiT+veQUjTXduIYRDt+n59ljsFbbeakQalBs1yiyhhRhIGrWntnCbdZ
lIFKVzCjPw9Qw==
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 qVPJgLFDL0lu; Tue, 19 May 2026 08:04:42 -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 EED263C011BD8;
Tue, 19 May 2026 08:04:41 -0700 (PDT)
Message-ID: <e6c3a4ff-8a66-4b03-b21f-0e07ae251512@HIDDEN>
Date: Tue, 19 May 2026 08:04:41 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#80760: process-send-string to broken network socket kills
Emacs (SIGPIPE)
To: Eli Zaretskii <eliz@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
<87ldexbgks.fsf@HIDDEN>
<6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
<87fr55b8fj.fsf@HIDDEN>
<2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN>
<871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN>
<b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN> <86qzn71mgf.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <86qzn71mgf.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80760
Cc: pipcet@HIDDEN, 80760 <at> debbugs.gnu.org, 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: -3.3 (---)
On 2026-05-19 07:52, Eli Zaretskii wrote:
>> Date: Tue, 19 May 2026 07:13:16 -0700
>> From: Paul Eggert <eggert@HIDDEN>
>>
>> On 2026-05-19 06:06, Eli Zaretskii wrote:
>>>> Cc: 80760 <at> debbugs.gnu.org, Marten Lienen <ml@HIDDEN>
>>>> Date: Tue, 19 May 2026 12:44:28 +0000
>>>> From: Pip Cet via "Bug reports for GNU Emacs,
>>>> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>>>
>>>> + if (! NILP (Fboundp (Qerror_quit_signal)))
>>>> + {
>>>> + Lisp_Object quit_signal = Fsymbol_value (Qerror_quit_signal);
>>>> + if (FIXNUMP (quit_signal))
>>>> + {
>>>> + signal (XFIXNUM (quit_signal), SIG_DFL);
>>>> + raise (XFIXNUM (quit_signal));
>>>> + }
>>>
>>> This calls 'signal' and 'raise' with arbitrary signal values. Is that
>>> safe?
>>>
>>> And why does the value have to be a fixnum, btw?
>>
>> Is this a concern that a valid argument to signal/raise might not be a
>> fixnum? I don't know of any OS that does that.
>
> No, I was expressing two separate concerns:
>
> . is it safe to pass an arbitrary 'int' value to 'signal' and
> 'raise'?
> . why do we force the value of quit_signal to be a fixnum?
>
> Regarding the first one, maybe Posix requires that undefined values
> are silently ignored, but what do we know about the actual behavior of
> the supported platforms in this regard?
Oh, I see the point now. Here's what we know. POSIX requires invalid
values to cause 'signal' and 'raise' to return a failure value (SIG_ERR
and -1, respectively). As I understand it, all Emacs targets do that
except native MS-Windows, where 'signal' and 'raise' can crash. So
presumably we'd need an #if for MS-Windows here, or (nicer for the
mainline code) wrap 'signal' and 'raise' on MS-Windows.
> Regarding the second one, I understand that the value should fit in an
> 'int', but non-fixnum values could be small, no?
Sorry, I'm not following. You can't mean bignums here, as bignums cannot
be small. And other non-fixnums are invalid regardless.
As I understand it, on all practical platforms (including MS-Windows),
valid signal values comfortably fit in a fixnum, even on 32-bit platforms.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
Received: (at 80760) by debbugs.gnu.org; 19 May 2026 14:52:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 19 10:52:49 2026
Received: from localhost ([127.0.0.1]:44865 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wPLoP-0000YF-6Q
for submit <at> debbugs.gnu.org; Tue, 19 May 2026 10:52:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:46962)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wPLoN-0000X2-9p
for 80760 <at> debbugs.gnu.org; Tue, 19 May 2026 10:52:48 -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 1wPLoH-0000if-3i; Tue, 19 May 2026 10:52:41 -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=TcS5NPILbwBqXDE2STGvmuNCfH2q6wvngwCBRuZAtD8=; b=oVbKrbWWn7Oj
TJtwmMOj3bgxUGNSKFzCvAFBVYwjygCl9cUSAV4uKHpLOPDd8n2XSXTbSREXFdCP+KtVtcJyLO1BE
VTe9fPdk1P3CKnSheGBZmBwWiD7YnTrAos6XUU6BO+LV2vd75jLKiFRn5HJpWOWdJOZ03D169aFRG
OlJebaSdaUNrI/+/MjhNsTjFBn3Rxjr0kw0Fospo6oKY1UzbUZCTJ9iG3rbFXN1eEyz6KTeP2cJ6L
8dfJPtdyeFizK20GQyvQ1UdZRSuUp7zTpUyr+IwnEGTosKQieKYmPxDjJwHX5FErqzH81C2OwigXm
f3/Xd9rsFY6W4LbRnCZVeQ==;
Date: Tue, 19 May 2026 17:52:00 +0300
Message-Id: <86qzn71mgf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN> (message from
Paul Eggert on Tue, 19 May 2026 07:13:16 -0700)
Subject: Re: bug#80760: process-send-string to broken network socket kills
Emacs (SIGPIPE)
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
<87ldexbgks.fsf@HIDDEN>
<6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
<87fr55b8fj.fsf@HIDDEN>
<2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN>
<871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN>
<b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80760
Cc: pipcet@HIDDEN, 80760 <at> debbugs.gnu.org, 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: -3.3 (---)
> Date: Tue, 19 May 2026 07:13:16 -0700
> Cc: 80760 <at> debbugs.gnu.org, ml@HIDDEN
> From: Paul Eggert <eggert@HIDDEN>
>
> On 2026-05-19 06:06, Eli Zaretskii wrote:
> >> Cc: 80760 <at> debbugs.gnu.org, Marten Lienen <ml@HIDDEN>
> >> Date: Tue, 19 May 2026 12:44:28 +0000
> >> From: Pip Cet via "Bug reports for GNU Emacs,
> >> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> >>
> >> + if (! NILP (Fboundp (Qerror_quit_signal)))
> >> + {
> >> + Lisp_Object quit_signal = Fsymbol_value (Qerror_quit_signal);
> >> + if (FIXNUMP (quit_signal))
> >> + {
> >> + signal (XFIXNUM (quit_signal), SIG_DFL);
> >> + raise (XFIXNUM (quit_signal));
> >> + }
> >
> > This calls 'signal' and 'raise' with arbitrary signal values. Is that
> > safe?
> >
> > And why does the value have to be a fixnum, btw?
>
> Is this a concern that a valid argument to signal/raise might not be a
> fixnum? I don't know of any OS that does that.
No, I was expressing two separate concerns:
. is it safe to pass an arbitrary 'int' value to 'signal' and
'raise'?
. why do we force the value of quit_signal to be a fixnum?
Regarding the first one, maybe Posix requires that undefined values
are silently ignored, but what do we know about the actual behavior of
the supported platforms in this regard?
Regarding the second one, I understand that the value should fit in an
'int', but non-fixnum values could be small, no? So I'd understand if
we limit the value to the range of an 'int', but otherwise I don't see
why we must force a fixnum.
> For a bit of safety I suggest changing that "FIXNUMP (quit_signal)" to
> "TYPE_RANGED_FIXNUMP (int, quit_signal)". There's little point to
> xsignaling an error here, since we're about to exit anyway and we
> already don't xsignal an invalid kill-emacs arg.
Right.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
Received: (at 80760) by debbugs.gnu.org; 19 May 2026 14:13:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 19 10:13:24 2026
Received: from localhost ([127.0.0.1]:44358 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wPLCG-0003cf-9I
for submit <at> debbugs.gnu.org; Tue, 19 May 2026 10:13:24 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:39628)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eggert@HIDDEN>)
id 1wPLCE-0003bz-Aj
for 80760 <at> debbugs.gnu.org; Tue, 19 May 2026 10:13:23 -0400
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 97FB03C011BD8;
Tue, 19 May 2026 07:13: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 w2z0Mh7Bnj4E; Tue, 19 May 2026 07:13:16 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
by mail.cs.ucla.edu (Postfix) with ESMTP id 6E5D43C033C2B;
Tue, 19 May 2026 07:13:16 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 6E5D43C033C2B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1779199996;
bh=KFpX7UWp4KClSVEv8zgdTWA+RWg8XSzAubHN4Rmv4rc=;
h=Message-ID:Date:MIME-Version:To:From;
b=gu3rkBadt0wZ83Efb2Uq0HI36l6h+MhEwN2BXlF45/YrQapDkpAI5MiGwlScmIC3w
7t4RbiPv8ygfrkaEmIFBZC4uCv+96dyiFjZt99QDeNlkhsVmV3fRcWCvMCRqnpxrZT
OEDJpnv1gy+/exLYZnh8pwOG6aFR38nvg9W9cORLAILGLBEGbkjrULS2M87YC/McRt
CwarvOYQBrX22z5FzMKYW2aDdMKy5CP4MUfqWJeQPZlJgsigvSVB0f2qkmYxU1ioab
vojG/bLTqocp11j8WRNTyBaaKNqCdZudMZ+LO51TiznxaVXuxzQGmu6JhwGYd9Pvzj
Ieg+b87HcFDCA==
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 EgeU1TZoKiBK; Tue, 19 May 2026 07:13: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 4CCDD3C011BD8;
Tue, 19 May 2026 07:13:16 -0700 (PDT)
Message-ID: <b2c0033f-229f-4b08-ab29-4add66b12b35@HIDDEN>
Date: Tue, 19 May 2026 07:13:16 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#80760: process-send-string to broken network socket kills
Emacs (SIGPIPE)
To: Eli Zaretskii <eliz@HIDDEN>, Pip Cet <pipcet@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
<87ldexbgks.fsf@HIDDEN>
<6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
<87fr55b8fj.fsf@HIDDEN>
<2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN>
<871pf7a7qh.fsf@HIDDEN> <86v7cj1rbt.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <86v7cj1rbt.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80760
Cc: 80760 <at> debbugs.gnu.org, 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: -3.3 (---)
On 2026-05-19 06:06, Eli Zaretskii wrote:
>> Cc: 80760 <at> debbugs.gnu.org, Marten Lienen <ml@HIDDEN>
>> Date: Tue, 19 May 2026 12:44:28 +0000
>> From: Pip Cet via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>
>> + if (! NILP (Fboundp (Qerror_quit_signal)))
>> + {
>> + Lisp_Object quit_signal = Fsymbol_value (Qerror_quit_signal);
>> + if (FIXNUMP (quit_signal))
>> + {
>> + signal (XFIXNUM (quit_signal), SIG_DFL);
>> + raise (XFIXNUM (quit_signal));
>> + }
>
> This calls 'signal' and 'raise' with arbitrary signal values. Is that
> safe?
>
> And why does the value have to be a fixnum, btw?
Is this a concern that a valid argument to signal/raise might not be a
fixnum? I don't know of any OS that does that.
For a bit of safety I suggest changing that "FIXNUMP (quit_signal)" to
"TYPE_RANGED_FIXNUMP (int, quit_signal)". There's little point to
xsignaling an error here, since we're about to exit anyway and we
already don't xsignal an invalid kill-emacs arg.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
Received: (at 80760) by debbugs.gnu.org; 19 May 2026 13:07:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 19 09:07:00 2026
Received: from localhost ([127.0.0.1]:42724 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wPKA0-00033I-JA
for submit <at> debbugs.gnu.org; Tue, 19 May 2026 09:07:00 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:37096)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wPK9x-00032u-SO
for 80760 <at> debbugs.gnu.org; Tue, 19 May 2026 09:06:58 -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 1wPK9r-0008M5-9l; Tue, 19 May 2026 09:06:51 -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=uP9ybgkpRT6cfvfaBkqHlvHdtg5PHFAJkh1b82nzpbI=; b=aL0iZ6ZjG/Zb
DgH2WMVIvvi/i8YaBnzl2RFYHYQJbH5Vi/3UI/k8YVDBAbZ/khpZH9lXP6WaK7PhBixFj1oOpnE+H
kjHKBQjLf0GRbXKbDUqBJN8WhtmvLSkTGbZ1IqKDluC/rDFQmiGhpub6H387qKUI1L27s7XoJNBxW
LH78xGXpwVu66+BVgm+4VpyDS9mWIx2XilzfoAz9uBVJtTloH0UWdClJV3mc5l/jGWoBn2Q1hn/ZP
mBu4zPX9JRby9QLOq3z6P9EI36X2wfnbZ8qZkKMkRkJS7uEC7oA2p8/xFvMbc6wuRjKhtAo3aWpxb
Y/KLZM+SewMqypjVLonkcw==;
Date: Tue, 19 May 2026 16:06:46 +0300
Message-Id: <86v7cj1rbt.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Pip Cet <pipcet@HIDDEN>
In-Reply-To: <871pf7a7qh.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#80760: process-send-string to broken network socket kills
Emacs (SIGPIPE)
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
<87ldexbgks.fsf@HIDDEN>
<6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
<87fr55b8fj.fsf@HIDDEN>
<2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN>
<871pf7a7qh.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80760
Cc: eggert@HIDDEN, 80760 <at> debbugs.gnu.org, 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: -3.3 (---)
> Cc: 80760 <at> debbugs.gnu.org, Marten Lienen <ml@HIDDEN>
> Date: Tue, 19 May 2026 12:44:28 +0000
> From: Pip Cet via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>
> + if (! NILP (Fboundp (Qerror_quit_signal)))
> + {
> + Lisp_Object quit_signal = Fsymbol_value (Qerror_quit_signal);
> + if (FIXNUMP (quit_signal))
> + {
> + signal (XFIXNUM (quit_signal), SIG_DFL);
> + raise (XFIXNUM (quit_signal));
> + }
This calls 'signal' and 'raise' with arbitrary signal values. Is that
safe?
And why does the value have to be a fixnum, btw?
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
Received: (at 80760) by debbugs.gnu.org; 19 May 2026 12:44:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 19 08:44:48 2026
Received: from localhost ([127.0.0.1]:42505 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wPJoV-0001Ay-7q
for submit <at> debbugs.gnu.org; Tue, 19 May 2026 08:44:47 -0400
Received: from mail-4316.protonmail.ch ([185.70.43.16]:51039)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <pipcet@HIDDEN>)
id 1wPJoP-00019u-Ni
for 80760 <at> debbugs.gnu.org; Tue, 19 May 2026 08:44:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
s=protonmail3; t=1779194674; x=1779453874;
bh=RmjEbH9Fuym2J2LWJ/LawbMtz6nY2giwhi2uDyDaxBM=;
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=ivNjbw8u3wQHz0ow1W8fCHr6H6W0BJYBscIjzczal49E0LjqtSnp5XuGjJRoJhRom
Q/5EkbAmJezcte1IA4vIRVeKT0bUuClbRqdyBN7wnq/g2wGGmiIm3jLIHQOeqAPOSk
lBInI6k+JSgeneJxPVZJL2RPWkRS7xeF/MW3dpdjj5G7Xzj5Bb998DeuJqDFFlfXFl
VcJhuTV11XA07Q7MNQJuftNCiXFJzC6rWZmgavU2StMmYyv+U2mF393rfzg4UjbjvE
RL17XtQz+e5PjIZPTpjFLgp3UVInj73yO1X4qbE9TNt44Y/mNvqddWaGtmg1Lw9/Z9
1VnyuyXs9DGtw==
Date: Tue, 19 May 2026 12:44:28 +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: <871pf7a7qh.fsf@HIDDEN>
In-Reply-To: <2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN>
References: <fce7fa2e-f31c-42bc-a31b-5afb9f485f9f@HIDDEN>
<87ldexbgks.fsf@HIDDEN>
<6fab2a2d-b3de-4fd3-b95c-1638de60b250@HIDDEN>
<87fr55b8fj.fsf@HIDDEN>
<2ff299c2-18b5-484c-99e6-d92793879544@HIDDEN>
Feedback-ID: 112775352:user:proton
X-Pm-Message-ID: 5bbf82b0629011cfeb9c4c519a369b8cae89728d
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 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.
This patch attempts to do this by adding a new symbol property
Qerror_quit_signal, which encodes the signal to be (re)raised when
handling an error of that type. I used a specbind rather than an extra
argument to Fkill_emacs to handle recursive Fkill_emacs calls.
TODO: tests, and decide whether we might want to continue ignoring write
errors to stderr in interactive sessions.
From a39ba740dbb91177543f7fc8acfd4c35d00080e4 Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@HIDDEN>
Date: Tue, 19 May 2026 12:32:53 +0000
Subject: [PATCH 1/2] Report errors when writing to error stream (bug#80760)
* src/sysdep.c (errerr): New function. Handle only EPIPE for now.
(errputc, errwrite): Call it.
---
src/sysdep.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/sysdep.c b/src/sysdep.c
index 10269e4d0ce..2ae8d535793 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2914,6 +2914,16 @@ errstream (void)
return err;
}
=20
+/* An error on the error output stream. Not much we can do but exit the
+ program for EPIPE. */
+static void
+errerr (void)
+{
+ if (errno =3D=3D EPIPE)
+ report_file_errno ("Write error", build_string ("standard error"),
+=09=09 errno);
+}
+
/* These functions are like fputc, vfprintf, and fwrite,
except that they output to stderr and buffer better on
platforms that support line buffering. This avoids interleaving
@@ -2926,7 +2936,8 @@ errstream (void)
void
errputc (int c)
{
- fputc_unlocked (c, errstream ());
+ if (fputc_unlocked (c, errstream ()) < 0)
+ errerr ();
=20
#ifdef WINDOWSNT
/* Flush stderr after outputting a newline since stderr is fully
@@ -2939,7 +2950,8 @@ errputc (int c)
void
errwrite (void const *buf, ptrdiff_t nbuf)
{
- fwrite_unlocked (buf, 1, nbuf, errstream ());
+ if (fwrite_unlocked (buf, 1, nbuf, errstream ()) < 0)
+ errerr ();
}
=20
/* Close standard output and standard error, reporting any write
--=20
2.54.0
From cd7badb6499b763885b75bb9754860211dbee42d Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@HIDDEN>
Date: Tue, 19 May 2026 12:28:12 +0000
Subject: [PATCH 2/2] Allow catching "broken pipe" errors in batch mode
(bug#80760)
This handles EPIPE by re-installing the default SIGPIPE handler and
raising SIGPIPE, so batch Emacs will behave as before if broken-pipe
is not handled.
* src/data.c (syms_of_data): Define Qerror_quit_signal.
* src/emacs.c (Fkill_emacs): Exit by reraising the signal stored in
Qerror_quit_signal, if it is bound to a fixnum.
* src/fileio.c (get_file_errno_data): Rewrite as switch; map EPIPE to
the new Qbroken_pipe error.
(syms_of_fileio): Add Qbroken_pipe. Give it a Qerror_quit_signal
property.
* src/keyboard.c (Fcommand_error_default_function): Bind
Qerror_quit_signal around the call to Fkill_emacs if the error symbol
has a Qerror_quit_signal property.
* src/sysdep.c (init_signals): Unconditionally ignore SIGPIPE.
---
src/data.c | 1 +
src/emacs.c | 10 ++++++++++
src/fileio.c | 33 ++++++++++++++++++++++++---------
src/keyboard.c | 6 ++++++
src/sysdep.c | 10 +++++-----
5 files changed, 46 insertions(+), 14 deletions(-)
diff --git a/src/data.c b/src/data.c
index 2f245ce8061..0d637df3edc 100644
--- a/src/data.c
+++ b/src/data.c
@@ -4028,6 +4028,7 @@ syms_of_data (void)
DEFSYM (Qerror_message, "error-message");
DEFSYM (Qtop_level, "top-level");
=20
+ DEFSYM (Qerror_quit_signal, "error-quit-signal");
DEFSYM (Qerror, "error");
DEFSYM (Quser_error, "user-error");
DEFSYM (Qquit, "quit");
diff --git a/src/emacs.c b/src/emacs.c
index 11fe567737a..fd372cfae9b 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -3079,6 +3079,16 @@ DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 2,=
"P",
=09emacs_perror ("Unable to re-execute Emacs");
}
=20
+ if (! NILP (Fboundp (Qerror_quit_signal)))
+ {
+ Lisp_Object quit_signal =3D Fsymbol_value (Qerror_quit_signal);
+ if (FIXNUMP (quit_signal))
+=09{
+=09 signal (XFIXNUM (quit_signal), SIG_DFL);
+=09 raise (XFIXNUM (quit_signal));
+=09}
+ }
+
if (FIXNUMP (arg))
exit_code =3D (XFIXNUM (arg) < 0
=09=09 ? XFIXNUM (arg) | INT_MIN
diff --git a/src/fileio.c b/src/fileio.c
index e6a6670ff9d..1eb189ad048 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -20,6 +20,7 @@ Copyright (C) 1985-1988, 1993-2026 Free Software Foundati=
on, Inc.
#include <config.h>
#include <limits.h>
#include <fcntl.h>
+#include <signal.h>
#include "sysstdio.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -271,15 +272,23 @@ get_file_errno_data (char const *string, Lisp_Object =
name, int errorno)
=3D code_convert_string_norecord (unibyte_str, Vlocale_coding_system, =
0);
Lisp_Object errdata =3D Fcons (errstring, data);
=20
- if (errorno =3D=3D EEXIST)
- return Fcons (Qfile_already_exists, errdata);
- else
- return Fcons (errorno =3D=3D ENOENT
-=09=09 ? Qfile_missing
-=09=09 : (errorno =3D=3D EACCES
-=09=09 ? Qpermission_denied
-=09=09 : Qfile_error),
-=09=09 Fcons (build_string (string), errdata));
+ switch (errorno)
+ {
+ case EEXIST:
+ return Fcons (Qfile_already_exists, errdata);
+ case ENOENT:
+ return Fcons (Qfile_missing, Fcons (build_string (string),
+=09=09=09=09=09 errdata));
+ case EACCES:
+ return Fcons (Qpermission_denied, Fcons (build_string (string),
+=09=09=09=09=09 errdata));
+ case EPIPE:
+ return Fcons (Qbroken_pipe, Fcons (build_string (string),
+=09=09=09=09=09 errdata));
+ default:
+ return Fcons (Qfile_error, Fcons (build_string (string),
+=09=09=09=09=09errdata));
+ }
}
=20
void
@@ -6776,6 +6785,7 @@ syms_of_fileio (void)
DEFSYM (Qfile_date_error, "file-date-error");
DEFSYM (Qfile_missing, "file-missing");
DEFSYM (Qpermission_denied, "permission-denied");
+ DEFSYM (Qbroken_pipe, "broken-pipe");
DEFSYM (Qfile_offset, "file-offset");
DEFSYM (Qfile_notify_error, "file-notify-error");
DEFSYM (Qremote_file_error, "remote-file-error");
@@ -6841,6 +6851,11 @@ syms_of_fileio (void)
Fput (Qpermission_denied, Qerror_message,
=09build_string ("Cannot access file or directory"));
=20
+ Fput (Qbroken_pipe, Qerror_conditions,
+=09list (Qbroken_pipe, Qfile_error, Qerror));
+ Fput (Qbroken_pipe, Qerror_quit_signal,
+=09make_fixnum (SIGPIPE));
+
Fput (Qfile_notify_error, Qerror_conditions,
=09list3 (Qfile_notify_error, Qfile_error, Qerror));
Fput (Qfile_notify_error, Qerror_message,
diff --git a/src/keyboard.c b/src/keyboard.c
index 6f0b5fbb2ec..2188d58cd3d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1077,10 +1077,16 @@ DEFUN ("command-error-default-function", Fcommand_e=
rror_default_function,
=09 || (!(IS_DAEMON && !DAEMON_RUNNING) && FRAME_INITIAL_P (sf))
=09 || noninteractive))
{
+ Lisp_Object quit_signal =3D Fget (XCAR (data), Qerror_quit_signal);
+ specpdl_ref count =3D SPECPDL_INDEX ();
+
+ if (!NILP (quit_signal))
+=09specbind (Qerror_quit_signal, quit_signal);
print_error_message (data, Qexternal_debugging_output,
=09=09=09 SSDATA (context), signal);
Fterpri (Qexternal_debugging_output, Qnil);
Fkill_emacs (make_fixnum (-1), Qnil);
+ unbind_to (count, Qnil);
}
else
{
diff --git a/src/sysdep.c b/src/sysdep.c
index 2ae8d535793..ac220459132 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2045,11 +2045,11 @@ init_signals (void)
maybe_fatal_sig (SIGINT);
maybe_fatal_sig (SIGTERM);
=20
- /* 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);
+ /* Emacs checks for write errors, so it can safely ignore SIGPIPE. Do
+ this even in batch mode; when we see EPIPE in batch mode, we will
+ re-raise the signal so as to behave like typical batch applications
+ do. */
+ signal (SIGPIPE, SIG_IGN);
=20
sigaction (SIGQUIT, &process_fatal_action, 0);
#ifndef __vax__
--=20
2.54.0
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.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= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JMwsvXe/WK38Ezs6x74iTaqI3AFH6ilAhDqpMnd/msSESNFt76DiO1ZK QMr9amVPknjfPmJISqdhgB1DlEdw34sROf6V8mZw0xfqT6PKE46LcFefzs0kbg4GORf8vjG2 Sf1tk5eU8MBiyN/bZ03bKNjNYMpODDQQwuP84kYLkX2wBxxMAhBxwbDVZudzxDZJ1C2VXujC OJVxq2kljBM9ETYuUGqd75AW2LXrLw6+MuIsHFAYAgRr7+KcwDgBAfwhPBYX34nSSiHlmLC+ KaHLeCLF5ZI2vKm3HEeCTtlOg7xZEONgwzL+fdKo+D6SoC8RRxJKs8a3sVfI4t6CnrQzvJbB n6gxdgCu5i29J1QCYrCYvql2UyFPAK+do99/1jOXT4m2836j1wARAQABzSBQYXVsIEVnZ2Vy dCA8ZWdnZXJ0QGNzLnVjbGEuZWR1PsLBlQQTAQgAPwIbAwYLCQgHAwIGFQgCCQoLBBYCAwEC HgECF4AWIQR+N5Kp2Kz31jO8FYjtl+kOYqp+NAUCabswsgUJHxsOjAAKCRDtl+kOYqp+NJlw D/9OSN9yKUVlhMG0/k9WfOogQbifE5TmYZ/9Iyl1l1hRURXNqeFDX8S0yme1c+++/61jl85V Xt+Fv8UzUpULvmPcIetf1vWZeHysbHJ1ZOHIMWnf7C9gxEbne+z90B51QTRCYcOlBHvuVeS0 DbaSJf2A41Bnsaa4DGpcTG6pzgGZLIpA6YOMDLC+pif1jiwieJp67Xj6oggzckKuOeD3pdKO hL7hLkzCFyWvIwnUOZWQp15w3pklQpSL7+yudfnlHuuG+As6zjHdz/51/vQJIb7keScZSmSC I76NEIrCPr7bIksZADLD8y/HnlzbWO+uUnKK4SvfnILLkp4o4ODZH1gjbZZDqFi1HawyWbYL lCU3k6I9MSWiLU7IafhMIaVf+oUcomA4Sa/H15dLaxQ0UkkUpSG8CqfU2ffFMUm7b/6GecOf y7WI4IztYzKV2rtT+OuzuHlc3uDCRthN84WggEsDbfHvIvXmYQG660W90qPxfB54ddi+SoEW RP0VkEIJm29rkbcz7apR2Y0i9BQk736khBQ6cT5G7INlmnkFv2jw3Z3lwAbUuvVsjMZBfELY iiQtP8fJbXQ7P5FTCqN+u6G2TPTMzwfvPIsrmNpM6/iwAu8b3y239ZxV6Vm1K5uYywjcL3z8 kLO7Zx1/ajPFOFd4oW1cPlFnMZCBBY7DYwtH8s7BTQRMgHJkARAApoXrvxP3DIfjCNOtXU/P dwMShKdX/RlSs5PfunV1wbKP8herXHrvQdFVqECaTSxmlhzbk8X0PkY9gcVaU2O49T3qsOd1 cHeF52YFGEt0LhsBeMjgNX5uZ1V76r8gyeVlFpWWb0SIwJUBHrDXexF67upeRb2vdHBjYDNe ySn+0B7gFEqvVmZu+LadudDp6kQLjatFvHQHUSGNshBnkkcaTbiI9Pst0GCc2aiznBiPPA2W QxAPlPRh3OGTsn5THADmbjqY6FEMLasVX8DSCblMvLwNeO/8SxziBidhqLpJCqdQRWHku5Xx gIkGeKOz5OLDvXHWJyafrEYjjkS6Ak6B5z6svKliClWnjHQcjlPzyoFFgKTEfcqDxCj4RY0D 0DgtFD0NfyeOidrSB/SzTe2hwryQE3rpSiqo+0cGdzh4yAHKYJ+UrXZ4p93ZhjGfKD1xlrNY DlWyW9PGmbvqFuDmiIAQf9WD/wzEfICc+F+uDDI+uYkRxUFp92ykmdhDEFg1yjYsU8iGU69a Hyvhq36z4zctvbqhRNzOWB1bVJ/dIMDvsExGcXQVDIT7sDNXv0wE3jKSKpp7NDG1oXUXL+2+ SF99Kjy753AbQSAmH617fyBNwhJWvQYg+mUvPpiGOtses9EXUI3lS4v0MEaPG43flEs1UR+1 rpFQWVHo1y1OO+sAEQEAAcLBfAQYAQgAJgIbDBYhBH43kqnYrPfWM7wViO2X6Q5iqn40BQJp uzCyBQkfGw6MAAoJEO2X6Q5iqn40Q5IQAIyyh3N1m6LgSN2Rf86kLL2ICijK3cPH9l0KvwWL SZ7GwkAQCsz4w5C3LYcPqY5BtCrwSaHH0Wv3EcQPy3vqXf/8dR+d5K3171HDx4YD9182G4sp 8ENKwqZB1At7DUDtS7ogOME3Jou+5ExKEIoTBgrFOkVW7dhpiRLH3p3Mbchlt+UBkjdGEE+7 3L1ttcGvEImBsN01oMYqgmVj5unwD7fwPXN56aLpBylRrlmvuxZyQVRvC1y2vJqIWJ7a2HhF 8C03O6oi8OhCQwoyqnpRTeRJb+kcIFj5RDw8v4W6T1LWtw7z6q+zYmvzhNbvwX5pvadWlFj6 3RPvfcJY6+RyuyMNPio1yhYakJKpvxJVpSsIbPyeEeiPez6dLl8/CMH4p8P3p0W+EmfENreR HfbOv5hXuAnR2eD/DzNrrIVRRjiFoEaYlKj5SDTNTsRjzrgTnSlE9eldkakIoxn9cQ/oD+mx 3dSD/vuWZ2v/RroxxxT9PJiLEPg2/Z8R3VL9Ff+RzCUIql6cY4NG7/mkU/Ed6u55S9IWcSI8 vFBto2TvYSv1woVRiF6rR0fWhY47BLweQwaK5vJa8XnvB7xFY/91Zll1P3z7iBaxg6GstGIl 9bIIO73BetYMj1ZvNgz2I6lsrpWQDYa/81II3XsGG/etr63vzAAY3wb4QAPYTZQKKey3 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.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
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
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.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.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.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.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
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.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.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.
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
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
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
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?
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.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?
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
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?
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
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?
bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
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.
```
"Marten Lienen" <ml@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#80760; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.