From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 23 05:56:13 2025 Received: (at submit) by debbugs.gnu.org; 23 Jul 2025 09:56:13 +0000 Received: from localhost ([127.0.0.1]:48477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ueWCq-0003fr-Nj for submit@debbugs.gnu.org; Wed, 23 Jul 2025 05:56:13 -0400 Received: from lists.gnu.org ([2001:470:142::17]:43644) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ueWCl-0003f6-99 for submit@debbugs.gnu.org; Wed, 23 Jul 2025 05:56:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ueWCf-0001dN-Uj for bug-gnu-emacs@gnu.org; Wed, 23 Jul 2025 05:56:01 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1] helo=mail.qxqx.de) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ueWCb-0003od-IT for bug-gnu-emacs@gnu.org; Wed, 23 Jul 2025 05:56:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mA6bB64ytMUQ/WmYpboa6CiGSeTtsenNCWfjZhPLGfg=; b=EGB3ESl1a7dh3swTLqHwNEgon+ 6uur7HNHCVrNqdNntYDG4/Kd0mtuH6pqJGZqqQrgc3C/9kE/2SVvfcXG5p7FWhavWYxWJp/AeTnUD J4ApBC6TQs5+tH9pNvWUK9NzAAbMPtZ4jUVK1+0B+OuOYsPWuh373xFv/bUyZpMT/NdY=; From: Daniel Mendler To: bug-gnu-emacs@gnu.org Subject: 31.0.50; Piped command output is sometimes lost in Eshell X-Debbugs-Cc: Jim Porter Date: Wed, 23 Jul 2025 11:55:53 +0200 Message-ID: <87pldr5iza.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a01:4f8:c012:9177::1; envelope-from=mail@daniel-mendler.de; helo=mail.qxqx.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) Hello, sometimes when executing commands in Eshell with pipes the output seems to get lost, for example: git log | head -n 10 | cat Instead of the expected ten lines of output, there is no output. This problem does not happen always, but from time to time, so maybe there is some timing issue regarding the process handling? In case the issue does not occur immediately one can try this: while true { echo "test"; git log | head -n 1 | cat } For such loops the following error might occur: Creating pipe: Too many open files Cannot redirect stderr: Too many open files, /dev/null I tested this with emacs -Q on Emacs 31 with a relatively recent commit from a few days ago (1e3d76af5a7a16682e71f9df46f6788c0880cccd). Can someone confirm these problems? Thanks! In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49, cairo version 1.18.4) of 2025-07-15 Windowing system distributor 'The X.Org Foundation', version 11.0.12101016 System Description: Debian GNU/Linux 13 (trixie) Configured using: 'configure --prefix=$HOME/.local/share/emacs --without-compress-install --with-tree-sitter --with-native-compilation --with-dbus --without-selinux --without-threads --disable-gc-mark-trace --without-gsettings --without-gpm --with-cairo --with-cairo-xcb --with-xinput2 --with-x-toolkit=gtk3 --without-toolkit-scroll-bars 'CFLAGS=-O3 -mtune=native -march=native'' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 TIFF TREE_SITTER WEBP X11 XDBE XIM XINERAMA XINPUT2 XPM XRANDR GTK3 ZLIB From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 23 11:52:45 2025 Received: (at 79079) by debbugs.gnu.org; 23 Jul 2025 15:52:45 +0000 Received: from localhost ([127.0.0.1]:51049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uebls-0000g6-Kv for submit@debbugs.gnu.org; Wed, 23 Jul 2025 11:52:45 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:48504) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ueblp-0000fR-DG for 79079@debbugs.gnu.org; Wed, 23 Jul 2025 11:52:42 -0400 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-3141b84bf65so6400449a91.1 for <79079@debbugs.gnu.org>; Wed, 23 Jul 2025 08:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753285955; x=1753890755; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=l+Pp4nDh2+ltybzKKcKjZAL0j2goA4dVOk1Q1pb+fKE=; b=UVoHNsVTpts3AKM6Kd3xlCX17ihL88MZOSMqWtoGwWX15No2SJ+ZD2O9vYPoDHecaW tMK1kmIFmmYPncC1vTKpuijqnvNaXG6D6l2dpjt0qSFXzXg9t3OsaIXjaiTHhz9J91QU kqlitNCWkcf/bya6VYldCbGSVNSlAxRk+Ca+C0TTgMt+3DpD0oRHyL+t+xxUfiGJSm+0 7Kt282mDYrzfNnUE7B5LAH9IN/3XzauX15p3mGAdIZB8TK5/937LZ/GCWrEiMG4/yKI7 yG0Oyv9sMnJ0PRr4vdkcZLx4GgdUkUZ6zVtETJQ2a4QW+ZWcsCAJTXvpD1hiAr0KtvEX /bfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753285955; x=1753890755; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l+Pp4nDh2+ltybzKKcKjZAL0j2goA4dVOk1Q1pb+fKE=; b=oZR+X5gYXf6LNz0toHobBP8O5x+BX3onttsG4MQGDN2dscYA7FQub5ZhZc4FRy4gMV XpKzNoOdcfWuHyWrd/YEP9oqqLm08rU7TfcRIUc44dm2BLh7/ElmbwpBZdOvd3GFs+5f G7nPqhRUmae9lmpP//3OUQCFR3U4H/XaeimxvDKxgPJFOcG8PM5jcSxBl5E4M/PGkWYB k2G73pKE4s5leuCWYPm+K4K4msnwhtv8wf2fG4+G11aV6md/+oBnxRPn7Z5XOp2SzF3A NgxA4OuvGtEMTpwUXYUnRjTwy3gKF6/2f/YEqxHAHu1ReX9IdxlEO/RzX/SvJB/Kck6k 0u7w== X-Forwarded-Encrypted: i=1; AJvYcCWqKZ7vHdFAWcqHxZ2g+Mqky11M5SUvPsj9c4h1+1P1ahqEjOAFnslXoqsFwk87fHHY/OgxAg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwbefFa4A89xu9GchNgAFcSLZo5164JhcfYstEv+NC5THOlTADV 7hJbHzo+IpUxycSh+bUtQJHrxe7jmW7m6FLGMU15LPMha3ovH+qNz1LsFuyqmg== X-Gm-Gg: ASbGnctrEUbb17lkwlVIQmCCtXtbXTUsQlpNc/swoFBJaTpJCtBpl2Sc9+cpWjeyf9W UsVh/cPiFUjFnU4mndct79n1enUmqGGja/1BewHaCoyfJIjfnjy5pEGJtk024VKr0cZn5QGbrmL Vk3Hz+JZ0STw+AQRdbvaq8jMMkGD3gYn2ocRRKjgtWcHG9BsUQl2+KlWuebKSYHlBfWQmJHy9UK k5V0LkuikHag1EyewresbQqdA0cvewWBCFOjGqi9xdvJLT7Z3xYlIp0xYhcWubZ5A+QSvBnntA/ vgyMA9o1bbHtPiTUX6qJI9HcnP+OuReJxiSSE4ey/guGkM8kvZEJjNGJE0Zkb2tbQ/lc9i+n2tP /haR9LEA78iOP7eLYdHP+Kh+lcnFzwofkNmKUc0bXdPQq8u4N93W3qvFxMMrR5c/DgiYMpVd2Tl NKng== X-Google-Smtp-Source: AGHT+IExnna1CVcZ8i40b6dgB0Cp1kTZEiMOvhEktXYsOFgeIMlQS8/MLfCOSynECj5TI4mq0trm5A== X-Received: by 2002:a17:90b:1f81:b0:31c:ad57:b97a with SMTP id 98e67ed59e1d1-31e507ab2admr5145795a91.13.1753285955141; Wed, 23 Jul 2025 08:52:35 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-31e519f4f0fsm1950053a91.10.2025.07.23.08.52.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jul 2025 08:52:34 -0700 (PDT) Message-ID: <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> Date: Wed, 23 Jul 2025 08:52:36 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Daniel Mendler , 79079@debbugs.gnu.org References: <87pldr5iza.fsf@daniel-mendler.de> From: Jim Porter In-Reply-To: <87pldr5iza.fsf@daniel-mendler.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/23/2025 2:55 AM, Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > sometimes when executing commands in Eshell with pipes the output seems > to get lost, for example: [snip] > Can someone confirm these problems? Thanks! I'm not able to reproduce this locally, but if you first run "eshell-debug process", that will log a bunch of process-related information to the buffer "*eshell last cmd*". That would probably have some details that at least show where the I/O went missing. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 23 12:37:17 2025 Received: (at 79079) by debbugs.gnu.org; 23 Jul 2025 16:37:17 +0000 Received: from localhost ([127.0.0.1]:51257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uecSy-0003mC-6A for submit@debbugs.gnu.org; Wed, 23 Jul 2025 12:37:16 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:55549 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uecSn-0003lH-9T for 79079@debbugs.gnu.org; Wed, 23 Jul 2025 12:37:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FMVPeLZb2hrAhdW9liaGUtLEOrhR6BS1ungrVwmrbgI=; b=qThM1vsS0wDhgE5Qi9HGAS/DqA 5WpNf/uZBlJFx26/kCn1BvZvhvbppgWOJTM/P2V2yrdBiGY6XZp7gNtpNC63IeIIJU0M5KWt7mcH7 We7mJRnuPIFJ7YuQjPp2lDZ+W6jzsuO4hRQh4A+hzbEKYtQaWoVlSr3PfIy+Go+/fmaw=; From: Daniel Mendler To: Jim Porter Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell In-Reply-To: <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> Date: Wed, 23 Jul 2025 18:36:56 +0200 Message-ID: <87ikji6ezb.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 79079 Cc: 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Jim Porter writes: > On 7/23/2025 2:55 AM, Daniel Mendler via Bug reports for GNU Emacs, the S= wiss > army knife of text editors wrote: >> sometimes when executing commands in Eshell with pipes the output seems >> to get lost, for example: > [snip] >> Can someone confirm these problems? Thanks! > > I'm not able to reproduce this locally, but if you first run "eshell-debug > process", that will log a bunch of process-related information to the buf= fer > "*eshell last cmd*". That would probably have some details that at least = show > where the I/O went missing. Thanks. I tried your suggestion. What stood out is that in the failed runs, the output from the git process is received, and passed on to the head process, but no output is received from head. It seems that the head filter function is never called? This would hint at a lower-level problem. See the logs of the runs below. The problem occurs in particular for this command: git log --color=3Dalways --decorate=3Dyes | head -n 1 While it does not happen (or not so often) for this: git log --color=3Dalways --decorate=3Dyes | cat | head -n 1 Did you try the loop with the echo and the command? Do you have any further suggestions on how to debug this? Maybe it has something to do with my specific build. Daniel ### Good run [process] started external process =E2=80=98head=E2=80=99 [process] started external process =E2=80=98git=E2=80=99 [process] received output from process =E2=80=98git=E2=80=99 [process] forwarding output from process =E2=80=98git=E2=80=99 [process] received output from process =E2=80=98head=E2=80=99 <=3D=3D=3D=3D= =3D received output [process] received output from process =E2=80=98git=E2=80=99 [process] forwarding output from process =E2=80=98git=E2=80=99 [process] received output from process =E2=80=98git=E2=80=99 [process] forwarding output from process =E2=80=98git=E2=80=99 [process] sentinel for external process =E2=80=98git=E2=80=99: "broken pipe [process] i/o busy for process =E2=80=98git=E2=80=99 [process] sentinel for external process =E2=80=98git-stderr=E2=80=99: "fini= shed [process] finished external process =E2=80=98git-stderr=E2=80=99 [process] sentinel for external process =E2=80=98head=E2=80=99: "finished <= =3D=3D=3D=3D=3D finished [process] finished external process =E2=80=98head=E2=80=99 [process] finished external process =E2=80=98git=E2=80=99 ### Bad run [process] started external process =E2=80=98head=E2=80=99 [process] started external process =E2=80=98git=E2=80=99 [process] received output from process =E2=80=98git=E2=80=99 [process] forwarding output from process =E2=80=98git=E2=80=99 [process] received output from process =E2=80=98git=E2=80=99 [process] forwarding output from process =E2=80=98git=E2=80=99 [process] received output from process =E2=80=98git=E2=80=99 [process] forwarding output from process =E2=80=98git=E2=80=99 [process] sentinel for external process =E2=80=98head=E2=80=99: "finished [process] finished external process =E2=80=98head=E2=80=99 <=3D=3D=3D=3D=3D= finished without output [process] sentinel for external process =E2=80=98git=E2=80=99: "broken pipe [process] i/o busy for process =E2=80=98git=E2=80=99 [process] sentinel for external process =E2=80=98git-stderr=E2=80=99: "fini= shed [process] finished external process =E2=80=98git-stderr=E2=80=99 [process] finished external process =E2=80=98git=E2=80=99 From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 23 14:06:32 2025 Received: (at 79079) by debbugs.gnu.org; 23 Jul 2025 18:06:32 +0000 Received: from localhost ([127.0.0.1]:51752 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uedrM-0004EX-4X for submit@debbugs.gnu.org; Wed, 23 Jul 2025 14:06:32 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:42360) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uedrJ-0004Ds-Tc for 79079@debbugs.gnu.org; Wed, 23 Jul 2025 14:06:30 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2350fc2591dso2492025ad.1 for <79079@debbugs.gnu.org>; Wed, 23 Jul 2025 11:06:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753293984; x=1753898784; darn=debbugs.gnu.org; h=in-reply-to:references:to:from:content-language:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=iirs8EQ41rW4tyh/S1Wuq+3up8gtkefEdyqmNgAeNUA=; b=Ksc9d+S8Zlz6NdE2zLZZ7PjkfQZoXXnGfP9oInHjpVMIeJie58JqyG9ie2sL1yo3Gi Yyza1Cl7y6p/dEKzar5F+kmwDGgqyecg5ZQfArStb2+u2L6aoNWUBulot2KwPwzQo0p2 daNhvGm5r6vYVwMCnEVq04vKC6jSTOHB3NeicjE8UmuCPm+qBlcsNOWVTt4iRutmXj8T GU5+7lhSRhnCD6NNGRrmZ9CHh9rwpwBYqiou5KG9FasKDAlfwuiKyfTWyViw2j0IEv5o Wog9+SzgSsepd7kgcpLUnw05bq0zzMjon9iYhg4d6Siytn/49/b5/OD5rPJ9ge/RAFnt mmGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753293984; x=1753898784; h=in-reply-to:references:to:from:content-language:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=iirs8EQ41rW4tyh/S1Wuq+3up8gtkefEdyqmNgAeNUA=; b=g+6wGpryMJlZJWSO5FlT8/9/7+ja0A6HSz8A8U18cQjC7eXBiYxMLZt3RiL8WifYW8 1u0Llj53DDEVXFlVdg0LDjXiDPDa8K3ORUEErdlroiFdeUKE5OpXuuPYxdjGcnNyznsF PjIrYU5wPyw5MFE8MpFrphi0mGBzVHjWnH2DyIwu/OEGTNBDccO/1C/CuzSnSYOP7lPp rpSJD2O6FM6PK60xxCO9kQkhE8LfSj4Albzx0OAgHJmAUOtE/EWfpo8INwfRFVF1w7by /mspNmxFg8ZFSU7rEBprAzVQL+SwjJaQhrFPID3zrEbrYPaN/9+p4AxDkbplnWotrHro hAAw== X-Forwarded-Encrypted: i=1; AJvYcCVZYzAZLKmAdkGR0375JarK6+7vxNxBXt8bgoslrNeHHTuS0Jm1Lei0oK0muYs8fRSJqjL6gw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxMN95J39liCKEYSWyysCtg1hO8QBrUD4rgY0pIwoobd6Nsmk1W tSWP1UQ8NIE/kzetkgrCEE9B06N5LlZrK20t5Rqy5LXL6L9peJN6wAKM X-Gm-Gg: ASbGncttakOq2NGMeh2npXmpIkZNlAbeStqozlv2Z4oolElrx4mdQ0wD5Ef4Hh36/Tb t8MR93l2ut0bUVomNY5pYyDLiRb5zU62YiwAWog+/aWlUqNXDV8dB6uSt4dPoJpWoNM0XCQLocU gRgQMXWWzj7NxBBd6h8Gjp7rBXYlCo+EhevEmzWYgN3UTVvUjT8N9UW2/hk0NVd2nv3jbrlKYBr OY0X63ACYarfzGBw7NHY/CB32cy6YC+YnBNtO5oLT/pwC0BiqbbGZeBuYsZL65HRDZOBz04r6kR xwPb+fthLS7NfVAS39DB8Zp/Z4NAbR5xgHdIB7iElnadN3IpyQg0qMnS/xVG8703te2AWFMXqVV 5FYR3b1/jIrOA8nObu1C6cvvTS9WbIdkTQrrIMY4SPauog0rrQVfFIcEGafKptIYBvWlnX7Kg/8 VyiA== X-Google-Smtp-Source: AGHT+IGx+RR/9JuXFN7xmGjbqps4g081jVw2IX4YBkSWvYpDdYbfC/jACYoeESwvzWO5g4R9MW8/5w== X-Received: by 2002:a17:903:8cc:b0:235:278c:7d06 with SMTP id d9443c01a7336-23f98293fbdmr61826995ad.8.1753293983582; Wed, 23 Jul 2025 11:06:23 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-23e3bdfe68csm100271005ad.183.2025.07.23.11.06.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jul 2025 11:06:22 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------3BvCia0jq3tE7vWYEGLLS1x1" Message-ID: Date: Wed, 23 Jul 2025 11:06:24 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US From: Jim Porter To: Daniel Mendler , 79079@debbugs.gnu.org, eliz@gnu.org References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> In-Reply-To: <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------3BvCia0jq3tE7vWYEGLLS1x1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/23/2025 8:52 AM, Jim Porter wrote: > I'm not able to reproduce this locally, but if you first run > "eshell-debug process", that will log a bunch of process-related > information to the buffer "*eshell last cmd*". That would probably have > some details that at least show where the I/O went missing. After a few more tries, I was able to reproduce this very rarely. Does the following patch help? Eli: maybe you can help with some of the details here. In process.c, when we write to a process, we handle EPIPE errors by calling 'deactivate_process'. However, that can lead to us dropping any data written *by* that process, since we don't call the process's filter function for any remaining output still in our internal buffer. I think in this case, we'd just want to let the rest of our code handle deactivating the process in the usual way. That helps fix this bug, plus I think it makes sense in general. If a process closes stdin, I believe we'd get the EPIPE error, but that process might want to continue working (though it does mean that you could only interact with that process via signaling it). Does that make sense? --------------3BvCia0jq3tE7vWYEGLLS1x1 Content-Type: text/plain; charset=UTF-8; name="epipe.diff" Content-Disposition: attachment; filename="epipe.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9wcm9jZXNzLmMgYi9zcmMvcHJvY2Vzcy5jCmluZGV4IGU2MWVj NDI1ZjdlLi4yNThiZWUyMWI1ZSAxMDA2NDQKLS0tIGEvc3JjL3Byb2Nlc3MuYworKysgYi9z cmMvcHJvY2Vzcy5jCkBAIC02ODc2LDcgKzY4NzYsNiBAQCBzZW5kX3Byb2Nlc3MgKExpc3Bf T2JqZWN0IHByb2MsIGNvbnN0IGNoYXIgKmJ1ZiwgcHRyZGlmZl90IGxlbiwKICAgICAgICAg ICAgICAgICAgcC0+cmF3X3N0YXR1c19uZXcgPSAwOwogICAgICAgICAgICAgICAgICBwc2V0 X3N0YXR1cyAocCwgbGlzdDIgKFFleGl0LCBtYWtlX2ZpeG51bSAoMjU2KSkpOwogICAgICAg ICAgICAgICAgICBwLT50aWNrID0gKytwcm9jZXNzX3RpY2s7Ci0gICAgICAgICAgICAgICAg IGRlYWN0aXZhdGVfcHJvY2VzcyAocHJvYyk7CiAgICAgICAgICAgICAgICAgIGVycm9yICgi UHJvY2VzcyAlcyBubyBsb25nZXIgY29ubmVjdGVkIHRvIHBpcGU7IGNsb3NlZCBpdCIsCiAg ICAgICAgICAgICAgICAgICAgICAgICBTREFUQSAocC0+bmFtZSkpOwogICAgICAgICAgICAg ICAgfQ== --------------3BvCia0jq3tE7vWYEGLLS1x1-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 23 14:17:59 2025 Received: (at 79079) by debbugs.gnu.org; 23 Jul 2025 18:17:59 +0000 Received: from localhost ([127.0.0.1]:51778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uee2Q-0004x8-Kd for submit@debbugs.gnu.org; Wed, 23 Jul 2025 14:17:58 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:33517 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uee2O-0004we-3x for 79079@debbugs.gnu.org; Wed, 23 Jul 2025 14:17:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UPFmLFIAUKmkG8DOjrpDizJcw/qswhPMmH9RQAgFLBk=; b=UpaCgETmFx+JFJ+5vnL2uFsqTA aGtRoOvEczRpd0HuQoF7amybw+/hLnC0afbwjQTdxujQEYBM7685QxPwq40Y+V7JIoLr2l8rnc3Ks cZJhXxCJgxgfPWPG0OEmZ8qXV+woABhPBasBLGDVmxF4BlKI3oQVOmsvlPtBlqtcwTjI=; From: Daniel Mendler To: Jim Porter Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell In-Reply-To: References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> Date: Wed, 23 Jul 2025 20:17:47 +0200 Message-ID: <87cy9q6ab8.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 79079 Cc: eliz@gnu.org, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Jim Porter writes: > On 7/23/2025 8:52 AM, Jim Porter wrote: >> I'm not able to reproduce this locally, but if you first run "eshell-debug >> process", that will log a bunch of process-related information to the buffer >> "*eshell last cmd*". That would probably have some details that at least show >> where the I/O went missing. > > After a few more tries, I was able to reproduce this very rarely. Does the > following patch help? Thanks for looking into this so quickly and coming up with a patch! I can check this earliest end of next week. Recompiling Emacs always takes me a little bit longer than simply evaluating some Elisp. > Eli: maybe you can help with some of the details here. In process.c, when we > write to a process, we handle EPIPE errors by calling 'deactivate_process'. > However, that can lead to us dropping any data written *by* that process, since > we don't call the process's filter function for any remaining output still in > our internal buffer. > > I think in this case, we'd just want to let the rest of our code handle > deactivating the process in the usual way. That helps fix this bug, plus I think > it makes sense in general. If a process closes stdin, I believe we'd get the > EPIPE error, but that process might want to continue working (though it does > mean that you could only interact with that process via signaling it). Maybe this also needs some test to avoid regressions? Did you find a way to reliably reproduce the problem? > Does that make sense? > > diff --git a/src/process.c b/src/process.c > index e61ec425f7e..258bee21b5e 100644 > --- a/src/process.c > +++ b/src/process.c > @@ -6876,7 +6876,6 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, > p->raw_status_new = 0; > pset_status (p, list2 (Qexit, make_fixnum (256))); > p->tick = ++process_tick; > - deactivate_process (proc); > error ("Process %s no longer connected to pipe; closed it", > SDATA (p->name)); > } From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 01:34:15 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 05:34:15 +0000 Received: from localhost ([127.0.0.1]:54015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ueoat-0008J2-4c for submit@debbugs.gnu.org; Thu, 24 Jul 2025 01:34:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40616) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ueoar-0008IZ-98 for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 01:34:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ueoak-00049o-6r; Thu, 24 Jul 2025 01:34:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=b/iqVqCuTmeMDiOy7zlurQWb1vwTxWkdnDH1BHYXTwc=; b=UlPHWMsd6IhM S9c80USA5Ea9sGQ+Jm4GE0dWeKGgHRcYqV8nDo6TrsHYVxwcwK5wSHvdLfjAPqbRET+uxcrlRh3uL 8jKazHchZzhwFDMqtBNbu4RUwPGRS0gBFJSNRAAUqNpvGMHxbyvaP9jwmpZbf++FtoQSZ7NXup0eG RZMreYc9+i3ImRFK9CjEyQhjgbivGExjnufpVq6IL7dlnFGQXdCcNO8DDepzFo7/KLmhzZu7EV3Ej UU/Cs5VvY9WbNCHRStZsYlM35u+pVk1Hm6jHCYnpfmO/Jc0D+PNsg6nvrQEDd/6jK4TIBExwePcpa MRTwDzfdzP05KsIqGEX6Sw==; Date: Thu, 24 Jul 2025 08:34:03 +0300 Message-Id: <864iv26tkk.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter , Paul Eggert In-Reply-To: (message from Jim Porter on Wed, 23 Jul 2025 11:06:24 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 23 Jul 2025 11:06:24 -0700 > From: Jim Porter > > On 7/23/2025 8:52 AM, Jim Porter wrote: > > I'm not able to reproduce this locally, but if you first run > > "eshell-debug process", that will log a bunch of process-related > > information to the buffer "*eshell last cmd*". That would probably have > > some details that at least show where the I/O went missing. > > After a few more tries, I was able to reproduce this very rarely. Does > the following patch help? > > Eli: maybe you can help with some of the details here. In process.c, > when we write to a process, we handle EPIPE errors by calling > 'deactivate_process'. However, that can lead to us dropping any data > written *by* that process, since we don't call the process's filter > function for any remaining output still in our internal buffer. > > I think in this case, we'd just want to let the rest of our code handle > deactivating the process in the usual way. That helps fix this bug, plus > I think it makes sense in general. If a process closes stdin, I believe > we'd get the EPIPE error, but that process might want to continue > working (though it does mean that you could only interact with that > process via signaling it). > > Does that make sense? Sounds a somewhat scary change, since this code was last touched 13 years ago. Paul, WDYT? What about calling the filter with the data we still have? Isn't that what a Posix shell would do -- flush any buffers? And why do we get EPIPE in the recipe in this bug, anyway? I'd like to understand better at least one situation where we get EPIPE while the data received before that still matters. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 09:52:49 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 13:52:49 +0000 Received: from localhost ([127.0.0.1]:55777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uewNN-0003G0-5N for submit@debbugs.gnu.org; Thu, 24 Jul 2025 09:52:49 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:46008) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uewNJ-0003FZ-UB for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 09:52:47 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 45CD93C01084A; Thu, 24 Jul 2025 06:52:40 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id nP6OunJTDlfU; Thu, 24 Jul 2025 06:52:40 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 19FEF3C010841; Thu, 24 Jul 2025 06:52:40 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 19FEF3C010841 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753365160; bh=BqGXE9X9HvCb167X23q9wBgiciAa14REhEt9S/BWREo=; h=Message-ID:Date:MIME-Version:To:From; b=qz+ykQMPKwGROaqLO9FhjLLcJHOXp9JnSh7tkYr/U6nyThb04L49lcdqvRZjDt8Cu 8sEK21b5/iQzO3wEbKzdFydfStXza8MWbPeSO/mrGYcPajL9CzHWUVmBsL9WZDFv40 FwsPRgvIr6szuPUDKzIIJRoEdeK88R6EBWlLSfQAwYXpBDMmMiI6Nrc9/giIAbcpL7 WdHtUJG4RRWSbHxe9AKj4bUqJ6edwTNMtSDE0ptcB2u2DMw1yhOpgK/SG/qbDN6EtE sL5icG1RQBMwKgZi7NHoiLCQ4O1ggcBqn4Bc4+1nXUoxLUi5ZLvqVVyqRloy8yBvNm zeH/Z3rsm592A== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id ZCWPRofmc9Ot; Thu, 24 Jul 2025 06:52:40 -0700 (PDT) Received: from penguin.cs.ucla.edu (unknown [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id E31873C01084A; Thu, 24 Jul 2025 06:52:39 -0700 (PDT) Message-ID: Date: Thu, 24 Jul 2025 06:52:39 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <864iv26tkk.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: Jim Porter , mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-07-23 22:34, Eli Zaretskii wrote: >> Date: Wed, 23 Jul 2025 11:06:24 -0700 >> From: Jim Porter >> In process.c, >> when we write to a process, we handle EPIPE errors by calling >> 'deactivate_process'. However, that can lead to us dropping any data >> written*by* that process, since we don't call the process's filter >> function for any remaining output still in our internal buffer. >> >> I think in this case, we'd just want to let the rest of our code handle >> deactivating the process in the usual way. That helps fix this bug, plus >> I think it makes sense in general. If a process closes stdin, I believe >> we'd get the EPIPE error, but that process might want to continue >> working (though it does mean that you could only interact with that >> process via signaling it). Yes, that makes sense. > What about calling the filter with the data we still have? Isn't that > what a Posix shell would do -- flush any buffers? Not sure what you man by that, but I suspect it wouldn't handle the scenario Jim describes, where the other process closes its end of the pipe but keeps running. Emacs shouldn't assume that EPIPE means the other process has died or has closed any pipes other than the one Emacs got EPIPE on. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 10:56:48 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 14:56:48 +0000 Received: from localhost ([127.0.0.1]:57465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uexNH-0008Fi-IQ for submit@debbugs.gnu.org; Thu, 24 Jul 2025 10:56:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34136) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uexNE-0008FB-TN for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 10:56:45 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uexN8-0005NN-0b; Thu, 24 Jul 2025 10:56:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=aWkv5GJTVUZ07qrcouJ4ZKUw64OYSiaZ5NrvtQKqh3k=; b=Ow7PDF8iRsrT UQ1VJo/WkHS3ibCw2Gq3WP379n/ux9HWCyhNYGY1ZRWgxVdzoKv5S4Jzfv5CMax8FstGdJGs3i+bZ nB1/fV1O90OweAkjdlcFMImp58+dJBQMO4ILIMAqrEBDIvrVgI8oJrI+ebq7/8aj67cbQd4R2B8mI XZVbdlOlezOzmJ+skUQvGb5r9uynm4BHDRi9MHguB7Z9/XHR9JP5R/G1DCd/1LTj65LvZVZWcKMmc VTW5AIYPoHfDrD7jNNn96QHDy4bGTHQfDxul6AiliynWn3ovIE6vlDPxzm2/H03XanLZDO9sOb0pD g9spxgWQvKJ9BokB0o7izA==; Date: Thu, 24 Jul 2025 17:56:35 +0300 Message-Id: <86cy9p63j0.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-Reply-To: (message from Paul Eggert on Thu, 24 Jul 2025 06:52:39 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 24 Jul 2025 06:52:39 -0700 > Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org, > Jim Porter > From: Paul Eggert > > >> I think in this case, we'd just want to let the rest of our code handle > >> deactivating the process in the usual way. That helps fix this bug, plus > >> I think it makes sense in general. If a process closes stdin, I believe > >> we'd get the EPIPE error, but that process might want to continue > >> working (though it does mean that you could only interact with that > >> process via signaling it). > > Yes, that makes sense. > > > > What about calling the filter with the data we still have? Isn't that > > what a Posix shell would do -- flush any buffers? > > Not sure what you man by that, but I suspect it wouldn't handle the > scenario Jim describes, where the other process closes its end of the > pipe but keeps running. Emacs shouldn't assume that EPIPE means the > other process has died or has closed any pipes other than the one Emacs > got EPIPE on. I guess I'm confused: if the other process closed its end of the pipe, why do we care about the stuff we have in our buffers that wasn't yet piped to that other process? From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 11:52:30 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 15:52:30 +0000 Received: from localhost ([127.0.0.1]:57767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ueyFC-0006vJ-8j for submit@debbugs.gnu.org; Thu, 24 Jul 2025 11:52:30 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:51413) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ueyF4-0006ua-9p for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 11:52:27 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-747c2cc3419so1025908b3a.2 for <79079@debbugs.gnu.org>; Thu, 24 Jul 2025 08:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753372336; x=1753977136; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=7xRzVIbkzIqRsrtf7WSGo33Va/tz15BgeppEKMe7EdE=; b=fAmR7N//ZNBTudzZ/L5hcuxOccbyF9arpPTX23z45tHYH2koTWDUzrpwk8TSZXIxEq VpmA5lbPqIBn88Jz0UZI3AO1ZlXmJ7gxTEYe5m8P7+oxiLrRW7fBh2YQZTIJYsunL+dY 3ZgYxsUxyJDbysAoLzsMk8H2oOe15r9cvPy4wyWOkvs0uflMqlqkpkSTgxdWClhOIR5D 35Eo+d/cHtf5lhAUVN3fF8J+BtTav/PLJa77CLuWG/LaZVQQnwxesbTBGEr9VRvzGJ/3 DWxXjlshVmkY5vwzOs5sY07/wMukzyQUq32JZV/1bbDtSIsfxh2+PG4WDGanUmp/4knF zhKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753372336; x=1753977136; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7xRzVIbkzIqRsrtf7WSGo33Va/tz15BgeppEKMe7EdE=; b=lKmXL0vkk3BdKCnpyoqxinK+OVmj/Rep7HF6Bi1x+RXYm/XXORwrObB1eIXruGBK3S IohcC8LuOi/WUDjAWgz5PpskvARFk8yz/D/qTM69rIzBEPex/8xD09RA5KDlIzVjPiX9 mFD0somP35LWVyPX4P3QAsVtVzKYYrt4TgRd6qXMYfd7raBhykgV3nt9GhSTsI9x/Sod m6BgXdimDSPQp8FKnJG9MmMZszrYbBCqnW/4DT2q4aa9hPz94uxxFUhiV6zlncvMC+lr gMGYF4PJCg12TH0Fm1tiRliUsnUz08J3prBHP5C5vBWb+ZZrKeULf6agMQyP6Gstzq6j SPzw== X-Forwarded-Encrypted: i=1; AJvYcCVRvu7clrpVxDdvH22+V/SH8uzhwJS6LF8S31E0wgLWS1h2dmHcTTelmukez1irfKLlYoh+Aw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yy+PuH5MuCzBqzrv7fbHH+n4ef8ooGlrOK+ZRy7WFk/0B0QfeqE Gq864qruiluwG7HQ70dkvpJtllGWixXw9DDOrryxPObkwpoP4eXo3xHWtZk7fQ== X-Gm-Gg: ASbGnctVcTKy0OVQnfEGNHDjlQQTIA/lJ5nPXiI1/cxqqvbBxa/+8G6pkCxufMRD8ZT GVKFxZY4t8G7lpifC7jYnW1ZlHCJQatU8HJ4X1v2og7gYEh8NOeT2FlknNHT3TfxR8ZfENBWtOk tH9nS6LPpk5B3IFSfFC2vPAbAPwY5VRIugwLil7CBQra4jNpurBvVEDFUXn/DUMf1XJ0ps+q5GH GdUjW0vBsl2TSmMer6Yis62BLMI3+ed9bpI6UXMagHEEVBMdWp943qY/hDigEIxEAjicOHWjFGx DYxQS5r7/ssNXb//gkAeY3Wi/ZjxqL2kXkIuln2QT4WJz4elSR2Yp2btrntYvmPpwPtRAq41SRY LkjwwD5vPCUp4cLZCMuzlxbjRmkF5wGitAjVLwlTksSE9rqEWfUTfg51492gc+sc0ER8lsGfzsC ezPXlT7skl6y7s X-Google-Smtp-Source: AGHT+IGBx0EmlKYuXvSFxA28Y/hXxyEMJrK5AetggZk1+ZnWAMon+edLshn+8CjwTzf0M5FKVnfsfQ== X-Received: by 2002:a05:6a00:228a:b0:748:323f:ba21 with SMTP id d2e1a72fcca58-76034c00474mr10156796b3a.1.1753372335677; Thu, 24 Jul 2025 08:52:15 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-761b05ec57esm1955043b3a.100.2025.07.24.08.52.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jul 2025 08:52:15 -0700 (PDT) Message-ID: <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> Date: Thu, 24 Jul 2025 08:52:16 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii , Paul Eggert References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> From: Jim Porter In-Reply-To: <864iv26tkk.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/23/2025 10:34 PM, Eli Zaretskii wrote: > What about calling the filter with the data we still have? Isn't that > what a Posix shell would do -- flush any buffers? > > And why do we get EPIPE in the recipe in this bug, anyway? I'd like > to understand better at least one situation where we get EPIPE while > the data received before that still matters. In the recipe, we pipe "git log" to "head -n 10", where Eshell handles the actual piping. (I don't think Eshell's presence here is actually necessary to see this bug, though it's probably the simplest way to reproduce it in Emacs.) "git log" produces a bunch of output that gets sent to Eshell's process filter. That filter eventually calls 'process-send-string' on the "head" process, forwarding all of git's stdout to head's stdin. Immediately after that, head sees that it's already gotten 10 lines of input, so it exits. "git log" doesn't know that yet, so it sends another batch of text to Eshell's process filter, which again gets passed to 'process-send-string'. This time around though, the pipe to head's stdin has been closed, so we get an EPIPE. Currently, Emacs deactivates the head process, but because of how the timings worked out, all this happens *before* Eshell's process filter for head ever runs. As a result, Emacs never see the output that head produced. Thinking about this more, my previous comment that the output from the head process is in an internal buffer in Emacs probably isn't accurate. That *could* happen, but in some cases, we may not have called 'read' yet, so the data could still be in the OS's buffer. (I'd have to write some test cases to be 100% sure of all this, but it follows from the manpages.) From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 12:33:07 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 16:33:07 +0000 Received: from localhost ([127.0.0.1]:57935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ueysU-0001Ok-T2 for submit@debbugs.gnu.org; Thu, 24 Jul 2025 12:33:07 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:57712) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ueysR-0001O2-NJ for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 12:33:04 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id D36923C010841; Thu, 24 Jul 2025 09:32:57 -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 bo75J6jOgE5c; Thu, 24 Jul 2025 09:32:57 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id AACF33C01084E; Thu, 24 Jul 2025 09:32:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu AACF33C01084E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753374777; bh=gFVlrMy1T1oZE8VsSZTu/Gf7VXZ0XckeFmBKshfugOY=; h=Message-ID:Date:MIME-Version:To:From; b=kiTYNSo6Df64g48+wD4Fpz3CZGFcHjn2PSzy9JpA7y+8CsGXGPdg6+N+nmqQhUKB7 lMcnNfcgwvfOfM5NbXwdbjVWpfxLaEMOrPqHfj9ts2tn2DB778PK+ufawnIMSH2jij D2rQravNVSHC2XHCg0UL46zpa8iCMXEOs2cy1VSm6Z1DAgJcovKoywjK3uwAhdKxDr rYpnr+aHhS5pBRWoLRijHPuumlSEzH/R9gGczBnwJYBLUiQdvJN/r6thKBPxbsvCw+ L4zKMMpJ6MN/N+rHhm4lpOX3zcdspLKSgkkUbL59x7+fo2DsbwYQ9UJ2PonT8mh44R oDlDAPnfDFwIQ== 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 uTcmKDeaCr1h; Thu, 24 Jul 2025 09:32:57 -0700 (PDT) Received: from penguin.cs.ucla.edu (unknown [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 8C1323C010841; Thu, 24 Jul 2025 09:32:57 -0700 (PDT) Message-ID: <52775838-303f-429c-bc25-31cf683e8a4d@cs.ucla.edu> Date: Thu, 24 Jul 2025 09:32:57 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <86cy9p63j0.fsf@gnu.org> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <86cy9p63j0.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-07-24 07:56, Eli Zaretskii wrote: >> Not sure what you man by that, but I suspect it wouldn't handle the >> scenario Jim describes, where the other process closes its end of the >> pipe but keeps running. Emacs shouldn't assume that EPIPE means the >> other process has died or has closed any pipes other than the one Emacs >> got EPIPE on. > I guess I'm confused: if the other process closed its end of the pipe, > why do we care about the stuff we have in our buffers that wasn't yet > piped to that other process? I could well be the confused one, but the scenario I was concerned about is when we are running the process for some reason other than the fact that we are piping to it. For example, we have another pipe to the same process. In that case we shouldn't deactivate the entire process (i.e., turn off all output and input for it) merely because one of its pipes closed. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 12:47:50 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 16:47:50 +0000 Received: from localhost ([127.0.0.1]:58004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uez6k-0002Qc-7w for submit@debbugs.gnu.org; Thu, 24 Jul 2025 12:47:50 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:54772) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uez6h-0002QK-9D for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 12:47:48 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-23dea2e01e4so15920465ad.1 for <79079@debbugs.gnu.org>; Thu, 24 Jul 2025 09:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753375661; x=1753980461; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=B0WUqShwQnffKK3L2i1fyYtwuwMJkk0DxXV0/YbmFxY=; b=i/9bkCo5+l/fLoLY3pE31x7sqPjuNx3pB8Yv9QpR1RRpdVVNShvg8SLfiG0bxiPXnZ NSYyUe79oBU5JqK60ZVB86Cyvl4e8ggG7ppOb+u/T5tteFyrfRJTOCXO6dUN3K3GxMUu gu6RqaZ+L/NpmrLl4/8qShNY13IUaQNeEu7ZOiZEGnD2yjJvioEDPQqV/JVSN6cUdgj4 o1jD/J/PnijP1Mlv5Sw1VA/GbfZ1rxMpLBlkw4Q3J2uBGP7tnSKkbdffCgHoAhP1V9Vk BHAkt3saHK7TabGAtTGuxxsYYYRbQCfTljrRfFjzud+rqaSk5qktZ3pF/wnhsU5Tu62r lAJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753375661; x=1753980461; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=B0WUqShwQnffKK3L2i1fyYtwuwMJkk0DxXV0/Yb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p-Source: AGHT+IF4iLn2NsuCsnN26mAxU5Mrp4R4PDJNeMdQEmvNe0wKFOdw5KA7u/spUZVILwXptIApTEkv3g== X-Received: by 2002:a17:902:e943:b0:235:ec11:f0ee with SMTP id d9443c01a7336-23f9814207bmr98484715ad.14.1753375660834; Thu, 24 Jul 2025 09:47:40 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-23fa48f0616sm19305855ad.159.2025.07.24.09.47.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jul 2025 09:47:40 -0700 (PDT) Message-ID: <00b54c14-a767-c2ff-cc97-a4478b32ebfb@gmail.com> Date: Thu, 24 Jul 2025 09:47:41 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii , Paul Eggert References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <86cy9p63j0.fsf@gnu.org> From: Jim Porter In-Reply-To: <86cy9p63j0.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/24/2025 7:56 AM, Eli Zaretskii wrote: >> From: Paul Eggert >> >> Not sure what you man by that, but I suspect it wouldn't handle the >> scenario Jim describes, where the other process closes its end of the >> pipe but keeps running. Emacs shouldn't assume that EPIPE means the >> other process has died or has closed any pipes other than the one Emacs >> got EPIPE on. > > I guess I'm confused: if the other process closed its end of the pipe, > why do we care about the stuff we have in our buffers that wasn't yet > piped to that other process? We could have a situation where a process closes stdin, but we still haven't read everything (or flushed our buffers) for that process's stdout. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 13:05:58 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 17:05:58 +0000 Received: from localhost ([127.0.0.1]:58072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uezOI-0003gQ-0w for submit@debbugs.gnu.org; Thu, 24 Jul 2025 13:05:58 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:51497) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uezOF-0003gA-R6 for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 13:05:56 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-234f17910d8so11345025ad.3 for <79079@debbugs.gnu.org>; Thu, 24 Jul 2025 10:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753376750; x=1753981550; darn=debbugs.gnu.org; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=U7xLHS29Vu0y6kqXcaMDvvzr+Lbwi1Z+1E5ScBNjoRw=; b=eXdG5lJk3P1tvc780qEU7ZUp1gVw3BTxa5ct9pO3ugX2iWEesZWwJMKUz9Q6Hu2+oc Kp3/47qCTZhaZRdnzM6ucXPIgVVIGjGSwnCM9QNCMwuwLmao7TBCNpqnfNdIKXvgTXWu Wy4JxIDJwjVP5wHA0ebS+IcxAC8vFMtat3gVFUVokY8bZrO5bEjAjmnp+hbdI6rPIqmu eSN3Sl/JRplBGCmspWrVXR+UKiIu1CgxhNHbWClyA4qX3IFcoN/ixexOi2hvUZl+pMMA DcO6+zQmI00afJYTHu4g15l2BjIlaAi/j5C52rtN7gHpKntJPKTFXNh4Iy1ePTknbIP5 kdgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753376750; x=1753981550; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=U7xLHS29Vu0y6kqXcaMDvvzr+Lbwi1Z+1E5ScBNjoRw=; b=vENPJL1VXlwMkFDjfJWjL6fs4M9eFzrD75kM+A6D2tP3BldJYWzYe9wfBSTTA1fWkK cGgUTqP/u0JJSDdRSH6UxvSg3wtb2nwIyDFna9ZSmXhbrbyG7SGO9bOq2u+Xrir7DDMR Dq1PLiMtKaMl2EZY+tPpPIfLfI4Ww4NgNq1YSmtTH9E8oRoROJ8FiHWkQRTCQGT8Uv9W +Vb4XQVNOcLjUDsURAZNjDHMjmgzOsdg2MzLbf7AX/O3/UxZwqYbRQpXS7phK1egtPG2 Pt/PZBh4isAElI9dgqJFifzyJlzdCOVUxo2+9nuZYhGe1MqvWccmnkijjkvUVoNydJK7 NJfA== X-Forwarded-Encrypted: i=1; AJvYcCVVjtY+cREBFPkgt9exuOFekQsnhEMnRbyEh+RjUvcIGpu6BJzsxrQtbZdRJmG9KcPYlyl+7g==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzyHOtKPllyDFtr3wAqXA4pTKXxKYgDXXr3t5HUSysM68OWf/7P dhwcrtXbZRJ+Mf0oAIJ8HLWinD+N526X0edtOY1qS5tuGLjHF0wYIRAT X-Gm-Gg: ASbGnct79ZetWapqVj4g4rl7atpGVFeypg2u2m2hu/QAgUH/houkTInVCi+tawEuI8a mlRV0H56kiT93TyBcYtBAk85FHHzT1Kr9wd5FsTAeP9yxgTVImA6jzeBCItwyfr8W1xUH06MtZH 5Fu59OlezD9k8LYJPT/vR+tDemM6Qd9kZwlu5EFuUrOd/xmrwhf8IwFV/G8yHawZRpyQsOUMzOW YM+nMzqrWNYMW3LtaWNCBpE7y+qVFykwbuTeQkyC3XU1j2AhDxEdNhwGwB/wTjj5DrZtPGgw42y aJlYEx9LWJfuUVKPzcrce4Lrcp6bqHIo6XWITPTQH1/hemppNjqYyVxuEWDOZaiGzF7TE+CVGBk tIMunWTyieG8cYKoU25tCOkf3W5EPXv/fKLWXJswxU/4XXzgzdOH8BVtZt+FaU60vi1/hmqOU6l qMxrjX8l8r0icg X-Google-Smtp-Source: AGHT+IGAiFsceMHoL2Ua4N9CaJJKjaFJpLQ4L0HFi9FyuRt++WalB8WVWjPS1fVkscuEyR+3iXQYcw== X-Received: by 2002:a17:903:298c:b0:23e:3bdf:e3bd with SMTP id d9443c01a7336-23f9819fea6mr131196645ad.22.1753376749572; Thu, 24 Jul 2025 10:05:49 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-23fa48dbfccsm19784655ad.138.2025.07.24.10.05.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jul 2025 10:05:48 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------2iLZLqIsWPUC81bBXeoxQtTo" Message-ID: Date: Thu, 24 Jul 2025 10:05:50 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Paul Eggert , Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> From: Jim Porter In-Reply-To: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------2iLZLqIsWPUC81bBXeoxQtTo Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/24/2025 6:52 AM, Paul Eggert wrote: > On 2025-07-23 22:34, Eli Zaretskii wrote: >>> Date: Wed, 23 Jul 2025 11:06:24 -0700 >>> From: Jim Porter > >>> In process.c, >>> when we write to a process, we handle EPIPE errors by calling >>> 'deactivate_process'. However, that can lead to us dropping any data >>> written*by* that process, since we don't call the process's filter >>> function for any remaining output still in our internal buffer. >>> >>> I think in this case, we'd just want to let the rest of our code handle >>> deactivating the process in the usual way. That helps fix this bug, plus >>> I think it makes sense in general. If a process closes stdin, I believe >>> we'd get the EPIPE error, but that process might want to continue >>> working (though it does mean that you could only interact with that >>> process via signaling it). > > Yes, that makes sense. Thanks for checking. Then I think the attached diff would be close to what we want, with a few caveats. (The original diff was just the smallest change that seemed to fix the problem so that Daniel could try it out.) This diff changes things so that when we get an EPIPE, we close our end of the pipe (the 'WRITE_TO_SUBPROCESS' fd). I don't know if we need to do anything special for PTYs or sockets though. On the Eshell side then, we previously detected EPIPE by checking whether the process had been deactivated. Since that doesn't happen anymore, I changed it so that we always treat an error from 'process-send-string' as though the pipe broke. In practice, this just means that Eshell will think that all future calls to 'process-send-string' would fail too (and so it will send a SIGPIPE signal to the sending process; "git" in the original test case). I'm not totally sure that's right though. Could there be a time when we get an error from 'process-send-string', but we can try calling it again later? --------------2iLZLqIsWPUC81bBXeoxQtTo Content-Type: text/plain; charset=UTF-8; name="epipe.diff" Content-Disposition: attachment; filename="epipe.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3AvZXNoZWxsL2VzaC1pby5lbCBiL2xpc3AvZXNoZWxsL2VzaC1p by5lbAppbmRleCAxMWVmYjQyODc5OS4uOWNjNmE4MzdiMzAgMTAwNjQ0Ci0tLSBhL2xpc3Av ZXNoZWxsL2VzaC1pby5l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hpdCwg bWFrZV9maXhudW0gKDI1NikpKTsKLQkJICBwLT50aWNrID0gKytwcm9jZXNzX3RpY2s7Ci0J CSAgZGVhY3RpdmF0ZV9wcm9jZXNzIChwcm9jKTsKKwkJICAvKiBGSVhNRTogSGFuZGxlIFBU WSB0b28/ICBXaGF0IGFib3V0IHNvY2tldHM/ICBBbmQKKwkJICAgICByZW1vdmUgdGhpcyBk ZWJ1ZyBzdGF0ZW1lbnQuICAqLworCQkgIEFVVE9fU1RSSU5HIChmb3JtYXQsICJbZGVidWdd IEVQSVBFOiAlUyIpOworCQkgIENBTExOIChGbWVzc2FnZSwgZm9ybWF0LCBwLT5uYW1lKTsK KworCQkgIGNsb3NlX3Byb2Nlc3NfZmQoJnAtPm9wZW5fZmRbV1JJVEVfVE9fU1VCUFJPQ0VT U10pOworCQkgIHAtPm91dGZkID0gLTE7CiAJCSAgZXJyb3IgKCJQcm9jZXNzICVzIG5vIGxv bmdlciBjb25uZWN0ZWQgdG8gcGlwZTsgY2xvc2VkIGl0IiwKIAkJCSBTREFUQSAocC0+bmFt ZSkpOwogCQl9Cg== --------------2iLZLqIsWPUC81bBXeoxQtTo-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 14:50:38 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 18:50:39 +0000 Received: from localhost ([127.0.0.1]:58436 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uf11a-0002MP-Jt for submit@debbugs.gnu.org; Thu, 24 Jul 2025 14:50:38 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:49468) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uf11X-0002MA-W4 for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 14:50:36 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 1EF4B3C010841; Thu, 24 Jul 2025 11:50:30 -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 etccXVa_FtUa; Thu, 24 Jul 2025 11:50:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id EADD13C01084E; Thu, 24 Jul 2025 11:50:29 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu EADD13C01084E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753383030; bh=5NP0jfxxRgL2ycvPQMjXIVbOKUiwr/VlIEDckG9yz1k=; h=Message-ID:Date:MIME-Version:To:From; b=C5AXcscKFZF6jpJdKo6MgZK4blM4RxIYZ512vRHfhqgxlbeyT5h8hoeH57fG96qNZ UFYGcGKcXuM+JdNhQaSddl2qV8khW4H0WDwP44SeExa/NpJcSU2ZFEAiQot9HmfUV3 Gkg6itkPYzUrSEhvGPHy/LB5nrYJbaSyKpCITFLiWtTZKxHluruGwkDRs9t58u5Qye OnLdELh3m7yptgPQqgB2mykkQ+JuZa8ml/NmgerjKxboYa3rc90zK4tahPrFHLN1P+ If0moW+mR6dt5PLuNe4ldKbW71Al/jut48flhma6saLdIsyzSf67VdqapZobBw2H2T 1Ag5u68Sb3thA== 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 tRD6K7EyeCmX; Thu, 24 Jul 2025 11:50:29 -0700 (PDT) Received: from penguin.cs.ucla.edu (unknown [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id CBDEC3C010841; Thu, 24 Jul 2025 11:50:29 -0700 (PDT) Message-ID: <5673863a-5825-4fa9-b428-62872978eb81@cs.ucla.edu> Date: Thu, 24 Jul 2025 11:50:29 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell To: Jim Porter , Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-07-24 10:05, Jim Porter wrote: > Could there be a time when we get an error from 'process-send-string', > but we can try calling it again later? Not if it's an EPIPE failure. EPIPE means the connection is permanently down. I don't offhand know of any failure for writing to a pipe where retrying would make sense, other than EAGAIN and EWOULDBLOCK which the code is already dealing with. Can process-send-string write to other file types? If so, there are other possibilities where retrying might work, e.g., ENOSPC for write to a regular file, ENETDOWN for sendto to a network socket. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 24 15:06:27 2025 Received: (at 79079) by debbugs.gnu.org; 24 Jul 2025 19:06:27 +0000 Received: from localhost ([127.0.0.1]:58489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uf1Gs-0003PZ-T8 for submit@debbugs.gnu.org; Thu, 24 Jul 2025 15:06:27 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:46520) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uf1Gq-0003PF-Fg for 79079@debbugs.gnu.org; Thu, 24 Jul 2025 15:06:25 -0400 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-31332cff2d5so1355567a91.1 for <79079@debbugs.gnu.org>; Thu, 24 Jul 2025 12:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753383978; x=1753988778; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=I0kGz93840N3we4+qGD2XexCZr+L0kC51gS5BgOeEko=; b=kvqsOuOch5Ci/01ADCvMlelbljRwUcaW0hSuGDmnxoRBoTO8k8sYhRo41WNvjZoF2Y O9MSjtq+vLhCmQXj//i5MUMvL/cps84eWFOoe5Qz+kKqVfk4HPXm+Q7+FOZvr5OL4WMn vd23kLJHmmEhUssxW8ZD3dcnXhv1IqdAzzni0N0NVWQ/hLnEFXH+V+rcrowgk4EvezCh AOF4mvpyrI8bLkbbI7d5N3u7O9SJoXo9iJgR7sjO3BtKh4vYAOQHCqwtklD1a31SAa4/ W2NUf6az6+J7BA3E7e0rBZHYQglK4lmKRgk9qaN/fZoRO8XGCxn/0RtgRFS+PmOX6kn3 VcvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753383978; x=1753988778; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=I0kGz93840N3we4+qGD2XexCZr+L0kC51gS5BgOeEko=; b=LRtPtsoLS/nZGUf0sJEZrQYDMAZLNcef8Py4y2+KcH2x1Alkl4Q9tabA5KMPeKKPtC fvkfTV2NSxG0EhVlOWWR/iuLzv9b6Xp9GaQSw8ZY0pGTKvKGqevk/2p1PJ++1rB/apnu zQd2kRyN4NDuU7rF1Ara2ikpWnD0n0089RSuhBdb2DBMGRQ7fIpztE85mYUTpayU4xqs RXxcxp/6UzTN/i7VRhPLnM2QUhupAX3RitLzBE+TbEhnzIgbST3JgWpV47ztfpXpZk+x wTsKGZfGsh3Ye2qAKBnFg1o1ClAyrzX0UFp74ZeXgaJlT1WpFlEniDS9Spk6X5TsFKPZ DmyQ== X-Forwarded-Encrypted: i=1; AJvYcCWQbOT7jOzcH1MyMvizo5i876Nfpj5RLmVasnnh95EXkQH1PJy0unHgMOjZdpNM5QpCkJxUXw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyLhciW/HdMMY3DndbgcvJTmvXBCahvJsmdCY1ukc5DKEPeHX6H PFRGH3lmLocadKk77QXMzZOQUlt5fUurD/WDpVQlUR6kvQvyjlZrLwDX X-Gm-Gg: ASbGncu089j+Bfejh6wbMaCg0yHqIGn7NCGidgCm5h8B35qlBxk2gMnqAYtOZ9wijK5 g2m8O3yyHb2fhHfGOkZX+uWMgtfJXq9Knig/fxlNjkaOd9O1xizQgpX6Oc5i2TZVEH4ERx7fuJe KhIx04Wz2x0BeTTOCy7KK8S6Oe7w6Vba+U1grVJAPE76Z+KZaN54Ep22IcQC3HiDdRAj0sxftWm +/C9r6uiMk9t+QnKI77nt6N+uq3QdVQdeM1XOekR4NqGXGhU4df8BMwXdlLX354xe9rgwmFzjCF EmrR/FfuRrsRPirnVLef/ra5knvmSfvafBUhJEqrsCzo3eBdGAtEgO3qhgDkcgES76wtfiDfPX8 FTs6xA5PE1BKyAh63sVph+KgbyDWaGSKfZGOFyS1HM2Gb2A+3EhXE5vZ2hLFB+TRd3AE3lzZ1Dr ke7g== X-Google-Smtp-Source: AGHT+IGWbuCEs1Scy/mOp7k5gH3JK3MExSEu8t1RRj0zRkIXJEYUgT6ITAGQaXdJp6L4RwtgrOYnyg== X-Received: by 2002:a17:90b:2709:b0:311:b0d3:865 with SMTP id 98e67ed59e1d1-31e507fe806mr9681690a91.32.1753383977836; Thu, 24 Jul 2025 12:06:17 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-31e66269935sm1922068a91.8.2025.07.24.12.06.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jul 2025 12:06:17 -0700 (PDT) Message-ID: Date: Thu, 24 Jul 2025 12:06:16 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Paul Eggert , Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <5673863a-5825-4fa9-b428-62872978eb81@cs.ucla.edu> From: Jim Porter In-Reply-To: <5673863a-5825-4fa9-b428-62872978eb81@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/24/2025 11:50 AM, Paul Eggert wrote: > On 2025-07-24 10:05, Jim Porter wrote: >> Could there be a time when we get an error from 'process-send-string', >> but we can try calling it again later? > > Not if it's an EPIPE failure. EPIPE means the connection is permanently > down. Right. I was just wondering if there might be some use in signaling different types of errors in send_process; one for transient errors (if there are any we care about), and one for permanent errors (which look to be most/all of them). > I don't offhand know of any failure for writing to a pipe where retrying > would make sense, other than EAGAIN and EWOULDBLOCK which the code is > already dealing with. > > Can process-send-string write to other file types? If so, there are > other possibilities where retrying might work, e.g., ENOSPC for write to > a regular file, ENETDOWN for sendto to a network socket. For Eshell, we only support writing to regular processes, though I suppose with enough effort you could probably construct an Eshell command that writes to a socket. Of course, for something like ENETDOWN, Eshell would probably need some special handling to retry sending the same data again, instead of just skipping over it. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 02:42:18 2025 Received: (at 79079) by debbugs.gnu.org; 25 Jul 2025 06:42:18 +0000 Received: from localhost ([127.0.0.1]:60664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufC8I-0008TB-9B for submit@debbugs.gnu.org; Fri, 25 Jul 2025 02:42:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51024) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufC8D-0008Sd-7m for 79079@debbugs.gnu.org; Fri, 25 Jul 2025 02:42:15 -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 ) id 1ufC86-0004BB-6a; Fri, 25 Jul 2025 02:42:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=EVPPsW+HIIpieqcl9xJ55ZqDRMjKSa5zQz9tPxSdnN0=; b=eDGZNpzqqaza mZO9TF6XKafjkGjNP7o0ZumH93b4pNG8dRpbNstcim+8hG8TQqsgBmYW1dX3Dr7c46hAJtanXyQuM pJM29kz6/TcAUaNJUJy+O5IXqwjHlgyyK8YE1tbhgCJ79oaMlRxMAVYFhkzMOdRIPMDMoi3faB8R4 zJLhxCJ1W1E8NvzlLqfrIJKTwm4CbuF2ExmmVbxFkQoTeroXxYA8mn3vVakDgYgmfzv90jGk2000N 8UoXSzFoz1H+Muh1BHUmh6ZW8A9XQRAfmQfkNDtFuPFarlVxEYRmOHQfdbSRvpxqZaqef9KEImy3V 7XP8aZBXhVUf2n7/uD0Jzg==; Date: Fri, 25 Jul 2025 09:42:02 +0300 Message-Id: <868qkc6abp.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: (message from Jim Porter on Thu, 24 Jul 2025 10:05:50 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 24 Jul 2025 10:05:50 -0700 > Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org > From: Jim Porter > > --- a/src/process.c > +++ b/src/process.c > @@ -6873,10 +6873,13 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, > } > else if (errno == EPIPE) > { > - p->raw_status_new = 0; > - pset_status (p, list2 (Qexit, make_fixnum (256))); > - p->tick = ++process_tick; > - deactivate_process (proc); > + /* FIXME: Handle PTY too? What about sockets? And > + remove this debug statement. */ > + AUTO_STRING (format, "[debug] EPIPE: %S"); > + CALLN (Fmessage, format, p->name); > + > + close_process_fd(&p->open_fd[WRITE_TO_SUBPROCESS]); > + p->outfd = -1; > error ("Process %s no longer connected to pipe; closed it", > SDATA (p->name)); > } Why do we need to emit a message about EPIPE, when we will immediately signal an error with the same information? The message will not be seen by users except if they look in *Messages*. From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 25 13:16:31 2025 Received: (at 79079) by debbugs.gnu.org; 25 Jul 2025 17:16:31 +0000 Received: from localhost ([127.0.0.1]:35841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufM22-0007HJ-Vz for submit@debbugs.gnu.org; Fri, 25 Jul 2025 13:16:31 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:61785) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ufM1w-0007Gk-MV for 79079@debbugs.gnu.org; Fri, 25 Jul 2025 13:16:29 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-b3bcb168fd5so2311241a12.3 for <79079@debbugs.gnu.org>; Fri, 25 Jul 2025 10:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753463779; x=1754068579; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=Fd5X46XuYtvFyV6BxztWT9VVImU3UOYe6oohxrumNGI=; b=HJRAFZdAetxlE8gPYc1wdQkUUvvxvwmqFlcXmUmpLpvsJgQf1oR4fde1CnqFa9/y8g 40pvq4FWD+ftTsXCCm9eOSm0N9Ssws+2dS5yf9lguMUczjb1/PWfFRUMXsLhi+MPVYxg 2hoWG/LfSISfQ7VHygy954kEbAMSFCHUq/auKVHAkwgdKNxTUmU3nUOKg/ZmgZiBGb/+ G6o0URM+A5UKa19anaTRzFkOi96O0jwmvLT5w9shc2sqvzODgk1dC7EgZnp7ywQojaER AWMgWFVYx15MROlZL2EyFg05ZBHu5wugKLg4ZSUGP2ZJ9VqYjw2moFbZ1FS7dRofwYCz EoCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753463779; x=1754068579; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F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9Wk12hFr 02cw== X-Google-Smtp-Source: AGHT+IEhfdL985VCm9m/7/INSUmkncoX86FYE4+dx2FXb/OBnHalUGW0bj1byhOW47Zb2jZgVvaWZA== X-Received: by 2002:a17:902:fc8f:b0:23d:dcba:a467 with SMTP id d9443c01a7336-23fb3051091mr44463125ad.4.1753463778485; Fri, 25 Jul 2025 10:16:18 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-23fbe30ae0bsm1691795ad.18.2025.07.25.10.16.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Jul 2025 10:16:18 -0700 (PDT) Message-ID: <28e961c2-9a5c-4e9d-bb14-0ff30cb042ef@gmail.com> Date: Fri, 25 Jul 2025 10:16:19 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <868qkc6abp.fsf@gnu.org> From: Jim Porter In-Reply-To: <868qkc6abp.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/24/2025 11:42 PM, Eli Zaretskii wrote: > Why do we need to emit a message about EPIPE, when we will immediately > signal an error with the same information? The message will not be > seen by users except if they look in *Messages*. It's just a debug statement for development/testing so that it's clear when Emacs runs this block. Since this is a timing-related issue, it's hard to guarantee that we hit this condition. While I'm working on this, I can then check *Messages* to be sure my new code ran and did the right thing. I'll remove the Fmessage call before merging. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 26 06:15:48 2025 Received: (at 79079) by debbugs.gnu.org; 26 Jul 2025 10:15:48 +0000 Received: from localhost ([127.0.0.1]:40210 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufbwR-0000lF-9M for submit@debbugs.gnu.org; Sat, 26 Jul 2025 06:15:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55500) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufbwO-0000S5-DT for 79079@debbugs.gnu.org; Sat, 26 Jul 2025 06:15:45 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ufbwG-0000fg-T3; Sat, 26 Jul 2025 06:15:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=KV7fWo2Lt6PX9PHY7tUrX5N+HKpCJQcyD7RLZR/lRww=; b=YHB+FVCQjEZY z19NStkpxd/WtKvDjCFkHgptdj7n4U3Eva1sLoZTbeJ9a5JfcT6/e4c/qYvdlXetMblp55uyE97Xg t/gWiL23eSUKrCx1DXGiKOYMXhIkstWG9JnjITFnqJla9njbpGKC3732/YFWYVreulOn3bhgH0xoS R9jEFUpAuCOHTpYfJpbG5gKIrbRwMgenVnEPIeXQBujiFaYFtpJ2hrJkMO5akywQN89+CkJWevbZ0 W5V6CnwGLCfbfSe69RaSqeoe212MLpyroq6xQYFORAzSK2aRW2GLV5raXUGGoGB1LHuS+MCELoZSM 0F/Nv1c/qNgGW9O83Prvbw==; Date: Sat, 26 Jul 2025 13:15:21 +0300 Message-Id: <864iuz1cna.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> (message from Jim Porter on Thu, 24 Jul 2025 08:52:16 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 24 Jul 2025 08:52:16 -0700 > Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org > From: Jim Porter > > On 7/23/2025 10:34 PM, Eli Zaretskii wrote: > > What about calling the filter with the data we still have? Isn't that > > what a Posix shell would do -- flush any buffers? > > > > And why do we get EPIPE in the recipe in this bug, anyway? I'd like > > to understand better at least one situation where we get EPIPE while > > the data received before that still matters. > > In the recipe, we pipe "git log" to "head -n 10", where Eshell handles > the actual piping. (I don't think Eshell's presence here is actually > necessary to see this bug, though it's probably the simplest way to > reproduce it in Emacs.) > > "git log" produces a bunch of output that gets sent to Eshell's process > filter. That filter eventually calls 'process-send-string' on the "head" > process, forwarding all of git's stdout to head's stdin. Immediately > after that, head sees that it's already gotten 10 lines of input, so it > exits. "git log" doesn't know that yet, so it sends another batch of > text to Eshell's process filter, which again gets passed to > 'process-send-string'. This time around though, the pipe to head's stdin > has been closed, so we get an EPIPE. Currently, Emacs deactivates the > head process, but because of how the timings worked out, all this > happens *before* Eshell's process filter for head ever runs. As a > result, Emacs never see the output that head produced. So calling the filter of the "head"s process when we get EPIPE should fix that, no? From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 26 13:23:57 2025 Received: (at 79079) by debbugs.gnu.org; 26 Jul 2025 17:23:57 +0000 Received: from localhost ([127.0.0.1]:44671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uficn-0001Za-B0 for submit@debbugs.gnu.org; Sat, 26 Jul 2025 13:23:57 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:49505) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ufick-0001Yz-3Q for 79079@debbugs.gnu.org; Sat, 26 Jul 2025 13:23:54 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-23fd91f2f8bso3273045ad.3 for <79079@debbugs.gnu.org>; Sat, 26 Jul 2025 10:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753550628; x=1754155428; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=whW7eBl121btmFl8Se+6ZRpMLS4bBnj3CHK/HEgFmgU=; b=PeLCa2xtboiLfs2nvHGgqY8eCohMiB9xfApNvLEQyT5Qo/5KuGbDTVaLs73dyxND3j wEzozkvxzSxx8Xboga2BuRha6Q/usdTL2e1SsAyg+QJSpP1Pk16QF8b0LweD3LOJ1uAt TYLsQM9N1cxgFFYXCzAm81x0vKzjIOD0y3GwcjG9zb7JAnI8yZjcqRY+0UhzwFg+WKmB NvohzheO500pSv4n2+Ue66BgnpSkOjmG8GPufhjYmILv+0cJdoHQx3sTusEVcfcUkFAG FeGGFZOdwMyaFYzzaJO/krmLPZIllqKY/Jzo2KoCcZHuoFsSuhA6BRUQrQ6U9+jfyjRW pL7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753550628; x=1754155428; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=whW7eBl121btmFl8Se+6ZRpMLS4bBnj3CHK/HEgFmgU=; b=ULotG9U7MnYuMC8dxrkyT+TGXPFljhzNR4IWLnigmQofEu6Ou7rci3rcdA5oJzCtV3 idpCvuSL+a7x+gKYeUJwo6EVx09u6WfaDii161t1aNwSv6b32mgCXSmxha4W3hUjoCUU gFx4Cg/5dxQ8IwWQ/Mv7eEvcR1Z7gmgCs09BkgDOK40BKCCP2I2Iw80zQ6PcYVQJZl8n FZLrTdtFXtMwvFUkNOB+kcFkqWSebvHo3LTRkanWnD1wAR0uE+BxQK/YdZfDSoa+Ph7T MxpMF/kKYfAN1Srv5AlMg5p+kpX0Fb5WHim1YcNjbE7QrOEBpZftTeS8BLWA2nIylzH9 ekdw== X-Forwarded-Encrypted: i=1; AJvYcCVUL3wnvzmEzkpIVLTIM96uM9Cwaga1U0Cu9iDIxxPxV6hrirfjoogbn+EReQ06lF9sCR8kPw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyTDhpwysetwzaOL0/ZQkfYaJqEnkPbeGahP00PJQcrPqPPkhDk OJEIrozsLR3V/y5Q5IN4dz3Xtg+s3CrX7Sdw/H8H/iBnm4AHp2bkXRZB X-Gm-Gg: ASbGnctYwQYAG+oQbr6HILy88tJ8biCYgGbViDzwKfmdcBpSPBGLKvPbC2Te+CNZCqi mntRGEsMfMzkxh+tPW+2aJzgGnjlW+w83PDzPvFE9YoRPn6vQ0t1usB/lNGg+Wm29WxYxrXT1PZ hFzSQDekSfI2BT910+uLFRm1wgPBdODl/I4Vp1ubAN5ziBWxY04+bAVdkXniTO3ylGKUXMOb5uI PMx+/QgCZWi8jvrZS/kZ3c9nPLHG0lx46SJ10ElDGhtxSMHKdPaIUDcfKgQzxgoOpiLNxF3KoMY zZqe3EoGN8/J+Ga/pFSXc3Pptt+NzEq/ESbZXUFhtFuBwW1KNsj0M3xd5/WZw7l3ZsEgw7VZIJn /TVT675ArNUHpIvdAMls53ahHLTaGqhYjsprKuREpWkDh78gInPKnoyJ4hes4K/Q5DeYCAeDsCP OzBg== X-Google-Smtp-Source: AGHT+IE2Qnt/VF5NpzmimYzqNyIe40Y9skeP0L5RQk+oE+f8HHwHSXW+LotZV53+X5Nr5SUfZKLBEQ== X-Received: by 2002:a17:903:1212:b0:220:c164:6ee1 with SMTP id d9443c01a7336-23fb3145e12mr110731265ad.32.1753550627607; Sat, 26 Jul 2025 10:23:47 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-23fe5dd5a28sm9176305ad.201.2025.07.26.10.23.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Jul 2025 10:23:47 -0700 (PDT) Message-ID: <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> Date: Sat, 26 Jul 2025 10:23:48 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> From: Jim Porter In-Reply-To: <864iuz1cna.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/26/2025 3:15 AM, Eli Zaretskii wrote: >> Date: Thu, 24 Jul 2025 08:52:16 -0700 >> Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org >> From: Jim Porter >> > So calling the filter of the "head"s process when we get EPIPE should > fix that, no? It would probably fix this particular case, but I'm not sure it's the correct way to do it in general. I'll construct some test programs to test out some of the corner cases here so that we can be sure whatever implementation we do settle on works correctly in all cases. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 26 17:13:13 2025 Received: (at 79079) by debbugs.gnu.org; 26 Jul 2025 21:13:13 +0000 Received: from localhost ([127.0.0.1]:45548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufmCe-00062u-AD for submit@debbugs.gnu.org; Sat, 26 Jul 2025 17:13:13 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:48513) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ufmCa-000623-18 for 79079@debbugs.gnu.org; Sat, 26 Jul 2025 17:13:10 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-748e378ba4fso4101445b3a.1 for <79079@debbugs.gnu.org>; Sat, 26 Jul 2025 14:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753564382; x=1754169182; darn=debbugs.gnu.org; h=in-reply-to:references:cc:to:from:content-language:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=HNJIda9aIwb8FM1yAox8H0LpSeDYn0iWt1ukJEewzaA=; b=kd9DBXAAI2FRLG+38HvjHvRcmCHIEvymPRpXGfzoycuBDdHrecjRpW508dBs0qqHqe Tmk38XiplDM6HbgJrV3V9/MaT5wfSTr0s9MpaCPBiOJUhEX4vvvUlwUymw/9tVgID20r ZSOBOZmfLDI1nUNobjN3K7ECO0IwskcsvmOFm5I3YRIFL6fljvslAJcXiPCCMKznDLDZ U+jrZcReAmqAfq8N68pNYQZMDGbwX2XNQNs3sW7tt9YeODZMySiAeMuVFpRUqFeIaPmi l+WBtlJKxJj0DegGFzzktN27KjwYSLgB/nQpwIfm8WDWv2GyaPxd/lhK1wcMML1Utdur iHOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753564382; x=1754169182; h=in-reply-to:references:cc:to:from:content-language:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=HNJIda9aIwb8FM1yAox8H0LpSeDYn0iWt1ukJEewzaA=; b=muSy1xbHDDLmg2if3wWgTJBoKsQqNuBbPLJnVZyyRSfJjS8rRgvjk+3L9vKDLc3PoM 8nQrkCzi4VTsUuYadoVxFW6zyfFFXYSbyoitOu6gy6J6SDVfDEZMcIKaNCjwwJT4Ncob idvU362lbCV1FZGynPfcSg2yUSL/NpVZ+RbmGiimJHi80Nnd0ovWrmwiDkc5iWqtYuoL 5SP4ZT8Eff9efZRgDnL00L2nFw9MyxuwpArLlXRSlrNR+JJUelaiUEUthKa6yqn3PaHI sF8/ALbPNSk36sm0rdMoNEWxWMXeb0Xk9noQrb3L1rrKTb333znvoFzJJsUDL5v6LbV+ Wirw== X-Forwarded-Encrypted: i=1; AJvYcCWVa6A9wueSMS/bswg/T4bHATZbyCJQKDIRIedYtbFHyp7tNoDxiHm6kd1HLIR7YFzJyEBbCA==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yxm+zCR5Gf0mE1+N7xLv3jcQzE82iZ0T6gIay1hSecj6pePmKTL pHfCd5CM3qNYGFWO533dY6PaNG+/z8iVL/yaNwp6JTJfrvU6tfkA3NcA X-Gm-Gg: ASbGncuSPemxlvpprw0ddaREA1Kd9YNi4XDbsd8+x32sgDoiZyL8cIlKCieMAPFVQgw bGD1Tm0EiqraK/41LXa/PWg2OkSP/HxjZ44F7Fn1J62dJuYT1nmMqSIUU/kkJq3zdudjUYCsAA7 3ildovMVwlf5S6byhJmTaobkEmJgy3Kb+xTG+BMGZpUKPwUWnhl7PwdrvjBWbgLDg/F+vT9fFGV KGdZieeuw2VNaTZA5yefTXIyiR61xs6ARfs8KxPhK4+1CM78RkYWRV4aZ28YFCCsyy79T8E95ZO k6zGUPqSZDwV0J7PvGl3Ne0Z1GbnxxtY+HV4/06pkhnWpxHUSAGjWf5dA0oPdrj9XamVOMkjBx2 t8DzBg/HNyNY9okcJB03WB6AJA2w8EMXBwNqYsQiloqmZpKt3dF841/hkGRKcLsj+aZQNnfsomB U53wKgqWwZWaes X-Google-Smtp-Source: AGHT+IHBK4OJrxZNAGPqqymZ0jCURXbka3TRKC2XlJZ7A//fPp9CxbUE37iwWbhnUIvIRvIjtFMx6Q== X-Received: by 2002:a05:6a21:6456:b0:23d:7abf:9de4 with SMTP id adf61e73a8af0-23d7abfc9f6mr5844974637.42.1753564381566; Sat, 26 Jul 2025 14:13:01 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-b3f7f6d3f3csm2077455a12.61.2025.07.26.14.13.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Jul 2025 14:13:00 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------gpkx6AkSxamqky4MpBG0rJ5N" Message-ID: <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> Date: Sat, 26 Jul 2025 14:12:59 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US From: Jim Porter To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> In-Reply-To: <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------gpkx6AkSxamqky4MpBG0rJ5N Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/26/2025 10:23 AM, Jim Porter wrote: > On 7/26/2025 3:15 AM, Eli Zaretskii wrote: >>> Date: Thu, 24 Jul 2025 08:52:16 -0700 >>> Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org >>> From: Jim Porter >>> >> So calling the filter of the "head"s process when we get EPIPE should >> fix that, no? > > It would probably fix this particular case, but I'm not sure it's the > correct way to do it in general. I'll construct some test programs to > test out some of the corner cases here so that we can be sure whatever > implementation we do settle on works correctly in all cases. After examining this more closely, there are three problems with the current Emacs code, of varying importance: 1. When we receive an EPIPE, we don't call our process-filter one last time (this is the original bug report). You can see this by running the following Eshell command repeatedly until it produces no output: git log | head -n 10 | cat 2. When we receive an EPIPE, we set the exit status to 256; that's not right, since the exit status should be 0. You can see this by running the following Eshell command until the prompt shows a non-zero status: git log | head -n 10 > # 3. If the child process closes stdin and wants to keep doing some work (like write to stdout), it can't, since we called 'deactivate_process'. You can see this with the attached script by running (it's supposed to print the first line of "git log"): git log | ./test-script.sh I've also attached two WIP patches for the different implementations. "bad-call-filter.diff" uses 'read_process_output' to call our process filter. It only solves issue #1 above. "good-close-pipe.diff" (which I posted previously) solves all three issues. While the latter is a slightly bigger change and requires some more testing on my end to make sure I've covered 100% of the cases, I think it's the more-correct solution. If we make the bigger change, it's probably worth calling it out in NEWS and on emacs-devel so that people can be on the lookout for any edge cases I haven't identified. --------------gpkx6AkSxamqky4MpBG0rJ5N Content-Type: text/plain; charset=UTF-8; name="bad-call-filter.diff" Content-Disposition: attachment; filename="bad-call-filter.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9wcm9jZXNzLmMgYi9zcmMvcHJvY2Vzcy5jCmluZGV4IGU2MWVj NDI1ZjdlLi4xNTBmMWRmZjFjOSAxMDA2NDQKLS0tIGEvc3JjL3Byb2Nlc3MuYworKysgYi9z cmMvcHJvY2Vzcy5jCkBAIC02ODczLDkgKzY4NzMsMTMgQEAgc2VuZF9wcm9jZXNzIChMaXNw X09iamVjdCBwcm9jLCBjb25zdCBjaGFyICpidWYsIHB0cmRpZmZfdCBsZW4sCiAJCX0KIAkg ICAgICBlbHNlIGlmIChlcnJubyA9PSBFUElQRSkKIAkJeworCQkgIEFVVE9fU1RSSU5HIChm b3JtYXQsICJbZGVidWddIEVQSVBFOiAlUyIpOworCQkgIENBTExOIChGbWVzc2FnZSwgZm9y bWF0LCBwLT5uYW1lKTsKKwogCQkgIHAtPnJhd19zdGF0dXNfbmV3ID0gMDsKIAkJICBwc2V0 X3N0YXR1cyAocCwgbGlzdDIgKFFleGl0LCBtYWtlX2ZpeG51bSAoMjU2KSkpOwogCQkgIHAt PnRpY2sgPSArK3Byb2Nlc3NfdGljazsKKwkJICByZWFkX3Byb2Nlc3Nfb3V0cHV0IChwcm9j LCBwLT5pbmZkKTsKIAkJICBkZWFjdGl2YXRlX3Byb2Nlc3MgKHByb2MpOwogCQkgIGVycm9y ICgiUHJvY2VzcyAlcyBubyBsb25nZXIgY29ubmVjdGVkIHRvIHBpcGU7IGNsb3NlZCBpdCIs CiAJCQkgU0RBVEEgKHAtPm5hbWUpKTsK --------------gpkx6AkSxamqky4MpBG0rJ5N Content-Type: text/plain; charset=UTF-8; name="good-close-pipe.diff" Content-Disposition: attachment; filename="good-close-pipe.diff" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpc3AvZXNoZWxsL2VzaC1pby5lbCBiL2xpc3AvZXNoZWxsL2VzaC1p by5lbAppbmRleCAxMWVmYjQyODc5OS4uOWNjNmE4MzdiMzAgMTAwNjQ0Ci0tLSBhL2xpc3Av ZXNoZWxsL2VzaC1pby5lbAorKysgYi9saXNwL2VzaGVsbC9lc2gtaW8uZWwKQEAgLTc0NCwx NSArNzQ0LDE2IEBAIGVzaGVsbC1vdXRwdXQtb2JqZWN0LXRvLXRhcmdldAogICAoY29uZGl0 aW9uLWNhc2UgZXJyCiAgICAgICAocHJvY2Vzcy1zZW5kLXN0cmluZyB0YXJnZXQgb2JqZWN0 KQogICAgIChlcnJvcgotICAgICA7OyBJZiBgcHJvY2Vzcy1zZW5kLXN0cmluZycgcmFpc2Vz IGFuIGVycm9yIGFuZCB0aGUgcHJvY2VzcyBoYXMKLSAgICAgOzsgZmluaXNoZWQsIHRyZWF0 IGl0IGFzIGEgYnJva2VuIHBpcGUuICBPdGhlcndpc2UsIGp1c3QgcmUtcmFpc2UKLSAgICAg OzsgdGhlIHNpZ25hbC4gIE5PVEU6IFdoZW4gcnVubmluZyBFbWFjcyBpbiBiYXRjaCBtb2Rl Ci0gICAgIDs7IChlLmcuIGR1cmluZyByZWdyZXNzaW9uIHRlc3RzKSwgRW1hY3MgY2FuIGFi b3J0IGR1ZSB0byBTSUdQSVBFCi0gICAgIDs7IGhlcmUuICBNYXliZSBgcHJvY2Vzcy1zZW5k LXN0cmluZycgc2hvdWxkIGhhbmRsZSBTSUdQSVBFIGV2ZW4KLSAgICAgOzsgaW4gYmF0Y2gg bW9kZSAoYnVnIzY2MTg2KS4KLSAgICAg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Li41NmQ4NmIyNTkyZSAxMDA2NDQKLS0tIGEvc3JjL3Byb2Nlc3Mu YworKysgYi9zcmMvcHJvY2Vzcy5jCkBAIC02ODczLDEwICs2ODczLDEzIEBAIHNlbmRfcHJv Y2VzcyAoTGlzcF9PYmplY3QgcHJvYywgY29uc3QgY2hhciAqYnVmLCBwdHJkaWZmX3QgbGVu LAogCQl9CiAJICAgICAgZWxzZSBpZiAoZXJybm8gPT0gRVBJUEUpCiAJCXsKLQkJICBwLT5y YXdfc3RhdHVzX25ldyA9IDA7Ci0JCSAgcHNldF9zdGF0dXMgKHAsIGxpc3QyIChRZXhpdCwg bWFrZV9maXhudW0gKDI1NikpKTsKLQkJICBwLT50aWNrID0gKytwcm9jZXNzX3RpY2s7Ci0J CSAgZGVhY3RpdmF0ZV9wcm9jZXNzIChwcm9jKTsKKwkJICAvKiBGSVhNRTogSGFuZGxlIFBU WSB0b28/ICBXaGF0IGFib3V0IHNvY2tldHM/ICBBbmQKKwkJICAgICByZW1vdmUgdGhpcyBk ZWJ1ZyBzdGF0ZW1lbnQuICAqLworCQkgIEFVVE9fU1RSSU5HIChmb3JtYXQsICJbZGVidWdd IEVQSVBFOiAlUyIpOworCQkgIENBTExOIChGbWVzc2FnZSwgZm9ybWF0LCBwLT5uYW1lKTsK KworCQkgIGNsb3NlX3Byb2Nlc3NfZmQoJnAtPm9wZW5fZmRbV1JJVEVfVE9fU1VCUFJPQ0VT U10pOworCQkgIHAtPm91dGZkID0gLTE7CiAJCSAgZXJyb3IgKCJQcm9jZXNzICVzIG5vIGxv bmdlciBjb25uZWN0ZWQgdG8gcGlwZTsgY2xvc2VkIGl0IiwKIAkJCSBTREFUQSAocC0+bmFt ZSkpOwogCQl9Cg== --------------gpkx6AkSxamqky4MpBG0rJ5N Content-Type: text/plain; charset=UTF-8; name="test-script.sh" Content-Disposition: attachment; filename="test-script.sh" Content-Transfer-Encoding: base64 IyEvYmluL3NoCgpyZWFkIGxpbmUKZWNobyB0aGlua2luZy4uLgpleGVjIDA8Ji0Kc2xlZXAg MTAKZWNobyBsaW5lID0gJGxpbmUK --------------gpkx6AkSxamqky4MpBG0rJ5N-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 00:30:56 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 04:30:56 +0000 Received: from localhost ([127.0.0.1]:47244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uft2G-0004ds-16 for submit@debbugs.gnu.org; Sun, 27 Jul 2025 00:30:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44206) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uft26-0004dK-6D for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 00:30: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 ) id 1uft1y-00045y-La; Sun, 27 Jul 2025 00:30:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9ef6P7raicIsLT8fLQWYQZUZ9tjxzsBc9eW7BJz5bAw=; b=WrxOs+WvjujJ gZoD+MCkcrLQvqDJtE8jW4B6jD+DOalB34kEDDnKquV3ejZnL86W9NLsGswQDidulgyqP5jvTjTkR GNlN8De1V6DPOCwypt7aFicavQQ9b9HFw2++j+AuBxLCBCbtBPDOz0853E/ZNNPDM4whfa5gJa/53 GzE7VzJH96DHG2zhBSeHBqOMBMyQP9408+PsQ+eYhMwKY0Z+wHrH8K4gaPy1xgssUT+gDprca2JYa HwPyToAJJ31EwzdsLAzFvNsurLjYGs3zve1YYek1q1KsXDuiVJCsGfTgZjwI3Ygr3wUO2pd4Bcs0r G1FNVJiR9fM4Arxw/TefJA==; Date: Sun, 27 Jul 2025 07:30:34 +0300 Message-Id: <86cy9mz251.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> (message from Jim Porter on Sat, 26 Jul 2025 10:23:48 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 26 Jul 2025 10:23:48 -0700 > Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org > From: Jim Porter > > On 7/26/2025 3:15 AM, Eli Zaretskii wrote: > >> Date: Thu, 24 Jul 2025 08:52:16 -0700 > >> Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org > >> From: Jim Porter > >> > > So calling the filter of the "head"s process when we get EPIPE should > > fix that, no? > > It would probably fix this particular case, but I'm not sure it's the > correct way to do it in general. I'll construct some test programs to > test out some of the corner cases here so that we can be sure whatever > implementation we do settle on works correctly in all cases. We should try doing what a Posix shell does in that case. A program that gets EPIPE generally exits with a failure status (right?), anything that happens after that is done by the shell itself. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 02:17:59 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 06:17:59 +0000 Received: from localhost ([127.0.0.1]:47567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufuhq-0006XF-RF for submit@debbugs.gnu.org; Sun, 27 Jul 2025 02:17:59 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:33413) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufuhn-0006Wy-1d for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 02:17:57 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4bqWcc6PNvz1sG7h; Sun, 27 Jul 2025 08:17:52 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4bqWcc0NG0z1qqlS; Sun, 27 Jul 2025 08:17:52 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id LN7exveTzYAW; Sun, 27 Jul 2025 08:17:41 +0200 (CEST) X-Auth-Info: IIyt6hw6/8/U6IZ3/iAE3CtSHd8klOzIvYzg56BmjE72f/Up1USPK9QVmAwbQnkc Received: from tiger (aftr-62-216-202-205.dynamic.mnet-online.de [62.216.202.205]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 27 Jul 2025 08:17:41 +0200 (CEST) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell In-Reply-To: <86cy9mz251.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 27 Jul 2025 07:30:34 +0300") References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> Date: Sun, 27 Jul 2025 08:17:41 +0200 Message-ID: <87pldmyx6i.fsf@linux-m68k.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 79079 Cc: Jim Porter , 79079@debbugs.gnu.org, eggert@cs.ucla.edu, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.5 (-) On Jul 27 2025, Eli Zaretskii wrote: > We should try doing what a Posix shell does in that case. A POSIX shell does nothing. It just connects the processes together and let them run to exit. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 03:01:37 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 07:01:37 +0000 Received: from localhost ([127.0.0.1]:47726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufvO4-00019n-P8 for submit@debbugs.gnu.org; Sun, 27 Jul 2025 03:01:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44668) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufvO1-00019M-O5 for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 03:01:34 -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 ) id 1ufvNt-00039V-8N; Sun, 27 Jul 2025 03:01:25 -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=7zM3+z55IH3in+tleSktocQb3i04Y6AauLnWUF/777o=; b=PYTSx119WMWH 8ef6U/LIa3G7XH7rDstJ/O1mdz4pGHTeCXy5jCd7UAp5TvW0wVGbQAdqi0OJFFUlz+4WkcF+e0hI2 TBIBg8oQanrY1YDHfxvPrRiB36FARdDVmRGc7CIb5cPRA9SFtVClpLMEucMcZXhINrQ3Keo2lpVuO 6wcacYJPQXS+evD7SjnVtTqqomytmKbbRj0E8sp4NA8uTwQppgIf0vyItYGzDn78Sg92hD2Ct2mCA H/H7rnBuqfoT9xo65cquwzv1VJ6B0G3A/3G7ZE6lLdk8GiCS6zB+KvnGpaHURF4X+7QcOcnl7SUJK 6Q2A0ScerdBM41LCdEwsCQ==; Date: Sun, 27 Jul 2025 10:01:22 +0300 Message-Id: <86wm7uxgl9.fsf@gnu.org> From: Eli Zaretskii To: Andreas Schwab In-Reply-To: <87pldmyx6i.fsf@linux-m68k.org> (message from Andreas Schwab on Sun, 27 Jul 2025 08:17:41 +0200) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <87pldmyx6i.fsf@linux-m68k.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, 79079@debbugs.gnu.org, eggert@cs.ucla.edu, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Andreas Schwab > Cc: Jim Porter , mail@daniel-mendler.de, > eggert@cs.ucla.edu, 79079@debbugs.gnu.org > Date: Sun, 27 Jul 2025 08:17:41 +0200 > > On Jul 27 2025, Eli Zaretskii wrote: > > > We should try doing what a Posix shell does in that case. > > A POSIX shell does nothing. It just connects the processes together and > let them run to exit. Not useful. I think you know very well what I meant, beyond the literal meaning of the words. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 03:31:17 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 07:31:17 +0000 Received: from localhost ([127.0.0.1]:47843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufvqm-0003Kf-Vc for submit@debbugs.gnu.org; Sun, 27 Jul 2025 03:31:17 -0400 Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]:35272) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufvqi-0003KG-Hp for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 03:31:13 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4bqYF96K4Kz1sFhH; Sun, 27 Jul 2025 09:31:08 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4bqYF86Gf5z1qqlS; Sun, 27 Jul 2025 09:31:08 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id TjhER6HSgADn; Sun, 27 Jul 2025 09:30:59 +0200 (CEST) X-Auth-Info: If5GqKIwe4ZGGR/D70F7HYYVzAV41VVoifsM6yneDTLmpcMPnDJ8/74cjoITZcog Received: from tiger (aftr-62-216-202-205.dynamic.mnet-online.de [62.216.202.205]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 27 Jul 2025 09:30:59 +0200 (CEST) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell In-Reply-To: <86wm7uxgl9.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 27 Jul 2025 10:01:22 +0300") References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <87pldmyx6i.fsf@linux-m68k.org> <86wm7uxgl9.fsf@gnu.org> Date: Sun, 27 Jul 2025 09:30:59 +0200 Message-ID: <87ecu2ytsc.fsf@linux-m68k.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, 79079@debbugs.gnu.org, eggert@cs.ucla.edu, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.5 (-) On Jul 27 2025, Eli Zaretskii wrote: >> From: Andreas Schwab >> Cc: Jim Porter , mail@daniel-mendler.de, >> eggert@cs.ucla.edu, 79079@debbugs.gnu.org >> Date: Sun, 27 Jul 2025 08:17:41 +0200 >> >> On Jul 27 2025, Eli Zaretskii wrote: >> >> > We should try doing what a Posix shell does in that case. >> >> A POSIX shell does nothing. It just connects the processes together and >> let them run to exit. > > Not useful. I think you know very well what I meant, beyond the > literal meaning of the words. But it is the truth. Emacs is not a shell. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 03:40:43 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 07:40:43 +0000 Received: from localhost ([127.0.0.1]:47882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufvzu-0003z3-Ne for submit@debbugs.gnu.org; Sun, 27 Jul 2025 03:40:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35422) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufvzq-0003ye-UZ for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 03:40:40 -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 ) id 1ufvzi-0000uF-D4; Sun, 27 Jul 2025 03:40:30 -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=hTeZQiNsEyTa8Qo32lUhGfVySY100DM+HpJjRrc9AQ0=; b=MYvHCtv7O5xu oUGfAAZaMRfADfqYrzSiwB3WoACzI9JIo+rpQLDnKgEe/O+t9zDxLcjjhKq/2Ml6a0/e5j9GNauZa BLOqzweHoeaItP14fiGLjq/jeVIhJOPJqtSxdhHakHxI0UpGAr0/N9WCt6QUiEwovdw9f7nv4njVr JmxxE7fIdKkZKE2O3bPGhZay81S6/043iNFgVUTLL7nN8n+rv5Ve0yjou/4MbpNPE5EYUJUf3VU1C z/mwIHkD03OIX7lykMASl6jNFpHobQ0CTeFlWB8RupWcoKSMz6gUro5/9V6olsOuPnwO4BHDfFNY1 kfacl8edWEOKnAjJZWWYiw==; Date: Sun, 27 Jul 2025 10:40:27 +0300 Message-Id: <86qzy2xes4.fsf@gnu.org> From: Eli Zaretskii To: Andreas Schwab In-Reply-To: <87ecu2ytsc.fsf@linux-m68k.org> (message from Andreas Schwab on Sun, 27 Jul 2025 09:30:59 +0200) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <87pldmyx6i.fsf@linux-m68k.org> <86wm7uxgl9.fsf@gnu.org> <87ecu2ytsc.fsf@linux-m68k.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, 79079@debbugs.gnu.org, eggert@cs.ucla.edu, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Andreas Schwab > Cc: jporterbugs@gmail.com, mail@daniel-mendler.de, eggert@cs.ucla.edu, > 79079@debbugs.gnu.org > Date: Sun, 27 Jul 2025 09:30:59 +0200 > > On Jul 27 2025, Eli Zaretskii wrote: > > >> From: Andreas Schwab > >> Cc: Jim Porter , mail@daniel-mendler.de, > >> eggert@cs.ucla.edu, 79079@debbugs.gnu.org > >> Date: Sun, 27 Jul 2025 08:17:41 +0200 > >> > >> On Jul 27 2025, Eli Zaretskii wrote: > >> > >> > We should try doing what a Posix shell does in that case. > >> > >> A POSIX shell does nothing. It just connects the processes together and > >> let them run to exit. > > > > Not useful. I think you know very well what I meant, beyond the > > literal meaning of the words. > > But it is the truth. Emacs is not a shell. Of course it isn't. Which is why we should try to make things happen which happen when the same command is run from a Posix shell. Some of that happens in the shell, some in the OS, some in the commands. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 03:53:01 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 07:53:01 +0000 Received: from localhost ([127.0.0.1]:47960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ufwBo-0004s3-Go for submit@debbugs.gnu.org; Sun, 27 Jul 2025 03:53:01 -0400 Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]:59075) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ufwBi-0004ri-Ol for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 03:52:58 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4bqYkD3YkCz1sB7x; Sun, 27 Jul 2025 09:52:51 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4bqYkC30gbz1qqlW; Sun, 27 Jul 2025 09:52:51 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id mIz0MWdyHN5Q; Sun, 27 Jul 2025 09:52:41 +0200 (CEST) X-Auth-Info: kv5yTs/NWfdOTeyBo2Da46qYFaSB4HSlavsDv67nCdLi55UhwqDecTjv6+LJHwjE Received: from tiger (aftr-62-216-202-205.dynamic.mnet-online.de [62.216.202.205]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 27 Jul 2025 09:52:41 +0200 (CEST) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell In-Reply-To: <86qzy2xes4.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 27 Jul 2025 10:40:27 +0300") References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <87pldmyx6i.fsf@linux-m68k.org> <86wm7uxgl9.fsf@gnu.org> <87ecu2ytsc.fsf@linux-m68k.org> <86qzy2xes4.fsf@gnu.org> Date: Sun, 27 Jul 2025 09:52:40 +0200 Message-ID: <875xfeyss7.fsf@linux-m68k.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, 79079@debbugs.gnu.org, eggert@cs.ucla.edu, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.5 (-) On Jul 27 2025, Eli Zaretskii wrote: > Of course it isn't. Which is why we should try to make things happen > which happen when the same command is run from a Posix shell. Some of > that happens in the shell, some in the OS, some in the commands. Emacs does not have the overview that the kernel has. It does not know when a process closes a stream, it can only discover it when it tries to read from or write to the other end of the stream. The kernel is the one who drives all communication, Emacs can only react (because it itself relies on the kernel to do everything). -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 11:06:20 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 15:06:20 +0000 Received: from localhost ([127.0.0.1]:51097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug2xA-0005dv-Eb for submit@debbugs.gnu.org; Sun, 27 Jul 2025 11:06:20 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:44956) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ug2x6-0005dN-Ib for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 11:06:18 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id E8F853C010860; Sun, 27 Jul 2025 08:06:10 -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 ipx2CwiISqe1; Sun, 27 Jul 2025 08:06:10 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id BFF153C010873; Sun, 27 Jul 2025 08:06:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu BFF153C010873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753628770; bh=nZWP99M5ef5Ylz7xCOGzCgireK0CXRmCmIecWGdiE3E=; h=Message-ID:Date:MIME-Version:To:From; b=PJ8OSj8ZHCq0YDMihFaIcctcuNWt66MxvBakEpq8co589B44690Hu6qedd6gX06sp t0Lw2EVhLWy23/OmzSHpv4Aa6NY6YMvhpPBhm38pnVyypXt4Em5OMLod/zrqkaHMdo 5jryNgGOS4rnPx7fctmRXPEewqHGd5Mtpc211NAQDZML0gqdphy8msboTr6dtHJDaK OBuC4YmGAkT/MhrUvH78XHQpGXiaMrLtcRimgsPLElen7SxbgknInhgebgbjoyApjX WV0NzyEeI/QMw0U+ZetwSVTME9TTkT65/AJpVOD0s/MU+S6jVQulBXURw+f/86tL6q W+LRKAHZlxtuw== 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 w0xKOzjuFulS; Sun, 27 Jul 2025 08:06:10 -0700 (PDT) Received: from penguin.cs.ucla.edu (47-154-30-222.fdr01.snmn.ca.ip.frontiernet.net [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 972783C010860; Sun, 27 Jul 2025 08:06:10 -0700 (PDT) Message-ID: <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> Date: Sun, 27 Jul 2025 08:06:10 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell To: Eli Zaretskii , Jim Porter References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <86cy9mz251.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-07-26 21:30, Eli Zaretskii wrote: > We should try doing what a Posix shell does in that case. A program > that gets EPIPE generally exits with a failure status (right?), > anything that happens after that is done by the shell itself. EPIPE typically means exit, yes, as the process reports the error and often has nothing better to do than to exit. However, it doesn't always mean exit. For example, an interactive Emacs does not exit with it gets EPIPE, as can be demonstrated with this shell command on GNU/Linux: strace -o /tmp/tr emacs -Q -eval \ "(princ (make-string 10000 ?a) 'external-debugging-output)" 2>&1|: and then type C-x C-c to exit Emacs. In this case Emacs painstakingly outputs 10000 'a' bytes, one at a time, and ignores each of the 10000 EPIPE errors that it gets. Not sure I know what you mean by "doing what a Posix shell does". Are you talking about commands that a shell implements directly, like the shell 'echo' command typically is? If so, those commands are supposed to do what their standalone counterpart executables do, which typically means they die due to getting a SIGPIPE signal. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 11:38:49 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 15:38:49 +0000 Received: from localhost ([127.0.0.1]:51231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug3Sa-0007jM-Pf for submit@debbugs.gnu.org; Sun, 27 Jul 2025 11:38:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34528) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ug3SV-0007it-Vl for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 11:38:46 -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 ) id 1ug3SO-0002Io-Un; Sun, 27 Jul 2025 11:38: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=5kQmpKrHS4uvmMKIQr4aym9mK97FFBHCDAY74d8sZIw=; b=AUTzZQahGgM+ y+9rRVvbyeHbxmelCaAlAeK7JDDPdFnP8k01+zZC0h+GVECNdxhD/clUYD6G6suMBXQyW40RQCbq4 EV5Vrvp/yIgHbf7DRIUJvDTV9PNWwg9A8QahSS+T/Cqat35FuAh4CDXiNyCP94NzvKAybW9lD8rzE ztve3QvNh8KepJdbTFmJAcrJQUSm9374wGLDcr/wOPYjF2N4Bd7K9V48UDkSsqtsSwqSVRqidcu9A wb8domMasJwUNZ+BabVMYxZI1GVN2GYN/8iOOtQC9GejpE4XC7HQbOUiHdVU3AJHljPKs9HtE4Hi3 1Gu9NKqv/EYaQzZIHo5ZpA==; Date: Sun, 27 Jul 2025 18:38:33 +0300 Message-Id: <86jz3ty77q.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-Reply-To: <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> (message from Paul Eggert on Sun, 27 Jul 2025 08:06:10 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, 79079@debbugs.gnu.org, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sun, 27 Jul 2025 08:06:10 -0700 > Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org > From: Paul Eggert > > Not sure I know what you mean by "doing what a Posix shell does". Are > you talking about commands that a shell implements directly, like the > shell 'echo' command typically is? If so, those commands are supposed to > do what their standalone counterpart executables do, which typically > means they die due to getting a SIGPIPE signal. I meant wrt data still buffered in the broken pipe(s) and standard streams. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 12:15:23 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 16:15:23 +0000 Received: from localhost ([127.0.0.1]:51355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug41y-0002em-JB for submit@debbugs.gnu.org; Sun, 27 Jul 2025 12:15:23 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:40618) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ug41s-000208-G0 for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 12:15:19 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 47AAA3C010860; Sun, 27 Jul 2025 09:15:10 -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 fuRX1kT3EYvD; Sun, 27 Jul 2025 09:15:10 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 1F5473C010873; Sun, 27 Jul 2025 09:15:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 1F5473C010873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753632910; bh=rZJ5Mxn0v4mT5V5OLkvmSd3blyacUycY/HNupz9EFEo=; h=Message-ID:Date:MIME-Version:To:From; b=LpzZ1GHW9DSVu+5w6E3NtXS6h24wjg772s69gAeD1QxKqiAUG2Fy20Uctng0hT4i7 5YaCjaBIudfsPmIe/9QUt6AEbiyszZUQ4LNFB6KMOG2rd6RX/2c1JWurouI17hV/Ph oXkJ3nDHgF3lHqR9yb53Gk0vO8CknczHFbRNSlvY8f5qiN15RdrVDrQYC+rMCBrph+ YmXPk2j53NN3f/3onh7xtXdrXFBAGtYyv+lnCuRVaK221bnCJxrbh6JquxAAkGE2yC jtkvpQKZtMMXPp0t8h89gNE6Pdz4ZLdFWU2fdrKULdLLeHjTls6jujFeUxuWN2/jrq t7K3mG+dSONag== 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 BZ0ruu-OkV2j; Sun, 27 Jul 2025 09:15:09 -0700 (PDT) Received: from penguin.cs.ucla.edu (47-154-30-222.fdr01.snmn.ca.ip.frontiernet.net [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id E42613C010860; Sun, 27 Jul 2025 09:15:09 -0700 (PDT) Message-ID: <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> Date: Sun, 27 Jul 2025 09:15:09 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <86jz3ty77q.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, 79079@debbugs.gnu.org, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-07-27 08:38, Eli Zaretskii wrote: >> Date: Sun, 27 Jul 2025 08:06:10 -0700 >> Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org >> From: Paul Eggert >> >> Not sure I know what you mean by "doing what a Posix shell does". Are >> you talking about commands that a shell implements directly, like the >> shell 'echo' command typically is? If so, those commands are supposed to >> do what their standalone counterpart executables do, which typically >> means they die due to getting a SIGPIPE signal. > > I meant wrt data still buffered in the broken pipe(s) and standard > streams. Still not quite sure I follow what's being asked, but here goes. There's no way for any program writing to a pipe to know what's in the kernel's buffers for the pipe, so there's nothing to do there. For buffers in user space (e.g., stdout's buffer), once a program has gotten EPIPE there's no point to any further writes or fflushes; the program will just get more EPIPEs. Typically what a program will do in either situation is output an error message and exit. Of course this exits just the program, not the shell that invoked the program. Bash, for example, acts like this if bigstring is long enough: $ (trap "" PIPE; sleep 1; echo "$bigstring") |: bash: echo: write error: Broken pipe $ From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 12:54:15 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 16:54:15 +0000 Received: from localhost ([127.0.0.1]:51489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug4db-00041i-7r for submit@debbugs.gnu.org; Sun, 27 Jul 2025 12:54:15 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:55715) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ug4dF-00040I-FR for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 12:53:54 -0400 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-75ab31c426dso2940282b3a.3 for <79079@debbugs.gnu.org>; Sun, 27 Jul 2025 09:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753635227; x=1754240027; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=tiwEARQHXi/V+fI+5EYRrmWOYa4H7J3+EfT4u3gN3VI=; b=JdRkSY/Ga2QXT72Cp4/ZXxXPvEPA9Q7qwxKBUT6Pp0MZ3UcGthhWMFpCxZXxxruNuL g7KPtEY0Ai0u00Y9xLfl8lb/+HZtucazR0ai1pD0PQDzkGvF29aplXHr8O2MDGzJM4el YJmZGtiP0LO9gRZb6hxAO8d8tr0jHb8rXQtodu7t8WQRuGtbqOBzWc1Rs7gvKdM2Uodu ZXayIYLzS/VFOahXqEN2q1S7zljVLYYgFkFHv4GNq8l8DbzRhdUFPACSLfDoRl32mAnI gYIAJrxvJ6uYllH8Om9lcQWLm16D2iXf/AszbJdrnna8dhoXcDrQnipEWudjKe+5GiUG jVLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753635227; x=1754240027; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tiwEARQHXi/V+fI+5EYRrmWOYa4H7J3+EfT4u3gN3VI=; b=KzHInyfrZaFW6OCr9Wmc6wcIFplDfvE4jx1hDAMCeICMb2FMhwufWsmART3cP7EvTa 6/phc9i7MgmXx95l3l3NUEYm67YHUQm5lUCdGBDNP52vRB0KTywG4b4vgMyfO2TYFipg 2SG7I0OXrLzF7h/Dv7nfATh9M6N/evSbTOW21sfWNIeWGoJ7otS3akPVoglVqyQXFo7G vQ96yAthLTGPyhbKJQMVV2xogbaTt7nsQETLIKN+XhJDY8Jhkinyg6UjdqSuoPkjpje1 bY2H6FSNmZfdO5lMF6rHE4V8swNDTyuj7rEIjlu5AEYsYwoI04qc4O1UsMqrUUE5bMiO 6gXg== X-Forwarded-Encrypted: i=1; AJvYcCVHXf3o+XxxU87tzDtVyept7OvK6luw99XM9Xg/xJKBf91wRXsUcZ7ciwh3iEQeh2FPVhTkIQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzWn+RX9tW5HA1v/ZMzKB2OdUluEUZwcm6j9Jf4l5R2kxoaQNgL jGeFs3QbSIY0wEcXAPFkktFYHW6Al8MQuX+dMttbPy2zPJyVzn2KDwJ2 X-Gm-Gg: ASbGncuglnqPuuLHBVb+4IdO7Fk7oWC0oLd+Yh2AcBA1U8bHsdZm6KiVnFQJmCcKHgA Qz5nZuOjlgff5MqrjJRVoiUVnaJLiabbur0aAOzF2f7D/a73fx7nr/ruD74pIFQWia86lLMNuG0 KyxGwNDjlvqKZG3zquV3EFr32MhL1U4P23GqMy+8DSBKWDpw30+jsIuYG/tZXAEIVCJ+bFe08mB GHoH2iJ7WSK9Xr3s+3AmN4chXprF3GB4Nmzdwup54gIBsrxdUw+3UlhAPJLxz9dxK1A8eTLqwDi t2Pa60pUy+kFs/so06iY0+9xcGjPdCZ/PuIPstS5rXT6Q3GDrQUy5Ij7im04yRwrX86Res+qeba zqOp1J0pl70ujSndIkk+W3sYi99stVQL5CcI9c7qdiFJCvcBh0ePCHiRHPKq2grq55mCs+/b5Bz e2dJKbi5nKbwqH X-Google-Smtp-Source: AGHT+IG8c3EXOe1+1ra1EXCj1q2mmyL3UdXfRafymbxF31k5lEU6JAhU67vT3Mymb0O3viqOIgf0lQ== X-Received: by 2002:a05:6a20:3946:b0:231:7dcc:f449 with SMTP id adf61e73a8af0-23d700815f9mr15045251637.18.1753635227087; Sun, 27 Jul 2025 09:53:47 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-7640872a196sm3721736b3a.20.2025.07.27.09.53.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Jul 2025 09:53:46 -0700 (PDT) Message-ID: <7046afc2-cebc-bdd9-fa42-bd8e08816c93@gmail.com> Date: Sun, 27 Jul 2025 09:53:47 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> From: Jim Porter In-Reply-To: <86cy9mz251.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/26/2025 9:30 PM, Eli Zaretskii wrote: > We should try doing what a Posix shell does in that case. A program > that gets EPIPE generally exits with a failure status (right?), > anything that happens after that is done by the shell itself. Agreed. Eshell already does its best at the part you mention: in the pipeline "A | B", if A writes to B and gets an EPIPE error, Eshell sends a SIGPIPE to process A. (That's not *exactly* what happens in POSIX shells, but because of the additional indirection Eshell has between processes in a pipeline, it's as close as I can get without major surgery.) The remainder is just to make sure that we follow POSIX shell behavior as closely as we can for process B as well. As for the rest of the discussion here, my goal isn't exactly to make Emacs behave like a POSIX shell (which is apples-to-oranges, as Emacs isn't a shell), but to make *Eshell* behave like a POSIX shell. That requires some changes to process.c, but I think those changes will be positive for Emacs in general; the result will be that Emacs responds more carefully to EPIPE. (Of course, if there are any changes that would help Eshell but *hurt* Emacs's process support in other scenarios, I won't make those. But I'm pretty sure we won't run into this problem.) From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 13:14:18 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 17:14:18 +0000 Received: from localhost ([127.0.0.1]:51560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug4wz-0005Jw-Ng for submit@debbugs.gnu.org; Sun, 27 Jul 2025 13:14:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44460) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ug4wv-0005JO-Lo for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 13:14:16 -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 ) id 1ug4wl-0001z9-VN; Sun, 27 Jul 2025 13:14:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=B65xtx0rb+OXorhUIac+iXPFsyQo7MXZVC1CT21Bsa4=; b=JqdDRW3YdDJV FrqU9rPzNom9p/BbiWJ+Xf0SPKFqCYT1XJ88YLYV6vpSRpSEnw39mhoMOAdF0uYRmlsoJP6AFC9I2 ndqtzaOf0ezzDWuwM1CXbeP/wrFNUkTArqbfB2m4HEKak6pO8aCbCfjlvkaZfK4OmllNkbe7C/Ez8 lriLoMaSL7ectIiiYe9Sj/XXLjjcZ6s5DCktOGoQG6ql2MJjsm0QCKiuGoAVz4ebajcKVA5H9jNL7 dQ9LDHWqjYnzaL8rgSoSCJUnkKq1hc4Oa9N4zWl2ODcfkF1/wRUtt1yAxlPtB0LT21ZsqEeuma3vT hEJLqL3PmVaK+QhZHYD5Dw==; Date: Sun, 27 Jul 2025 20:14:01 +0300 Message-Id: <86ikjdy2sm.fsf@gnu.org> From: Eli Zaretskii To: Paul Eggert In-Reply-To: <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> (message from Paul Eggert on Sun, 27 Jul 2025 09:15:09 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, 79079@debbugs.gnu.org, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sun, 27 Jul 2025 09:15:09 -0700 > Cc: jporterbugs@gmail.com, mail@daniel-mendler.de, 79079@debbugs.gnu.org > From: Paul Eggert > > On 2025-07-27 08:38, Eli Zaretskii wrote: > >> Date: Sun, 27 Jul 2025 08:06:10 -0700 > >> Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org > >> From: Paul Eggert > >> > >> Not sure I know what you mean by "doing what a Posix shell does". Are > >> you talking about commands that a shell implements directly, like the > >> shell 'echo' command typically is? If so, those commands are supposed to > >> do what their standalone counterpart executables do, which typically > >> means they die due to getting a SIGPIPE signal. > > > > I meant wrt data still buffered in the broken pipe(s) and standard > > streams. > > Still not quite sure I follow what's being asked, but here goes. > > There's no way for any program writing to a pipe to know what's in the > kernel's buffers for the pipe, so there's nothing to do there. > > For buffers in user space (e.g., stdout's buffer), once a program has > gotten EPIPE there's no point to any further writes or fflushes; the > program will just get more EPIPEs. > > Typically what a program will do in either situation is output an error > message and exit. Of course this exits just the program, not the shell > that invoked the program. Bash, for example, acts like this if bigstring > is long enough: > > $ (trap "" PIPE; sleep 1; echo "$bigstring") |: > bash: echo: write error: Broken pipe > $ How ids all this working in the specific pipe command in question, and why does that piped command yield different results when run from a shell than when run from Eshell? That's basically what I'm asking. And as a corollary, what should we do so that the result in Eshell will be the same as from a shell, and why? From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 15:14:55 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 19:14:55 +0000 Received: from localhost ([127.0.0.1]:51821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug6pj-000484-2q for submit@debbugs.gnu.org; Sun, 27 Jul 2025 15:14:55 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:35720) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ug6pM-00046Y-EO for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 15:14:33 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 3F81B3C010860; Sun, 27 Jul 2025 12:14:26 -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 fLyYljVbu8jU; Sun, 27 Jul 2025 12:14:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 117E43C010873; Sun, 27 Jul 2025 12:14:26 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 117E43C010873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753643666; bh=hbwkWGlimmb3TT+oK65uBUVXPon477+7rqLlcU9+0D8=; h=Message-ID:Date:MIME-Version:To:From; b=VF2MV627ex5Q09tpQ19q/QohNyU0H9kO7yXryWx3R/c6lt7qZGOsQYIb1wL24uQe9 Llo0UyMqlcgjoJSjlxK0oWISruW4x9DwnQ+VrphaOQ8iPc+fNLYDRhwBy+uQfKZp0D hpMhs0ncVSr8w8jGLqe747xbGXIv7A9qhyeo1OtM8Crg+fTI/Y43BLRjsTXjB3AjCR +cSMRNodyu1dN+8fzXfYCgEs+k+D38nsYCVKhQAD+AUgLuwgLICLICY/U5Q4tcGovJ QV9bVwhDlA//bMuMEdnDxjjRzCEg3r3Gi9zGW9S+30+AdPOhjmS4HWsbXFHTdGyKin 2PByV2UZB5WLw== 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 wrqkGkZRaD74; Sun, 27 Jul 2025 12:14:25 -0700 (PDT) Received: from penguin.cs.ucla.edu (47-154-30-222.fdr01.snmn.ca.ip.frontiernet.net [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id D96543C010860; Sun, 27 Jul 2025 12:14:25 -0700 (PDT) Message-ID: <0d760231-21bd-4ad1-81fe-cec33856e33f@cs.ucla.edu> Date: Sun, 27 Jul 2025 12:14:24 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> <86ikjdy2sm.fsf@gnu.org> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <86ikjdy2sm.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: jporterbugs@gmail.com, 79079@debbugs.gnu.org, mail@daniel-mendler.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-07-27 10:14, Eli Zaretskii wrote: >> Date: Sun, 27 Jul 2025 09:15:09 -0700 >> Cc: jporterbugs@gmail.com, mail@daniel-mendler.de, 79079@debbugs.gnu.org >> From: Paul Eggert >> ... >> Typically what a program will do in either situation is output an error >> message and exit. Of course this exits just the program, not the shell >> that invoked the program. Bash, for example, acts like this if bigstring >> is long enough: >> >> $ (trap "" PIPE; sleep 1; echo "$bigstring") |: >> bash: echo: write error: Broken pipe >> $ > > How ids all this working in the specific pipe command in question, and > why does that piped command yield different results when run from a > shell than when run from Eshell? Sorry, I don't know. From Jim's recent email it sounds like Eshell does not actually set up a pipe when implementing "A | B", but instead does something else that simulates a pipe. I don't know how the simulation works, but it sounds like the simulated pipe cannot act like a real pipe when B closes its end of the simulated pipe, A ignores SIGPIPE, and A writes to the simulated pipe. With a real pipe A would get an EPIPE error, and I guess that's not happening with the simulated pipe. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 15:34:21 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 19:34:21 +0000 Received: from localhost ([127.0.0.1]:51861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug78W-0005JE-Pu for submit@debbugs.gnu.org; Sun, 27 Jul 2025 15:34:21 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:58741) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ug78U-0005Iv-IO for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 15:34:19 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-23c8f179e1bso42731045ad.1 for <79079@debbugs.gnu.org>; Sun, 27 Jul 2025 12:34:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753644852; x=1754249652; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=M1tHj+zDam5vzYLTbMKigSdzIoVXjSA7foYWZGK9G/w=; b=e+t3cL6XlLI6KPK25i8a83GA2eQcxxPBlUAmvYycHaCo8nvCsa8k0LnxgpSfwQqJ81 Z86lioNGPBwtooazM9+59IBCwKiBAl2V1Ou23Qd+sXOcupqMWbU3fUGIY0CNOiI69+Yo m7HvFtpcjDz1QOu+solUoqWnhjrr2Cc4tifIZIOnsOF2npwCo9OQjxmnPBOWN5dEkbBR emCtl1GEtdsBNjcuYyjN7D8tN5AsrOImqK0JreAApgQTwMtpHWUV2ACe+1Uen6ch86rz ZZsyNeDWsroJuKCgL0Qskgvg1xwjkRrLm0H7wcDiowMTCY/hEsjovQLxt5OawvOBHEDn DwlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753644852; x=1754249652; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M1tHj+zDam5vzYLTbMKigSdzIoVXjSA7foYWZGK9G/w=; b=ZA9FVjGRFRgTVkhtSFpAwjAqWLBFC6aqq3lPOshv7MRrTVUUTzxVOZYB0AVbUrYDK0 hnc1y2R+agHiC8DSMJwS2dgDARluNEutrnX/xuY70dAQwpu35vL6hLc7e2Mje+JHIJc2 jppyb4rnn/fR2GpvJqMJ22TfBKHQ26gWOH9TuXkouj9bqP1+quporTYY5c6ONAysSptb T+ALpmNEBiTyltKIQggsJFxefac4yRW+DtCfD2P8bKNa0o6SHPdl9HXsn7XnKPm/x9ms up5HhpOHu57KYjDV37nN6iw8XK86/Lx/PTNROkfFH87kZfROfpVEy/8JnwxzjAL/NZHL XxsQ== X-Gm-Message-State: AOJu0YzkJ1ikpqRSvAgtNnlvQqcAa8EJG7OyZANmadAtAlBSm4GP/kEd 6+XejigiCjRJ5vQ7ov3AdkULBTiuf9XXMqxlmXv+hoAIDYh+oS2B9wjX X-Gm-Gg: ASbGncvIO0nBY+Ht8pai4E+f8Jkex1Hoc5tBpXOs9B3dqzDT1kQfcW7qwI6iAPo010U glkxn7FjSoXIZlO/EKa40Er1VuZsgSZVWK5GIDLRWIzqNwmhrvw/U7cQGj5Y0SReKkbJ9HBJocI FcCq/6HS+dA0ICTePInC8B5l4stUfc0rsKksyk8w6694wCUw/FZGu4r3YREoaDBLY0LKdRMNw7Z CY03rEOXiwxjQwL2WX1NG84jggVP1wLM5l/xLocaDgUXSD7WVvLRzXsJV0focJvj1kEbPWSG1oI PPlFvS+GlKFS/HbRnOzgAfVkScp1yyYBw9GU1RnpRpOpSAZzVYsECruMgIzhmVTWquFI0AJ/iK5 p+YtYuDA+4k4Q7WxJzbzpVQAKmcktb7PHLUZmznuWxIIQwuLqjqTvK4EfJFM6F4E3CLzak5m+kO 4alg== X-Google-Smtp-Source: AGHT+IEb0t2p4tLoV1TE3A+CD9U5esouTMso5TALxjQ9Bcci9E2IX8KH9da8z01Xrinzwfs3AAgXrw== X-Received: by 2002:a17:902:ec8f:b0:23f:904b:a748 with SMTP id d9443c01a7336-23fb30cb6cemr134257075ad.20.1753644852001; Sun, 27 Jul 2025 12:34:12 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-23fed0b89ebsm24253795ad.63.2025.07.27.12.34.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Jul 2025 12:34:11 -0700 (PDT) Message-ID: <1c056e9f-a4ed-93f2-4553-3883e067adf4@gmail.com> Date: Sun, 27 Jul 2025 12:34:10 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Paul Eggert , Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> <86ikjdy2sm.fsf@gnu.org> <0d760231-21bd-4ad1-81fe-cec33856e33f@cs.ucla.edu> From: Jim Porter In-Reply-To: <0d760231-21bd-4ad1-81fe-cec33856e33f@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/27/2025 12:14 PM, Paul Eggert wrote: > From Jim's recent email it sounds like Eshell does not actually set up > a pipe when implementing "A | B", but instead does something else that > simulates a pipe. I don't know how the simulation works, but it sounds > like the simulated pipe cannot act like a real pipe when B closes its > end of the simulated pipe, A ignores SIGPIPE, and A writes to the > simulated pipe. With a real pipe A would get an EPIPE error, and I guess > that's not happening with the simulated pipe. If we're being technical, Eshell does use pipes for its pipe operator, but there's an additional layer of indirection that makes it difficult to simulate the usual POSIX shell piping: process A -> stdout pipe -> process filter -> process-send-string -> stdin pipe -> process B If 'process-send-string' fails, we raise a Lisp signal 'eshell-pipe-broken', that tries to be as much like SIGPIPE as we can. Because of this indirection though, process A won't see an EPIPE/SIGPIPE at the normally-expected time, hence my comment in esh-proc.el: ;; The output pipe broke, so send SIGPIPE to the ;; process. NOTE: Due to the additional indirection ;; of Emacs process filters, the process will likely ;; see the SIGPIPE later than it would in a regular ;; shell, which could cause problems. For cases ;; where this matters, using an external pipe ;; operator (`*|') may work instead. Luckily, this bug is really about what happens with process B in the pipeline, so I won't have to make any further changes to the process A side of things (at least not yet). From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 15:53:44 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 19:53:44 +0000 Received: from localhost ([127.0.0.1]:51932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug7RI-0006Uh-Co for submit@debbugs.gnu.org; Sun, 27 Jul 2025 15:53:44 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:33925 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ug7RF-0006UR-KG for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 15:53:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=x3NAkvsFfXt9j8/EC+4hbeU2kj/W0GD4dvqXrv7C4nI=; b=iGXxsGk5RWzj6WwcL/tbM2ggTT rOUSS+xdCfWFRjF4e5bnHX4A9vt3os4PblALW1F5s2XDnRcnB6S0f+a6705t11wd19U8Cvf6nwP43 Cfj3ytLYcJdBUuH9HQNHz+TKPh947eKEhNGCViJK+8GC9e34nHRVOjCmnGyhQ9/e8bEM=; From: Daniel Mendler To: Jim Porter Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell In-Reply-To: <1c056e9f-a4ed-93f2-4553-3883e067adf4@gmail.com> References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> <86ikjdy2sm.fsf@gnu.org> <0d760231-21bd-4ad1-81fe-cec33856e33f@cs.ucla.edu> <1c056e9f-a4ed-93f2-4553-3883e067adf4@gmail.com> Date: Sun, 27 Jul 2025 21:53:33 +0200 Message-ID: <87wm7t5s1u.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 79079 Cc: Eli Zaretskii , Paul Eggert , 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Jim Porter writes: > On 7/27/2025 12:14 PM, Paul Eggert wrote: >> From Jim's recent email it sounds like Eshell does not actually set up a pipe >> when implementing "A | B", but instead does something else that simulates a >> pipe. I don't know how the simulation works, but it sounds like the simulated >> pipe cannot act like a real pipe when B closes its end of the simulated pipe, >> A ignores SIGPIPE, and A writes to the simulated pipe. With a real pipe A >> would get an EPIPE error, and I guess that's not happening with the simulated >> pipe. > > If we're being technical, Eshell does use pipes for its pipe operator, but > there's an additional layer of indirection that makes it difficult to simulate > the usual POSIX shell piping: > > process A -> stdout pipe -> process filter -> process-send-string -> stdin > pipe -> process B Only tangentially related to this bug report, but I wonder if it would make sense to always use actual pipes in Eshell when possible, instead of the process filter indirection? There exists already the *| operator from `em-extpipe'. What prevents us from making it the default (or enable it via customization) if `sh' is available? The downside is that `sh' is started as an intermediate process, but are their other downsides? For example piping though an Elisp function, which transforms the input, would not work, but this is not yet supported, or is it? As far as I understand *| is often more efficient, despite starting a separate shell process. Exposing Unix pipes to directly glue file handles on the Elisp level would be another option, but it is probably difficult to integrate this into the existing process API? Daniel From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 16:09:03 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 20:09:03 +0000 Received: from localhost ([127.0.0.1]:51970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug7g6-0007PK-SV for submit@debbugs.gnu.org; Sun, 27 Jul 2025 16:09:03 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:46550) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ug7g4-0007Oe-01 for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 16:09:00 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-235f9ea8d08so35105935ad.1 for <79079@debbugs.gnu.org>; Sun, 27 Jul 2025 13:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753646934; x=1754251734; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=fdzxMWd/8unEzveG6t2+QoB9tdXrLZbezBm165N4/TU=; b=WAK93KIbJr2F1nk21zavgfEg6pjKLcH8CngVw2ZD5iXqlSDBFgBe+l096Qxqj/1yi4 UApGV+6CB63S5DoQX67uy5OarlSMtkNVNIHYP9R9/Cr+U8byo2VZ1Qg8xZ+tjg95N75F 9DZjwArSd/fI4EqfE4k1SBzML73wEyxY0FTTfyL4PChKq4g6tZk3cRnXq3v79LwNPh+e AZOTXyKYilRsG4m0PpnOuXYo5PdNRsAmZVBx6zmk/wBstLVxhmJs7W1NlAYXUwTyvNLO GyRNkj2lBsAUb+1KToJ/aKq7mikpfOdHHc+8uWizBFbIcsmzvnIOmvVS+/r4DGgNppap OnSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753646934; x=1754251734; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fdzxMWd/8unEzveG6t2+QoB9tdXrLZbezBm165N4/TU=; b=VOszap2dJAiM3X7qzIXztH1kIPUrDIqeb95+6J1tOWc99kz5b9f4zHtdGEJZPWsdbZ w2LKbtx4ZPiw6Xo6C4oWTLX6MuObsANOdhI6eANBLmfsfQAeIX9JpRIeaZ7t2JnVx06p BMuCH7NLf1GCteL1FKzuCbUKpRxWe1Jy1SpgoglrXcqJ2UpKlh+ZOp3gDJliw9WVnmUH tc5+S6SRGwJ+UdFm+6ZHy+N6/byht/mfkB9vSuv8Q8MSFbrOV9zKaKaKVd0kYVqYFFpy AtKMC98KEYDghXrMB3q0HeGYOiFmS+rEDrtLEazfjbXbDbDyWG5/jwI0qVKWJJEFWpCb oEyg== X-Forwarded-Encrypted: i=1; AJvYcCVcONcm1b52x/KSpBVB+mR7TEOeyKyMKxm1C43PXtQeSPcscQTmyUSxISOFHmdz37oVDITpwQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yw0xc63KjzuvX0QbGOhoqECIHRle+DRnGX8Gkc1IgTWaQh5S6a9 CKZIYGlq8GhfNRmorEPjQbsJDiwneyxmRe5KmbYjzDN+5zMoNMkbRqek X-Gm-Gg: ASbGnctL+wgcQF5oUYz7+PUdI4dKHviLzhHNLSDGgYoes9YuT+LO5400g79gzUYAtse +/svs5iWvaig9NuU3TRJfnHF/maZmD2wbjlLfbfOFPFaYWLZV+/fCIOESrCqG2LuuMD9Cnoo07h e67QeaUlLWwNjbbfPDcfPi33SMb9Uc32gl4W/UTOlZNDFpTcqVPVUT2AhcnrHZTzNlK/tUTm3I2 ryWTDMb1pRsLpo5drOQyEAqWW0NFbPznty3zRxh6sj35P7xG09voFQ+x2WZyHeWf4PWm6zLz6vo IVKB9Ei1RL1ZgzgoGqfasF0oRhj4bffHp6W3YYBLgUCGvzhuFi5ShX0MLfl5uxQBLUdtPABMxkG ob7XkHmtZ9CnCmJOAi6bvLQSfXPiSRWG3XasbbuIuRWOeK8WBHWe0SLEhIvLBz0hN6pzIvEieLM E/Cw== X-Google-Smtp-Source: AGHT+IHqGmdrP/+/0A2VkQPE1iIbgwCbxh9XZQ2qglfXzFr/BJh1ZuXrjmKeqHjDeYXf59jm4dyjrw== X-Received: by 2002:a17:903:190d:b0:234:c549:da13 with SMTP id d9443c01a7336-23fb303a27cmr150021655ad.17.1753646933712; Sun, 27 Jul 2025 13:08:53 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-23fbe30bb8esm38559025ad.21.2025.07.27.13.08.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Jul 2025 13:08:53 -0700 (PDT) Message-ID: Date: Sun, 27 Jul 2025 13:08:52 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Daniel Mendler References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> <86ikjdy2sm.fsf@gnu.org> <0d760231-21bd-4ad1-81fe-cec33856e33f@cs.ucla.edu> <1c056e9f-a4ed-93f2-4553-3883e067adf4@gmail.com> <87wm7t5s1u.fsf@daniel-mendler.de> From: Jim Porter In-Reply-To: <87wm7t5s1u.fsf@daniel-mendler.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: Eli Zaretskii , Paul Eggert , 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/27/2025 12:53 PM, Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > Only tangentially related to this bug report, but I wonder if it would > make sense to always use actual pipes in Eshell when possible, instead > of the process filter indirection? > > There exists already the *| operator from `em-extpipe'. What prevents us > from making it the default (or enable it via customization) if `sh' is > available? The downside is that `sh' is started as an intermediate > process, but are their other downsides? For example piping though an > Elisp function, which transforms the input, would not work, but this is > not yet supported, or is it? As far as I understand *| is often more > efficient, despite starting a separate shell process. Eshell will support piping to Lisp commands Soon(TM). I'm finishing up a patch series that I hope to upload for discussion shortly. This has taken a *long* time to get to the point where I haven't run into any major issues, but it's finally coming together. The larger problem is that it's impossible to determine at command-parsing time whether a particular command is implemented entirely in Lisp or will create a child process. "cat" is a good example: even as the leftmost command in a pipeline, sometimes it's a Lisp command, and other times, it creates a child process by throwing 'eshell-external' to replace the Lisp version of the command. That makes it challenging to connect the pipes up correctly, since we don't know which commands have real OS-provided pipes until command execution. I'm not saying it's impossible, but it's definitely not easy. From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 18:03:29 2025 Received: (at 79079) by debbugs.gnu.org; 27 Jul 2025 22:03:29 +0000 Received: from localhost ([127.0.0.1]:52241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ug9Sq-0005vw-KL for submit@debbugs.gnu.org; Sun, 27 Jul 2025 18:03:28 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:52810) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ug9Sn-0005vY-W1 for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 18:03:26 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id AC7AE3C010860; Sun, 27 Jul 2025 15:03:19 -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 h31b7xUKdRB4; Sun, 27 Jul 2025 15:03:19 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 83CE83C010873; Sun, 27 Jul 2025 15:03:19 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 83CE83C010873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1753653799; bh=+RFQJPUelnpaJaopG25ArwT3NWkynqaT715NNw0s5ow=; h=Message-ID:Date:MIME-Version:To:From; b=NtL4C9YQC4W7ZuF/Jikd9KcRmSNq3Jtqg/7KJT02FiXIu9aCOenrPKt4IrzdTjKpS 5FlM3ioZvXbyYG+HBEGYxaKwUv/JGHA3XkUf9KUq8sVHzR0AxBzGzUV0EkxCKnP6wl j4OIl6HrZG9MsSnckAiE1SDcIB/w1bxmzY7HtdFJBCj499ExYAO9vGwhtLleWVoqBr jgALmxw7xGZfHvSPzikr0sdfgbz8OiWe0/D3/DXSfvdEaoWIB7EDXFmeyw9JTQn3w9 /5zxyvH22orJPr76JBgIqXyq+nJZHzyH558nodyEIuQ4JA6Ad+99tUkZyqwNTxaYlN Ws7VVw9cyeAvg== 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 ih_CamJEqEbG; Sun, 27 Jul 2025 15:03:19 -0700 (PDT) Received: from penguin.cs.ucla.edu (47-154-30-222.fdr01.snmn.ca.ip.frontiernet.net [47.154.30.222]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 5CD7B3C010860; Sun, 27 Jul 2025 15:03:19 -0700 (PDT) Message-ID: Date: Sun, 27 Jul 2025 15:03:18 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell To: Jim Porter References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> <86ikjdy2sm.fsf@gnu.org> <0d760231-21bd-4ad1-81fe-cec33856e33f@cs.ucla.edu> <1c056e9f-a4ed-93f2-4553-3883e067adf4@gmail.com> Content-Language: en-US From: Paul Eggert Organization: UCLA Computer Science Department In-Reply-To: <1c056e9f-a4ed-93f2-4553-3883e067adf4@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, Eli Zaretskii , 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2025-07-27 12:34, Jim Porter wrote: > If we're being technical, Eshell does use pipes for its pipe operator,=20 > but there's an additional layer of indirection that makes it difficult=20 > to simulate the usual POSIX shell piping: >=20 > =C2=A0 process A -> stdout pipe -> process filter -> process-send-stri= ng ->=20 > stdin pipe -> process B >=20 > If 'process-send-string' fails, we raise a Lisp signal 'eshell-pipe-=20 > broken', that tries to be as much like SIGPIPE as we can. Because of=20 > this indirection though, process A won't see an EPIPE/SIGPIPE at the=20 > normally-expected time Thanks for the explanation. Is this documented? Might not hurt to do so=20 if it's not documented already. Maybe that can be part of your patch=20 series (and I can certainly sympathize with those patches taking time to=20 get right!) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; The ou= tput pipe broke, so send SIGPIPE to the > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; proces= s.=C2=A0 NOTE: Due to the additional indirection > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; of Ema= cs process filters, the process will likely > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; see th= e SIGPIPE later than it would in a regular > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; shell,= which could cause problems. Suppose we change Emacs to not send SIGPIPE to A in this situation, but=20 instead to just close Emacs's end of A's output pipe. Then when A=20 eventually gets around to writing to its output pipe it will get a=20 SIGPIPE if it is not ignoring that signal, and an EPIPE failure=20 otherwise, and this will be closer to what happens with ordinary shell=20 pipes. An objection to such a change, which is hinted at in the comment, is=20 that A might get a SIGPIPE later than it would with an ordinary shell=20 pipe, due to the extra buffering that Emacs supplies. But this objection=20 isn't a deal breaker, as A can't know how big the kernel pipe buffer is=20 or how the scheduler works, so it shouldn't rely on that precise of a=20 schedule anyway. If I understand things correctly a problem with the current code is that=20 A can get a SIGPIPE too early, before it writes to its output pipe, or=20 even if it never writes to its output pipe. That contradicts the POSIX=20 behavior, and so is a more serious problem than A getting a SIGPIPE=20 later than usual (which is what the comment is worried about). From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 27 21:49:27 2025 Received: (at 79079) by debbugs.gnu.org; 28 Jul 2025 01:49:27 +0000 Received: from localhost ([127.0.0.1]:52915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ugCzW-0006WD-Uy for submit@debbugs.gnu.org; Sun, 27 Jul 2025 21:49:27 -0400 Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:41195 helo=mail.qxqx.de) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ugCzT-0006Vk-Ue for 79079@debbugs.gnu.org; Sun, 27 Jul 2025 21:49:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=x/phLuzW2xrIoebL2f/WuWMgVJTAr0YDCPmGFFpUzSM=; b=HHmjQoBS4npOz4pCQD1nS85hrL DfchWcsbOtaaO6FKvk9Px8f6kAX/7e/fzinzu3tACU+8y3p4bMtHiQX6ZiQY+jmBLWXBIk5iKQL+y YMhd7mbM3VE5LyDrqe3zBbiACwpPDp5uZcUIfs04OWb68UajP8TiEGvSYgKum6EtZrWc=; From: Daniel Mendler To: Jim Porter Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell In-Reply-To: References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> <86ikjdy2sm.fsf@gnu.org> <0d760231-21bd-4ad1-81fe-cec33856e33f@cs.ucla.edu> <1c056e9f-a4ed-93f2-4553-3883e067adf4@gmail.com> <87wm7t5s1u.fsf@daniel-mendler.de> Date: Mon, 28 Jul 2025 03:49:15 +0200 Message-ID: <87tt2x5bl0.fsf@daniel-mendler.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 79079 Cc: Eli Zaretskii , Paul Eggert , 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Jim Porter writes: > On 7/27/2025 12:53 PM, Daniel Mendler via Bug reports for GNU Emacs, the Swiss > army knife of text editors wrote: >> Only tangentially related to this bug report, but I wonder if it would >> make sense to always use actual pipes in Eshell when possible, instead >> of the process filter indirection? >> There exists already the *| operator from `em-extpipe'. What prevents us >> from making it the default (or enable it via customization) if `sh' is >> available? The downside is that `sh' is started as an intermediate >> process, but are their other downsides? For example piping though an >> Elisp function, which transforms the input, would not work, but this is >> not yet supported, or is it? As far as I understand *| is often more >> efficient, despite starting a separate shell process. > > Eshell will support piping to Lisp commands Soon(TM). I'm finishing up a patch > series that I hope to upload for discussion shortly. This has taken a *long* > time to get to the point where I haven't run into any major issues, but it's > finally coming together. Thanks, I am looking forward to that! > The larger problem is that it's impossible to determine at command-parsing time > whether a particular command is implemented entirely in Lisp or will create a > child process. "cat" is a good example: even as the leftmost command in a > pipeline, sometimes it's a Lisp command, and other times, it creates a child > process by throwing 'eshell-external' to replace the Lisp version of the > command. That makes it challenging to connect the pipes up correctly, since we > don't know which commands have real OS-provided pipes until command execution. > I'm not saying it's impossible, but it's definitely not easy. Makes sense. Daniel From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 28 01:35:18 2025 Received: (at 79079) by debbugs.gnu.org; 28 Jul 2025 05:35:18 +0000 Received: from localhost ([127.0.0.1]:53650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ugGW6-0004Wj-13 for submit@debbugs.gnu.org; Mon, 28 Jul 2025 01:35:18 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:60824) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ugGW2-0004Uk-9o for 79079@debbugs.gnu.org; Mon, 28 Jul 2025 01:35:15 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-23ffa7b3b30so8564415ad.1 for <79079@debbugs.gnu.org>; Sun, 27 Jul 2025 22:35:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753680908; x=1754285708; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=Lafgya5ykglqWdu3S40MfOEMNGEhKCv5v7gKaCQ86rc=; b=kc5t5CX+p7xPVG7Efu6GqC0x7MQcIssWYGNhdWxhz8EoVu4hVstzDxoKF/omiN7KRT FWfzJVrx8pHhlO+mDW8KpLyzDxttda2SjnFq3Uv/AVlARYWF7aasFhPSaOW6nZAXnJAv wj8lB/vrBaLjXof/bWvziPYsML15qTZwrJDQpJnKf5H5sNOyiSzuHtSzNbp+WxuM90el SVdLu+BQJoFjtVPOConB192NDw/9rX9iOAKy8WWpJa3RDDsOfgX4AakKkTYTshsIyXNj bIUGtqL8jQiI5pBeAywxeNNxRJTEBbeDnzrflUIsj6vBs6KOBryJmYqkjyfT1ROtklF/ NTew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753680908; x=1754285708; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Lafgya5ykglqWdu3S40MfOEMNGEhKCv5v7gKaCQ86rc=; b=ZDDrbQXNrq3MrDsUl/4XBNx0PzUGunKsdrhjpeH7jTz6+ah89egfPXSZGcRAF64omi aOWNQe9k1p/XK3F0T0Fp9mx+Y34TXtM6hUwOI7vWa11Y063FMQvmgsCDXZ7iXOTJOcd1 E6/uaYj4nZEP3JAjEr7QQ/uqs+/+wqoAjo3WMJubKl0yT/KAgxV8Xj0jcB4erryyySm5 iYq5sxn2w4a6/Nduv7BrhwpSGjY4WTSyQYW+YBwq0kw4bRGj2WrcyYNpVNCgfT5RbSpr L3NvsJlNrUkx2Z8tT19NMXC+2rOqfH5hKIyu7wqOXwL2agZSQUcSYw3wpT97A9+zIa5i 4M/A== X-Forwarded-Encrypted: i=1; AJvYcCUtkmCNXiaIuuDCfskEI3bt0q9qLu0SWKPQE4oqswPpqjlGElhtSsIiXBWf4zvBP4WT53854A==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwizfzXfEA4gl1CaD5KBb1jais/J+MfN9mG8qV5vZ/Jihb3ria6 ea5joXa+0m1QzxHGYZZ3Qhd48FbxbDIHEq/xRfg/9M7kRtOzRVlb5lEI X-Gm-Gg: ASbGncu7VsHRgqa5omDsAOa2cJ78JRT29C2YpNWHO1UqVHH8GkOzE6HOeOwAhl85vMc BeNApJJNrUGDSb9HORCQO0NdnfIgsxH02Yg9cVHgNd6dYggKZOTRMx0buFfwyeFWcr0W6Mkmm2N MNtDh7Yb7mG4aFvXZjEl6ikXVGJF+4h5uYxEJ91D6Ctap2WUKQvNBtTHsWSSjccQ+Tsg/9FJolk /Z3iHZIe78j0Os+W4wVJdNz5MZdDEs0syNAYXOmZf4B34olLwMw7K25eJ03M6bAG+MF3rQGTL33 Ld7SMGCTBuAworf8w01o6Mt6esKWgHsVJnB5vJbh2Z6nVxjBwF6sRA489iX1hlYnKILMyuNF5Cv zlrf/7ahCXE4rf9PF5nAzk6lQ/wcpUcyEWXatrqxPmRSLDETrO+rhqhs5tn9CwSJEdgENX+30rC 3YFQ== X-Google-Smtp-Source: AGHT+IFvUTJtx1ZojGGoIG4/DgTojJLgK2Zoalac/tzPexvMChY0dQvNPz0leQvCB170MNUc/Kltqw== X-Received: by 2002:a17:902:d052:b0:23f:eac4:c9bd with SMTP id d9443c01a7336-23feac4cd53mr57887285ad.34.1753680907938; Sun, 27 Jul 2025 22:35:07 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-23fbe564ce4sm44635045ad.187.2025.07.27.22.35.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Jul 2025 22:35:07 -0700 (PDT) Message-ID: <6730f969-acdc-7bcc-0aea-e70f036a8ca5@gmail.com> Date: Sun, 27 Jul 2025 22:35:07 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Paul Eggert References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <86cy9mz251.fsf@gnu.org> <18796019-0264-4d17-8fd8-035a4910e358@cs.ucla.edu> <86jz3ty77q.fsf@gnu.org> <3e5072c7-d287-44f0-9f38-ce77e6109aab@cs.ucla.edu> <86ikjdy2sm.fsf@gnu.org> <0d760231-21bd-4ad1-81fe-cec33856e33f@cs.ucla.edu> <1c056e9f-a4ed-93f2-4553-3883e067adf4@gmail.com> From: Jim Porter In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, Eli Zaretskii , 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 7/27/2025 3:03 PM, Paul Eggert wrote: > Thanks for the explanation. Is this documented? Might not hurt to do so > if it's not documented already. Maybe that can be part of your patch > series (and I can certainly sympathize with those patches taking time to > get right!) Not anywhere explicitly. Since I'm finishing up some patches to let Eshell pipe to Lisp commands, it would probably be wise to explain some of the details of how piping is different in Eshell in the manual. >>             ;; The output pipe broke, so send SIGPIPE to the >>             ;; process.  NOTE: Due to the additional indirection >>             ;; of Emacs process filters, the process will likely >>             ;; see the SIGPIPE later than it would in a regular >>             ;; shell, which could cause problems. > > Suppose we change Emacs to not send SIGPIPE to A in this situation, but > instead to just close Emacs's end of A's output pipe. Then when A > eventually gets around to writing to its output pipe it will get a > SIGPIPE if it is not ignoring that signal, and an EPIPE failure > otherwise, and this will be closer to what happens with ordinary shell > pipes. That's a good idea. I think that would be a much cleaner solution than what I wrote originally (which was somewhat limited since at the time I didn't have much familiarity with src/process.c). While it wouldn't be *exactly* the same as a POSIX shell, I think it would be close enough that it would be hard for a program to tell the difference. Some sort of 'process-close-stream' function that lets the caller close the stdout or stderr stream for the process (or stdin, but I don't think I need that here) should do the trick. Even better if we can support that in Tramp. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 15 16:55:37 2025 Received: (at 79079) by debbugs.gnu.org; 15 Aug 2025 20:55:37 +0000 Received: from localhost ([127.0.0.1]:39843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1un1Sa-0000zZ-K0 for submit@debbugs.gnu.org; Fri, 15 Aug 2025 16:55:37 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:46287) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1un1SX-0000zG-Cw for 79079@debbugs.gnu.org; Fri, 15 Aug 2025 16:55:35 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-76e2e614b84so2411044b3a.0 for <79079@debbugs.gnu.org>; Fri, 15 Aug 2025 13:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755291327; x=1755896127; darn=debbugs.gnu.org; h=in-reply-to:content-language:references:cc:to:from:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=cTDQmsbwIQnlhyAmf4FqS6i8uIflj4F4+YRbDsdVMMg=; b=e3avAPiwXyboH29/ETTEKxSKYVQz/szU7vPuqB+MxrCZKGyU4lusTCRek2nCSADoRj s+XRWLxvC84g5ka53bIHZaYFlQoNKcJMriqW7aMMPzRDTnR1HPVygR39HwQRMTC7ukmq 0PaQDmqFmP3isWdL01HKdIP1fZJ2LLkRaS5Nd0s3H/qNid2A9E5B3GdzKj8+ZLj+6LRQ eOwT5lqzvzuoErXhE2tZWTRiq16GGTbwYIHR9wPAZ+qIjvddNB/2AOS2FGKevygKx5eT QR+qxrE7LKPCFZ6g/Jvb+GVPtOLyWvsKqv7m8IpHCijA+GN3yGKlVdWi/B7NzHAok1iJ EnGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755291327; x=1755896127; h=in-reply-to:content-language:references:cc:to:from:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=cTDQmsbwIQnlhyAmf4FqS6i8uIflj4F4+YRbDsdVMMg=; b=gkmv8FSd05N8Sqx3lJi35/45/zd5/3kdNa4oKu9kt7nxkQkPgt3jNe96NG1CUFeh5O BotjX7o/sRf9jGTakcwlLqYoxcENVGDoJh31dyDy+4bLRyZ5qORt1SY0dTTlf2cWqD2K TATARk5ohAa2JfwmeGziHuqWhFGvrJV1u+QnfNOusizrIUdgyl5iiAIN6+Kku/EsAeuE rPrTZZKO46XLQJUlQcx+xiOspY9hifieDvwhqb9CpQznMxBOyCnPPtCJ9ZMKPxTTL4/X C7r1UnAlI0JtcxYBm2WVlIxqVG8lAtizCf+oIy8pRWvw5JYCimgRDhFH5ZxRmK5q8JPj XdJA== X-Forwarded-Encrypted: i=1; AJvYcCXXc/ub/1sENXA6op610Dw4rSWzU8e2xCpwhua+TdeZEZJz32c4qIBXrT1+2qT7hKPylh9i9w==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzVurNGfzKahq3H2+tmbj4/QdGmztDE96PG9Ub18+y4EwvJfkVb Hl238nxhZL4VSHG9wya/+Q+k7M3d7XzZtfYIv9ofNvNkaWj3ag8gG2Le X-Gm-Gg: ASbGncuKVOp63N6EcFmEEDkWjiO1R7ghli3890nZXR4VPt7kijqbxUTg7OST2JrQGMd IU0C6a3IzA0hedqpA2XD2a2ao5sdP3b1zwJkC8iN04+vuIzo2UhlyRkbRNmwWPcVNg57daZiGe5 GDJKUAF65j7IgrqE8sSOXstodrMkU4P8/UvChtuhTq2OlOTTiRgPcZbhKbjKUvpjZ98ia/uV513 DLpEUpwr2YuDkf//VA/D1aztwU1bDO5vRJXrkxf/5vk2qk24K6Or1RWOOJnnpJdnuyWdBQsZM5G yBCowhQG4ZcZ15h1f3BdxasjuWhL2xkRlSrw/4cySCwMOuxH2ELLVOho/xSvLD0e2KWCA+8emv/ 1SnxwiKnlHjYfmX1A2ddN3rZ3TxY3jAPDTrZUZ4tT6bNqWpqb0imASA/ZOw10gspiRUcZ2TIzV6 77o2vMKg/q2HXE X-Google-Smtp-Source: AGHT+IERLqrpCITGYUBQpSztkun9UwyX2U10q36CVsa5BA0PwEQfguOLTszLeHSh8gTc//p9nfgA6g== X-Received: by 2002:a05:6a21:9994:b0:240:195a:8333 with SMTP id adf61e73a8af0-240d2e5b843mr5740773637.14.1755291326792; Fri, 15 Aug 2025 13:55:26 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-b472d735e83sm2070949a12.33.2025.08.15.13.55.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Aug 2025 13:55:25 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------CpEeXAnraKiNjJoDcCjInP48" Message-ID: Date: Fri, 15 Aug 2025 13:55:27 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell From: Jim Porter To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> Content-Language: en-US In-Reply-To: <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------CpEeXAnraKiNjJoDcCjInP48 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Attached is a patch for this with some regression tests (unfortunately, we can only run them in an interactive session, since Emacs will terminate itself in batch mode upon receiving a SIGPIPE). I've also called out the change in NEWS so that users are aware. On 7/26/2025 2:12 PM, Jim Porter wrote: > After examining this more closely, there are three problems with the > current Emacs code, of varying importance: > > 1. When we receive an EPIPE, we don't call our process-filter one last > time (this is the original bug report). You can see this by running the > following Eshell command repeatedly until it produces no output: > >   git log | head -n 10 | cat > > 2. When we receive an EPIPE, we set the exit status to 256; that's not > right, since the exit status should be 0. You can see this by running > the following Eshell command until the prompt shows a non-zero status: > >   git log | head -n 10 > # > > 3. If the child process closes stdin and wants to keep doing some work > (like write to stdout), it can't, since we called 'deactivate_process'. > You can see this with the attached script by running (it's supposed to > print the first line of "git log"): > >   git log | ./test-script.sh > > I've also attached two WIP patches for the different implementations. > "bad-call-filter.diff" uses 'read_process_output' to call our process > filter. It only solves issue #1 above. "good-close-pipe.diff" (which I > posted previously) solves all three issues. While the latter is a > slightly bigger change and requires some more testing on my end to make > sure I've covered 100% of the cases, I think it's the more-correct > solution. If we make the bigger change, it's probably worth calling it > out in NEWS and on emacs-devel so that people can be on the lookout for > any edge cases I haven't identified. --------------CpEeXAnraKiNjJoDcCjInP48 Content-Type: text/plain; charset=UTF-8; name="0001-Allow-child-processes-to-continue-after-EPIPE.patch" Content-Disposition: attachment; filename="0001-Allow-child-processes-to-continue-after-EPIPE.patch" Content-Transfer-Encoding: base64 RnJvbSBkOWViOTE5OWUzZjBjN2Y4YmYxZGM0NDUwNDcyNjZmYjQ4Y2I4Njc4IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IEZyaSwgMTUgQXVnIDIwMjUgMTM6NDQ6MDMgLTA3MDAKU3ViamVjdDogW1BB VENIXSBBbGxvdyBjaGlsZCBwcm9jZXNzZXMgdG8gY29udGludWUgYWZ0ZXIgRVBJUEUKClRo aXMgZW5zdXJlcyB0aGF0IGlmIHRoZSBjaGlsZCBwcm9jZXNzIGNsb3NlZCBpdHMgc3RkaW4g YW5kIEVtYWNzIHRyaWVzCnRvIHdyaXRlIHRvIGl0LCB0aGUgcHJvY2VzcyBjYW4gc3RpbGwg ZG8gYW55IHJlbWFpbmluZyB3b3JrIGFuZCBleGl0Cm5vcm1hbGx5LiAgSW4gcHJhY3RpY2Us IHRoaXMgY2FuIG9jY3VyIHdpdGggY29tbWFuZHMgbGlrZSAiaGVhZCgxKSIKKGJ1ZyM3OTA3 OSkuCgoqIHNyYy9wcm9jZXNzLmMgKHNlbmRfcHJvY2Vzcyk6IFdoZW4gZW5jb3VudGVyaW5n IEVQSVBFLCBvbmx5IGNsb3NlIHRoZQpmZCBmb3IgdGhlIHBpcGUgdG8gdGhlIGNoaWxkIHBy b2Nlc3MncyBzdGRpbi4KCiogbGlzcC9lc2hlbGwvZXNoLWlvLmVsIChlc2hlbGwtb3V0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mQgKG5vdCBu b25pbnRlcmFjdGl2ZSkKKyAgICAgICAgICAgKGV4ZWN1dGFibGUtZmluZCAic2giKSkKKyAg KGVydC1kZWZ0ZXN0IHByb2Nlc3MtdGVzdHMvYnJva2VuLXBpcGUvcGlwZSAoKQorICAgIChw cm9jZXNzLXRlc3RzL2Jyb2tlbi1waXBlICdwaXBlKSkKKworICAoZXJ0LWRlZnRlc3QgcHJv Y2Vzcy10ZXN0cy9icm9rZW4tcGlwZS9wdHkgKCkKKyAgICAocHJvY2Vzcy10ZXN0cy9icm9r ZW4tcGlwZSAncHR5KSkKKworICAoZXJ0LWRlZnRlc3QgcHJvY2Vzcy10ZXN0cy9icm9rZW4t cGlwZS9waXBlLXN0ZGluICgpCisgICAgKHByb2Nlc3MtdGVzdHMvYnJva2VuLXBpcGUgJyhw aXBlIC4gcHR5KSkpCisKKyAgKGVydC1kZWZ0ZXN0IHByb2Nlc3MtdGVzdHMvYnJva2VuLXBp cGUvcHR5LXN0ZGluICgpCisgICAgKHByb2Nlc3MtdGVzdHMvYnJva2VuLXBpcGUgJyhwdHkg LiBwaXBlKSkpKQorCiAoZXJ0LWRlZnRlc3QgcHJvY2Vzcy1udW0tcHJvY2Vzc29ycyAoKQog ICAiU2FuaXR5IGNoZWNrcyBmb3IgbnVtLXByb2Nlc3NvcnMuIgogICAoc2hvdWxkIChlcXVh bCAobnVtLXByb2Nlc3NvcnMpIChudW0tcHJvY2Vzc29ycykpKQotLSAKMi4yNS4xCgo= --------------CpEeXAnraKiNjJoDcCjInP48-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 16 02:04:41 2025 Received: (at 79079) by debbugs.gnu.org; 16 Aug 2025 06:04:41 +0000 Received: from localhost ([127.0.0.1]:40498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unA1w-00044L-QD for submit@debbugs.gnu.org; Sat, 16 Aug 2025 02:04:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59156) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1unA1s-000445-Vm for 79079@debbugs.gnu.org; Sat, 16 Aug 2025 02:04: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 ) id 1unA1m-0004gQ-1K; Sat, 16 Aug 2025 02:04:30 -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=5JALa00OUFSf0nJzCN39Q6qtOGWism4xaWd9fajhWFk=; b=MmuLlDYb54jy Af8rglOufCoCq/epYFL00f1T5jhr2jcA0i91UFLUaucH38Mx+t5a61LnOSNBlCrMzcp0+d8RfSDxd obNs7dJuj5/gTMkCmr4Qc8Np7ho+5r5fysCalfog1kWVRahLX05EZ6N0nRvJu1P9nYJD3PsenUXVi n34FCD1SdYeTH/5OFSD9PWXZNJwKnz8GB58bQf1Z/hSCX0mO5FfE60kEMPrGNA04w/090us7+/Zla GU6gaWOzKFkVVYRmYUxSJc/nf/1h8G0bT66N9BjavUxJk1yoFoMCZ9XoOZXCDhiRlB0I7vcdxoliA niFXifG1aQZ4Rzq805DC3Q==; Date: Sat, 16 Aug 2025 09:04:27 +0300 Message-Id: <86qzxbls44.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: (message from Jim Porter on Fri, 15 Aug 2025 13:55:27 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 15 Aug 2025 13:55:27 -0700 > From: Jim Porter > Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org > > else if (errno == EPIPE) > { > - p->raw_status_new = 0; > - pset_status (p, list2 (Qexit, make_fixnum (256))); > - p->tick = ++process_tick; > - deactivate_process (proc); > + close_process_fd(&p->open_fd[WRITE_TO_SUBPROCESS]); ^ SPC before the open parenthesis missing there. > +(defun process-tests/broken-pipe (connection-type) > + "Test handling of broken pipes; see bug#79079. > +This test runs a shell script that reads a line of text and closes > +stdin. We send two lines of text to the script; the second should > +signal an error indicating that the pipe has been closed. The script > +should also run to completion, printing out the line of text it read." > + (with-temp-buffer > + (let ((saw-error nil) > + (proc (make-process > + :name "test" :buffer (current-buffer) > + :command '("sh" "-c" > + "read line; exec 0<&-; sleep 1; echo $line") This will not work on Windows. Can you come up with a test which doesn't use features specific Posix shells? E.g., can you perhaps use Emacs itself as the other end of the pipe, running some special Lisp program? > + (ert-deftest process-tests/broken-pipe/pty () > + (process-tests/broken-pipe 'pty)) > + > + (ert-deftest process-tests/broken-pipe/pipe-stdin () > + (process-tests/broken-pipe '(pipe . pty))) > + > + (ert-deftest process-tests/broken-pipe/pty-stdin () > + (process-tests/broken-pipe '(pty . pipe)))) > + The PTY tests should be skipped on Windows, since PTYs aren't supported there. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 16 13:19:29 2025 Received: (at 79079) by debbugs.gnu.org; 16 Aug 2025 17:19:29 +0000 Received: from localhost ([127.0.0.1]:43382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unKYz-0000Zq-3f for submit@debbugs.gnu.org; Sat, 16 Aug 2025 13:19:29 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:51533) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1unKYx-0000ZT-CZ for 79079@debbugs.gnu.org; Sat, 16 Aug 2025 13:19:28 -0400 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-7438200b29cso626707a34.3 for <79079@debbugs.gnu.org>; Sat, 16 Aug 2025 10:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755364761; x=1755969561; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=eL3eM15qBtnGnJs7ppWx5VBlwBXrSj/JV0NqfrrcBLA=; b=CB6j6ffYBOmDom/e9AWF4Tsq5TYOGYJ+vX4sCiEQOmK2ZBAgFF7dlpi05jk/Tumly1 dxvHHKkvh6KdK08RS/baIkIg4Y4p4kENRS2wWL8evesca0Ap0Ok8qC7WEH95DGqs9JPy ktql4ovZu+wjk4j7VXLtX++fRTaCe40dmECLFS5dHOIk6gWhTVqswpo4sOThzmebXy7N n8YcLUtLoQk0/1QCufdUUnGawzOqJghAe2QU2cxzcFwOW6uZx6Opox0uzCP6ng4pr1Jt DYVMrl5IEuEU6JuIY0oH8+j0c5VxU8H8h8jymW2czsUrQlIU1hnbO5QRy5sYd+m4v6yT cNbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755364761; x=1755969561; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eL3eM15qBtnGnJs7ppWx5VBlwBXrSj/JV0NqfrrcBLA=; b=JZ+wgdCR07YXUdNlzjndKkeiWc33FVcgRbm5YyqaDSFE5x+g7M5fQiQabYsOjciR0H PBnE1Qe7ZzTKFY3oyiJtJKOnLwUrk0LMQc9Zm1BXj9ATCaN6duuWojQwwMBLNq6IhaUi WZyXhnVPZhiySxi71PPkupuAwCZZkKrt3LkUmEMdZmEPXvFni9XAMZWoqHd10rlSjs0m nDijzjY3P9+5qZFQfHUrxAOIjRqVBzaRp5gDEwuLyj9i/KfE2TE7EvTjbkXcquk3wU6Y g/ELRAaVB5J4fEFpsiAFE3egx51Mst3zu/1wBHCg7+QibaD1fWXtgxUcV8W2kbrLUkCu sZ3g== X-Forwarded-Encrypted: i=1; AJvYcCXd4PvDrtfEHYjunAqmvEB9spG623Resge6lhdUNCWUgNGlVK7dBmN1uUFN2YaPsOibQTZ2fw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxTYeA+oqoZXxFSvCzvph9pN+FoMLdlm6CsdQ3oUCLybPcjc8JS u1u1TzNytNns11AoWuZxwlU2jk54ty5M4O+AZVfy/Ct802RUtQ/1+s7a X-Gm-Gg: ASbGncvS7c7/+jTp57lxQXLcSZPLBmCjyLj+XgoKXfBIIzl42ixgOCN3zFTkBDCBCbz fcbXacvgH/GzjaJHwtwUTa4StzeXkwaEXIFYJfFz+nzCpDzqytOMLKS1bvIK1atV0eR/xmcmGy8 ww9nlrJTpMIbZaTq0PS9V5vobNaGZ6H5XMjyR3BXcZzSZJYNP3DXKN9EyEM6GC47Jcb0SEz2izu GcQ1kAqiyHAKovWZUsBsJ1g41iwCI5o4GHFUNS9b/WymNbFEWx5a1rlQS1QiMz8TO7lIImtzAG2 bYncPsDMIkJCOESlqGt2J9yvnJq/LhSIEKT2pZqpJiO4MN6KfdiG8qOMM/mlK+pxcdIibzIWVQp qJpy52Zq0J46rQgwRofEuuIdrWMwLW4dmbpque8ElXkg+iksHwV5sFsfdtjLfrl1CpusbGWl7Jf nTxg== X-Google-Smtp-Source: AGHT+IHA+KUqxMf3AGnIN1EYQTPYl16bsa6fsTtOrH90shgqZstqe6lRvAtJHJSXSqA5euyn/+TyPQ== X-Received: by 2002:a05:6830:6102:b0:73e:996d:ccd8 with SMTP id 46e09a7af769-7439baacd75mr2170226a34.21.1755364760948; Sat, 16 Aug 2025 10:19:20 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id 46e09a7af769-7439203b4fesm935120a34.30.2025.08.16.10.19.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Aug 2025 10:19:20 -0700 (PDT) Message-ID: <37eb6d73-a1a3-ddad-9f7e-ab41a80f3091@gmail.com> Date: Sat, 16 Aug 2025 10:19:21 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> <86qzxbls44.fsf@gnu.org> From: Jim Porter In-Reply-To: <86qzxbls44.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 8/15/2025 11:04 PM, Eli Zaretskii wrote: >> +(defun process-tests/broken-pipe (connection-type) >> + "Test handling of broken pipes; see bug#79079. >> +This test runs a shell script that reads a line of text and closes >> +stdin. We send two lines of text to the script; the second should >> +signal an error indicating that the pipe has been closed. The script >> +should also run to completion, printing out the line of text it read." >> + (with-temp-buffer >> + (let ((saw-error nil) >> + (proc (make-process >> + :name "test" :buffer (current-buffer) >> + :command '("sh" "-c" >> + "read line; exec 0<&-; sleep 1; echo $line") > > This will not work on Windows. Can you come up with a test which > doesn't use features specific Posix shells? E.g., can you perhaps use > Emacs itself as the other end of the pipe, running some special Lisp > program? I thought that building Emacs on Windows used MSYS2, which provides a Posix shell implementation. Am I just mistaken here? It doesn't look like Emacs has the ability to close a file descriptor from Lisp. I could add a C function to do this from Lisp, but I don't know if it would be useful outside of this one test. Another alternative would be to write a small C program to call for this test. That's probably straightforward if I can figure out the right place to insert the necessary Makefile logic... >> + (ert-deftest process-tests/broken-pipe/pty () >> + (process-tests/broken-pipe 'pty)) >> + >> + (ert-deftest process-tests/broken-pipe/pipe-stdin () >> + (process-tests/broken-pipe '(pipe . pty))) >> + >> + (ert-deftest process-tests/broken-pipe/pty-stdin () >> + (process-tests/broken-pipe '(pty . pipe)))) >> + > > The PTY tests should be skipped on Windows, since PTYs aren't > supported there. The tests aren't especially useful on Windows, but they should pass (assuming the pipe test does), since on Windows we always use a pipe, even if the user requests a PTY. Covering these cases would catch any bugs related to that, and would also mean we don't need to adjust these later if we one day can support PTYs on Windows (I know this is really up to Microsoft fixing their bugs though). That said, I don't really have a strong preference here and don't have a problem with removing these calls. (Finally, it'd be nice if we could run these tests within a batch Emacs session, but then we'd need to arrange things to handle SIGPIPE in batch Emacs.) From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 16 15:22:43 2025 Received: (at 79079) by debbugs.gnu.org; 16 Aug 2025 19:22:43 +0000 Received: from localhost ([127.0.0.1]:43547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unMUE-0006kg-FK for submit@debbugs.gnu.org; Sat, 16 Aug 2025 15:22:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34220) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1unMUA-0006kL-Iu for 79079@debbugs.gnu.org; Sat, 16 Aug 2025 15:22:40 -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 ) id 1unMU3-0006Fo-RB; Sat, 16 Aug 2025 15:22:31 -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=MrgBOKvaOUxcXGY8kXLuIzvN2bikxhQw9Z0x2ArtY/c=; b=A7X3Olun+PsB YJiCll7z70vWLgzuH+mq7GIh58QLJxk62FxFOavehDr/czPBGIx3XksEJK4tuYwzDUOctyiJstrjq 7dMPilmmkl1hJnYPFt9RMFO7jHfFetcftLyNPFLohvTrpTEdSwaGySE3tWTJ4z1mwuay+asFVviu8 rACC8/ql8F5S8cC1PF1gaRUphAZQfCE0fWoc0PR7R4168Kb4U18uALOPAhgQ9pPgoUjBi8X4EypkI JQVkVrJSiVlpuiKlU/NdESgq92bnNhOYe1uXxP7ODealm7CbKaqOSl8ZTpqVdx8e7iHcZcGrNfDkz r0Q76soJpK3nbi8p+MRJCw==; Date: Sat, 16 Aug 2025 22:21:56 +0300 Message-Id: <861ppbjcmj.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: <37eb6d73-a1a3-ddad-9f7e-ab41a80f3091@gmail.com> (message from Jim Porter on Sat, 16 Aug 2025 10:19:21 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> <86qzxbls44.fsf@gnu.org> <37eb6d73-a1a3-ddad-9f7e-ab41a80f3091@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 16 Aug 2025 10:19:21 -0700 > Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org > From: Jim Porter > > On 8/15/2025 11:04 PM, Eli Zaretskii wrote: > >> +(defun process-tests/broken-pipe (connection-type) > >> + "Test handling of broken pipes; see bug#79079. > >> +This test runs a shell script that reads a line of text and closes > >> +stdin. We send two lines of text to the script; the second should > >> +signal an error indicating that the pipe has been closed. The script > >> +should also run to completion, printing out the line of text it read." > >> + (with-temp-buffer > >> + (let ((saw-error nil) > >> + (proc (make-process > >> + :name "test" :buffer (current-buffer) > >> + :command '("sh" "-c" > >> + "read line; exec 0<&-; sleep 1; echo $line") > > > > This will not work on Windows. Can you come up with a test which > > doesn't use features specific Posix shells? E.g., can you perhaps use > > Emacs itself as the other end of the pipe, running some special Lisp > > program? > > I thought that building Emacs on Windows used MSYS2, which provides a > Posix shell implementation. Am I just mistaken here? Building, yes. But this is a test suite, not a build script. > It doesn't look like Emacs has the ability to close a file descriptor > from Lisp. I could add a C function to do this from Lisp, but I don't > know if it would be useful outside of this one test. There's nothing wrong in having a function for the benefit of running tests. If suitably documented, it's okay, I think. > Another alternative would be to write a small C program to call for this > test. That's probably straightforward if I can figure out the right > place to insert the necessary Makefile logic... That would need a C compiler to run the test suite, something that is much less desirable. > >> + (ert-deftest process-tests/broken-pipe/pty () > >> + (process-tests/broken-pipe 'pty)) > >> + > >> + (ert-deftest process-tests/broken-pipe/pipe-stdin () > >> + (process-tests/broken-pipe '(pipe . pty))) > >> + > >> + (ert-deftest process-tests/broken-pipe/pty-stdin () > >> + (process-tests/broken-pipe '(pty . pipe)))) > >> + > > > > The PTY tests should be skipped on Windows, since PTYs aren't > > supported there. > > The tests aren't especially useful on Windows, but they should pass > (assuming the pipe test does), since on Windows we always use a pipe, > even if the user requests a PTY. What would be the purpose of running the same tests several times? > Covering these cases would catch any > bugs related to that, and would also mean we don't need to adjust these > later if we one day can support PTYs on Windows (I know this is really > up to Microsoft fixing their bugs though). When we have a decent PTY support on Windows, this test will be the least of our problems, given how much stuff will need to change. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 16 19:55:11 2025 Received: (at 79079) by debbugs.gnu.org; 16 Aug 2025 23:55:11 +0000 Received: from localhost ([127.0.0.1]:44029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unQju-0003iq-Id for submit@debbugs.gnu.org; Sat, 16 Aug 2025 19:55:11 -0400 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]:54458) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1unQjp-0003cx-0h for 79079@debbugs.gnu.org; Sat, 16 Aug 2025 19:55:08 -0400 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-61bd4ad64c7so959457eaf.0 for <79079@debbugs.gnu.org>; Sat, 16 Aug 2025 16:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755388499; x=1755993299; darn=debbugs.gnu.org; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=IBTVKmf9o4jAW1DOCSINGCSabGRucJkDwtNdk2A5mIU=; b=EDklpz2x//ce3NjfwfVXn6LMEkLF8xu5vyi+iqiAsXFcFhMCttW2frNfPD+WN+diHm 9t7fECus1HEqgai+s1frKXV0hnSr6QWMUbcNiFxoTP96qjN5yLVcjU6XcQZAUJHh+olA 9j8B9CmxLRf+RWtnMPWOhrfqipi74eTv1M3ziDDGiHng8FS4xkzsZKAf2CgmV8WNAzPr zPwiwLGNlPSdSscmA7ZGSMo1bcGPYIR8sIwcum6adlTG1OvCuGKqJpuww3HwoLGrGcIB +VoHcAmvgAdrdT0HgL+0wNY0cKj6QF9Ary4gRmEV1PxJCn0QqENROagGKBxPBe+vvYtM yIbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755388499; x=1755993299; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=IBTVKmf9o4jAW1DOCSINGCSabGRucJkDwtNdk2A5mIU=; b=dVuNHAoyLQ7M/VAeE4D8EQd2xNNBIyyhpQfmQhfs7a5MPMB+bMuoQCQNHDCjnpDdtk GTngYvASoqiLA9SnpVln8APBSNQaJ1U/5+DDBTjYerl8G1HedcwLcNFjKbhyELkx14Js RQ4Amzgt/0RQCUnbQk6k+AGpzEdFpaYT3NhpvuztG7jil9DH5bLB2mvWYwXRb6MAAWuI 5ao0iVMZJ4nynvW3JsnrJyFfXdcKgEL9HmD/t0kjUNszn+RTWs9ecMpMGJBkWRPhqBU9 OuZUEdhcAjtp4tg2rNVfSufBoXrMGFXuQaoiPm5S8Em65V1P1LPtvjywLSYg+wIsyq2J OcsQ== X-Forwarded-Encrypted: i=1; AJvYcCUikX0KEy2jXtnsYl3QzFw7UEw4pImPgbe65srHnDj3nq4R4nwqaDdT+7RXgHirtWN8CUqkRg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxWaGIVeToCN+VevJ97BsjbMTRxFzT5LZ0BA1HgoxE4VFGIFbJF NXvv1tRMDRUDDVC411vjfIjPGJ9IwCaQyu9l1+2Dmpws7rEs9lSI/Ro8 X-Gm-Gg: ASbGncvWsLkRNDv5qokNnJNs3qmzUyyxZ8r7+MhpG5X/oVAjnXsSvqsGxCIMehkLC1e IQdPKe2z9koEAMcftOaccmS9tXnzEw0pFg9E5gnb7xif7QeRkWySy7Xr2Rh3oq41fqGhlH6Bp9p kjnnsmqdoM7PQkYpEU3v0wMUMTVaiPQEflKakeK19Lm+GxoX8LwrcrV+wfKuqd2OX+cxvsCIkAF djwLInvrQszTSAKdQp26F+hUm12S3v65qHltdP09L2PdtL+X6pp7HGwnomKAJmCxL4g0WlABXDQ fQHM7gQXI9YqGi7CsIE0KCmb0WESIoRWxKDNL3TqeYowZy/bDPoWp9Wkn+Dgh+O6ruke1boMIlG HHKHQkk4u+D6F67QI3eebIrHum72OxdrCzTsMdiVUhzKmCnTwf0v36W3kRrh1sSWxrB1CB+YcQJ KsHg== X-Google-Smtp-Source: AGHT+IFjXzDGaDCYF/rwcmR167S/UhEGkPIvpV9wf08rvO/mfUGM4KsbDinKMVMs5WwXag1v+cOvGA== X-Received: by 2002:a05:6820:1b84:b0:61b:d3dc:89e with SMTP id 006d021491bc7-61bea552410mr5291531eaf.0.1755388498692; Sat, 16 Aug 2025 16:54:58 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id 006d021491bc7-61bec11cd94sm545449eaf.21.2025.08.16.16.54.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Aug 2025 16:54:57 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------HWs5CXqaoazF9uyjiMXX09Ol" Message-ID: <9a2eac94-62a4-511c-011f-aec83ca79223@gmail.com> Date: Sat, 16 Aug 2025 16:54:57 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> <86qzxbls44.fsf@gnu.org> <37eb6d73-a1a3-ddad-9f7e-ab41a80f3091@gmail.com> <861ppbjcmj.fsf@gnu.org> From: Jim Porter In-Reply-To: <861ppbjcmj.fsf@gnu.org> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------HWs5CXqaoazF9uyjiMXX09Ol Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/16/2025 12:21 PM, Eli Zaretskii wrote: >> Date: Sat, 16 Aug 2025 10:19:21 -0700 >> Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org >> From: Jim Porter >> >> It doesn't look like Emacs has the ability to close a file descriptor >> from Lisp. I could add a C function to do this from Lisp, but I don't >> know if it would be useful outside of this one test. > > There's nothing wrong in having a function for the benefit of running > tests. If suitably documented, it's okay, I think. Ok, now done. I've added a new function called 'internal-close-stream'. Hopefully the documentation is clear enough (it's a pretty simple function). >> The tests aren't especially useful on Windows, but they should pass >> (assuming the pipe test does), since on Windows we always use a pipe, >> even if the user requests a PTY. > > What would be the purpose of running the same tests several times? Just one fewer conditional in the tests, but that's not a big deal. I've change this to run only the "pipe" case under MS-Windows. --------------HWs5CXqaoazF9uyjiMXX09Ol Content-Type: text/plain; charset=UTF-8; name="0001-Allow-child-processes-to-continue-after-EPIPE.patch" Content-Disposition: attachment; filename="0001-Allow-child-processes-to-continue-after-EPIPE.patch" Content-Transfer-Encoding: base64 RnJvbSA5YzliYzAyN2NhNjNhZmU0Zjg2YTc0Y2Y0ODZlZGUxYTk3ZTg0Nzg0IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IEZyaSwgMTUgQXVnIDIwMjUgMTM6NDQ6MDMgLTA3MDAKU3ViamVjdDogW1BB VENIXSBBbGxvdyBjaGlsZCBwcm9jZXNzZXMgdG8gY29udGludWUgYWZ0ZXIgRVBJUEUKClRo aXMgZW5zdXJlcyB0aGF0IGlmIHRoZSBjaGlsZCBwcm9jZXNzIGNsb3NlZCBpdHMgc3RkaW4g YW5kIEVtYWNzIHRyaWVzCnRvIHdyaXRlIHRvIGl0LCB0aGUgcHJvY2VzcyBjYW4gc3RpbGwg ZG8gYW55IHJlbWFpbmluZyB3b3JrIGFuZCBleGl0Cm5vcm1hbGx5LiAgSW4gcHJhY3RpY2Us IHRoaXMgY2FuIG9jY3VyIHdpdGggY29tbWFuZHMgbGlrZSAiaGVhZCgxKSIKKGJ1ZyM3OTA3 OSkuCgoqIHNyYy9maWxlaW8uYyAoZmlsZV9mb3Jfc3RyZWFtKTogTmV3IGZ1bmN0aW9uLCBl eHRyYWN0ZWQgZnJvbS4uLgooRnNldF9iaW5hcnlfbW9kZS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AgICAgICAgICAgLChwcmluMS10by1zdHJpbmcKKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICcobGV0ICgobGluZSAocmVhZC1zdHJpbmcgIiIpKSkK KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChpbnRlcm5hbC1jbG9zZS1zdHJl YW0gJ3N0ZGluKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHNpdC1mb3Ig MSkKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChtZXNzYWdlICIlcyIgbGlu ZSkpKSkKKyAgICAgICAgICAgICAgICAgOmNvbm5lY3Rpb24tdHlwZSAncGlwZSkpKQorICAg ICAgKHByb2Nlc3Mtc2VuZC1zdHJpbmcgcHJvYyAiaGVsbG9cbiIpCisgICAgICAoc2l0LWZv ciAwLjEpCisgICAgICAoY29uZGl0aW9uLWNhc2UgZXJyCisgICAgICAgICAgKHByb2Nlc3Mt c2VuZC1zdHJpbmcgcHJvYyAiZXh0cmFcbiIpCisgICAgICAgIChlcnJvcgorICAgICAgICAg KHNldHEgc2F3LWVycm9yIHQpCisgICAgICAgICAoc2hvdWxkIChlcXVhbCAoZXJyb3ItbWVz c2FnZS1zdHJpbmcgZXJyKQorICAgICAgICAgICAgICAgICAgICAgICAgKGNvbmNhdCAiUHJv Y2VzcyB0ZXN0IG5vIGxvbmdlciBjb25uZWN0ZWQgdG8gcGlwZTsgIgorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAiY2xvc2VkIGl0IikpKSkpCisgICAgICAodW5sZXNzIHNh dy1lcnJvcgorICAgICAgICAoZXJ0LWZhaWwgIkV4cGVjdGVkIGVycm9yIGZyb20gYHByb2Nl c3Mtc2VuZC1zdHJpbmcnIikpCisgICAgICA7OyBXYWl0IGZvciB0aGUgcHJvY2VzcyB0byBm aW5pc2gsIGFuZCBjaGVjayByZXN1bHRzLgorICAgICAgKHdoaWxlIChlcSAocHJvY2Vzcy1z dGF0dXMgcHJvYykgJ3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gICAgIChwcm9jZXNzLXRlc3RzL2Jyb2tlbi1waXBlICcocHR5IC4gcGlwZSkpKSkpCisK IChlcnQtZGVmdGVzdCBwcm9jZXNzLW51bS1wcm9jZXNzb3JzICgpCiAgICJTYW5pdHkgY2hl Y2tzIGZvciBudW0tcHJvY2Vzc29ycy4iCiAgIChzaG91bGQgKGVxdWFsIChudW0tcHJvY2Vz c29ycykgKG51bS1wcm9jZXNzb3JzKSkpCi0tIAoyLjI1LjEKCg== --------------HWs5CXqaoazF9uyjiMXX09Ol-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 17 01:03:55 2025 Received: (at 79079) by debbugs.gnu.org; 17 Aug 2025 05:03:55 +0000 Received: from localhost ([127.0.0.1]:44542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unVYh-0002lH-DB for submit@debbugs.gnu.org; Sun, 17 Aug 2025 01:03:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46090) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1unVYd-0002l1-SI for 79079@debbugs.gnu.org; Sun, 17 Aug 2025 01:03:53 -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 ) id 1unVYW-00088C-QC; Sun, 17 Aug 2025 01:03:44 -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=i2/OXL5Fl0jfxkkDFt3bvvSARs/kbPWrqYs6qlmExbw=; b=q12iA0Ljyj49 3/I2HSqNNK6qhcc8Ee1cXsprVPhSfDiOvPR23aAkFGW0p0RhgI5tI7VChgTZB38zuFix4hiAiFnsZ w6pI6Wih5N6mxdHE2BX1BzuExvJHLjqdB48eWiWtMXZQTD/6unBU3SjwvwwpDclT7fOCM/3URDNaD +iIbV4eUc2TOe3/J8jD6VuCyeuPv9E6qTPodaN/vTLUqEZxTyav0TcTexKbbF4GM1mF5ZqtgpaEo5 oIO6GryMt7VG04XmCPmu0HvCxa0OhBBnONowxy0clKbMpT1uLCupXDPUOTxGm1XMOPxKfBo+epgyv yBF0gbb6T/6PSbGB8M5eWg==; Date: Sun, 17 Aug 2025 08:03:40 +0300 Message-Id: <86wm72iloz.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: <9a2eac94-62a4-511c-011f-aec83ca79223@gmail.com> (message from Jim Porter on Sat, 16 Aug 2025 16:54:57 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> <86qzxbls44.fsf@gnu.org> <37eb6d73-a1a3-ddad-9f7e-ab41a80f3091@gmail.com> <861ppbjcmj.fsf@gnu.org> <9a2eac94-62a4-511c-011f-aec83ca79223@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 16 Aug 2025 16:54:57 -0700 > Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org > From: Jim Porter > > +static FILE * > +file_for_stream(Lisp_Object stream) ^^ SPC missing there. > +{ > + CHECK_SYMBOL (stream); Calls to CHECK_* should be made by the primitive itself, not by its subroutine. This is to allow the subroutines to be called where such tests were already done, or are inappropriate. The idea is that only stuff exposed to Lisp validates the Lisp objects passed as arguments. > +DEFUN ("internal-close-stream", Finternal_close_stream, Nowadays we use "--" in the name of internal functions. I suggest to call this file--close-stream instead. > + Sinternal_close_stream, 1, 1, 0, > + doc: /* Close the file associated with STREAM. This doesn't close the file, it closes the STREAM. I suggest to rephrase: Close the standard STREAM of the Emacs process. P.S. I'd like to see what this does on Windows, where there's neither SIGPIPE nor EPIPE, but that's a separate funeral. From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 17 02:34:00 2025 Received: (at 79079) by debbugs.gnu.org; 17 Aug 2025 06:34:00 +0000 Received: from localhost ([127.0.0.1]:44696 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unWxr-0007gI-JI for submit@debbugs.gnu.org; Sun, 17 Aug 2025 02:34:00 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:60641) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1unWxo-0007fz-8V for 79079@debbugs.gnu.org; Sun, 17 Aug 2025 02:33:57 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-76e563b25c4so338802b3a.0 for <79079@debbugs.gnu.org>; Sat, 16 Aug 2025 23:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755412430; x=1756017230; darn=debbugs.gnu.org; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=Evp7TSWdcSbeqFbxUXsi7PlLHNvE8KHTPdLNCOHimGU=; b=ZnIQ0cG0ws/NgeLxTALvpDTNdgHMDP5F8WOyzPr3p3Da6G/vnjfFOXz1nl/xru7UMw 5eW2DXExCuKVQXu2MyDIddJsDsQ7POEry8Pkb9RiVN8sHNRIaBACtaO3fODnOjLIH4VB S1r7uAD9yVg3mwV2aK+fIeaDhkF6ai18csQ6p68rXQHNW/PnX+TooJrtBenAUAJqP8aH 2xnlc9O3v5J/AjlM6ag6Uxltd7/etB2duPm5+VnwVxpxhZwuxcJ2ljBZj+2lnM/zQW8u 8z8eijWE/xecGSTPVQ/Zdw30YRRS225P7B2yD9xPnZW3t4iuPRICE2Z67Fbv8ddBTUQI FFCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755412430; x=1756017230; h=in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Evp7TSWdcSbeqFbxUXsi7PlLHNvE8KHTPdLNCOHimGU=; b=DyqDBwWjYhqGGwSRGOyT3NHAqiFVgpIVZyLwFazWArPgGXcXp1GeK9nxC8GEh/u6aD kDm/HlTTnVhNbmnMpcdSuBlrs1sgzFxyuk1wpyhHqJWfr4TMbko+7rkTNfi1XY+08DkC FgkriA1ZAkIlsINdllHVpOso6S6oKMsIF8xljbKxs1NEIWUCTbMunvuh4xrvVQrpXNCc xirfXrZfXhKTaJuU3IFGXaPWuyED5hI1F4MJB+8Iz+3/uBWyT5jIfhW4klkK9Hrg7CL3 g10XjFo1ew2R7gaR9Qn7ZcfzIQ3nrx32mJNQYEzlBpApBZwAiYzVKiAW2JKHR0KqwwmZ yAqw== X-Forwarded-Encrypted: i=1; AJvYcCVMl9BL3cAZUxrLekgrHL5sQb8vyH2/TlpDFz4cU6Wr/8pgDX2xiAWnSIaPeiTxNAQT2YMcAg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzdhfY1DViTsJlCBictJ4R2HAcTReaI8WTTpjq82P7R3Xtn7aLq tIh6IkaTsBw3/je1zgvaZ6HaviWmYfdaE5F9dhMyvjciq8GAM+Jupxiv X-Gm-Gg: ASbGncsHsI2uz2TUI9n1ywWhVDYx4gfy3GLav19MoOB0a7Lw1cH98vzgCOziwcc08+E qGejzKt41myWU4YLn3OBT9mvPBBR2KX4cSgrbuM1MPoXjPFcV/thMkzjbd3KT4xMEr8Qs+Uxoto WPyXbVI/2vpYwxAbQPRLUu4KP2o7esfBsD6t/Ub7cIbXwQkPOAOFGT03EMtCK1yq9WjktC/AL35 RYCrdTusXWneYfFWrQQ5LZL+wwjAPhe0UjXZamlZRaYXoxK1xtkQGwL1SSlL5HJotAP+nbmcnBv 2jxxkNK//71W/JiSQMvwXsIZfEZ8tPzoXoKQnN5m+GU4OomNVZAENq8Mx2p1QA1iQrQGS4qfzW4 kw9MX89rnkEtSIqPgg+z1SKXm4WD5x0376ibQkCnzQw3nThF6IhbDiKjWEgOwcub3fcfjckBWQh shcQ== X-Google-Smtp-Source: AGHT+IELrFpYSyxbUqRWBmddQKB0djvqVFuwdhM1pDDAe88xWuQmoexbpJHmuy2rvgvVaWBaPXeIPA== X-Received: by 2002:a05:6a20:6a24:b0:240:2371:cffd with SMTP id adf61e73a8af0-240d3006896mr12781716637.7.1755412429656; Sat, 16 Aug 2025 23:33:49 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id 41be03b00d2f7-b472d76f1d5sm5273108a12.40.2025.08.16.23.33.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Aug 2025 23:33:48 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------B9vc020YY08qHz1gU7sweYRu" Message-ID: <6e70718b-c304-1cbc-b731-377c7f9b7b3d@gmail.com> Date: Sat, 16 Aug 2025 23:33:49 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> <86qzxbls44.fsf@gnu.org> <37eb6d73-a1a3-ddad-9f7e-ab41a80f3091@gmail.com> <861ppbjcmj.fsf@gnu.org> <9a2eac94-62a4-511c-011f-aec83ca79223@gmail.com> <86wm72iloz.fsf@gnu.org> From: Jim Porter In-Reply-To: <86wm72iloz.fsf@gnu.org> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------B9vc020YY08qHz1gU7sweYRu Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/16/2025 10:03 PM, Eli Zaretskii wrote: > Calls to CHECK_* should be made by the primitive itself, not by its > subroutine. This is to allow the subroutines to be called where such > tests were already done, or are inappropriate. The idea is that only > stuff exposed to Lisp validates the Lisp objects passed as arguments. Good to know, thanks. > P.S. I'd like to see what this does on Windows, where there's neither > SIGPIPE nor EPIPE, but that's a separate funeral. For what it's worth, Gnulib says the following: /* On native Windows platforms, SIGPIPE does not exist. When write() is called on a pipe with no readers, WriteFile() fails with error GetLastError() = ERROR_NO_DATA, and write() in consequence fails with error EINVAL. */ Gnulib's 'write' (well really, 'rpl_write') checks for ERROR_NO_DATA and raises SIGPIPE for us, so hopefully we're ok here? --------------B9vc020YY08qHz1gU7sweYRu Content-Type: text/plain; charset=UTF-8; name="0001-Allow-child-processes-to-continue-after-EPIPE.patch" Content-Disposition: attachment; filename="0001-Allow-child-processes-to-continue-after-EPIPE.patch" Content-Transfer-Encoding: base64 RnJvbSAwMmMwNTUwY2E5NTM5M2FhYjg5M2E1ODE0NWZmMWZkZDcxYmFmOTA4IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IEZyaSwgMTUgQXVnIDIwMjUgMTM6NDQ6MDMgLTA3MDAKU3ViamVjdDogW1BB VENIXSBBbGxvdyBjaGlsZCBwcm9jZXNzZXMgdG8gY29udGludWUgYWZ0ZXIgRVBJUEUKClRo aXMgZW5zdXJlcyB0aGF0IGlmIHRoZSBjaGlsZCBwcm9jZXNzIGNsb3NlZCBpdHMgc3RkaW4g YW5kIEVtYWNzIHRyaWVzCnRvIHdyaXRlIHRvIGl0LCB0aGUgcHJvY2VzcyBjYW4gc3RpbGwg ZG8gYW55IHJlbWFpbmluZyB3b3JrIGFuZCBleGl0Cm5vcm1hbGx5LiAgSW4gcHJhY3RpY2Us IHRoaXMgY2FuIG9jY3VyIHdpdGggY29tbWFuZHMgbGlrZSAiaGVhZCgxKSIKKGJ1ZyM3OTA3 OSkuCgoqIHNyYy9maWxlaW8uYyAoZmlsZV9mb3Jfc3RyZWFtKTogTmV3IGZ1bmN0aW9uLCBl eHRyYWN0ZWQgZnJvbS4uLgooRnNldF9iaW5hcnlfbW9kZSk6IC4uLiBoZXJlLgooRmZpbGVf X2Nsb3NlX3N0cmVhbSk6IE5ldyBmdW5jdGlvbi4KCiogc3JjL3Byb2Nlc3MuYyAoc2VuZF9w cm9jZXNzKTogV2hlbiBlbmNvdW50ZXJpbmcgRVBJUEUsIG9ubHkgY2xvc2UgdGhlCmZkIGZv ciB0aGUgcGlwZSB0byB0aGUgY2hpbGQgcHJvY2VzcydzIHN0ZGluLgoKKiBsaXNwL2VzaGVs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Ii0tZXZhbCIKKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAsKHByaW4xLXRvLXN0cmlu ZworICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJyhsZXQgKChsaW5lIChyZWFkLXN0 cmluZyAiIikpKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGZpbGUtLWNs b3NlLXN0cmVhbSAnc3RkaW4pCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAo c2l0LWZvciAxKQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKG1lc3NhZ2Ug IiVzIiBsaW5lKSkpKQorICAgICAgICAgICAgICAgICA6Y29ubmVjdGlvbi10eXBlICdwaXBl KSkpCisgICAgICAocHJvY2Vzcy1zZW5kLXN0cmluZyBwcm9jICJoZWxsb1xuIikKKyAgICAg IChzaXQtZm9yIDAuMSkKKyAgICAgIChjb25kaXRpb24tY2FzZSBlcnIKKyAgICAgICAgICAo cHJvY2Vzcy1zZW5kLXN0cmluZyBwcm9jICJleHRyYVxuIikKKyAgICAgICAgKGVycm9yCisg ICAgICAgICAoc2V0cSBzYXctZXJyb3IgdCkKKyAgICAgICAgIChzaG91bGQgKGVxdWFsIChl cnJvci1tZXNzYWdlLXN0cmluZyBlcnIpCisgICAgICAgICAgICAgICAgICAgICAgICAoY29u Y2F0ICJQcm9jZXNzIHRlc3Qgbm8gbG9uZ2VyIGNvbm5lY3RlZCB0byBwaXBlOyAiCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICJjbG9zZWQgaXQiKSkpKSkKKyAgICAgICh1 bmxlc3Mgc2F3LWVycm9yCisgICAgICAgIChlcnQtZmFpbCAiRXhwZWN0ZWQgZXJyb3IgZnJv bSBgcHJvY2Vzcy1zZW5kLXN0cmluZyciKSkKKyAgICAgIDs7IFdhaXQgZm9yIHRoZSBwcm9j ZXNzIHRvIGZpbmlzaCwgYW5kIGNoZWNrIHJlc3VsdHMuCisgICAgICAod2hpbGUgKGVxIChw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0eS1z dGRpbiAoKQorICAgICAgKHByb2Nlc3MtdGVzdHMvYnJva2VuLXBpcGUgJyhwdHkgLiBwaXBl KSkpKSkKKwogKGVydC1kZWZ0ZXN0IHByb2Nlc3MtbnVtLXByb2Nlc3NvcnMgKCkKICAgIlNh bml0eSBjaGVja3MgZm9yIG51bS1wcm9jZXNzb3JzLiIKICAgKHNob3VsZCAoZXF1YWwgKG51 bS1wcm9jZXNzb3JzKSAobnVtLXByb2Nlc3NvcnMpKSkKLS0gCjIuMjUuMQoK --------------B9vc020YY08qHz1gU7sweYRu-- From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 17 03:57:18 2025 Received: (at 79079) by debbugs.gnu.org; 17 Aug 2025 07:57:18 +0000 Received: from localhost ([127.0.0.1]:44922 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unYGU-0000nR-6s for submit@debbugs.gnu.org; Sun, 17 Aug 2025 03:57:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42706) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1unYGR-0000nD-E7 for 79079@debbugs.gnu.org; Sun, 17 Aug 2025 03:57:16 -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 ) id 1unYGK-0003NC-SZ; Sun, 17 Aug 2025 03:57:08 -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=tjYFNRYdDPe/neF3l9AcFmDQlD8nvGkFVCZwMGDQIJo=; b=lsqUpKrUpIYA yJ0x5/ifX4mkplQYN6jXHHW+tttsABZ+SMUBxCYV4kcLc/AACmdMiRtbO9SuA1UXDFU/y+BPNfbZG PDIhFlivQEYhb8VxjoHYcAMekocXgdDVCl3rWnmKKV5o4ng1cxFj8SoCLAe8NLK3Bf+W6unpfi6Q+ nX42HOSkez9sHVqNR/t5So2vZ3r2TeBcDwLUltuPA9w9tzeLkTRHN4j2Ez7B3z/7oHmbr3N82RfQK AKmgVb1lXNpZ2+WpQlRPYXlFAORuoazvCYT1MQ8oMYXcnFveoM2z8R7wr8nsRZ3y6t9CS+79GzFsd FaWs5esiZ2VZDFNb9qXxLg==; Date: Sun, 17 Aug 2025 10:57:04 +0300 Message-Id: <86plcuidnz.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: <6e70718b-c304-1cbc-b731-377c7f9b7b3d@gmail.com> (message from Jim Porter on Sat, 16 Aug 2025 23:33:49 -0700) Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> <86qzxbls44.fsf@gnu.org> <37eb6d73-a1a3-ddad-9f7e-ab41a80f3091@gmail.com> <861ppbjcmj.fsf@gnu.org> <9a2eac94-62a4-511c-011f-aec83ca79223@gmail.com> <86wm72iloz.fsf@gnu.org> <6e70718b-c304-1cbc-b731-377c7f9b7b3d@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 16 Aug 2025 23:33:49 -0700 > Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org > From: Jim Porter > > > P.S. I'd like to see what this does on Windows, where there's neither > > SIGPIPE nor EPIPE, but that's a separate funeral. > > For what it's worth, Gnulib says the following: > > /* On native Windows platforms, SIGPIPE does not exist. When write() is > called on a pipe with no readers, WriteFile() fails with error > GetLastError() = ERROR_NO_DATA, and write() in consequence fails with > error EINVAL. */ > > Gnulib's 'write' (well really, 'rpl_write') checks for ERROR_NO_DATA and > raises SIGPIPE for us, so hopefully we're ok here? We don't use Gnulib's replacement for 'write', so if anything is needed in this area, we'll need to do it in w32.c:sys_write (which also supports network and serial connections, so it would be interesting what socket error is returned when the other side closes the socket. There's also ERROR_BROKEN_PIPE, which happens when _reading_ from a pipe whose other end was closed. is that also EPIPE on Posix systems? From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 17 13:28:14 2025 Received: (at 79079) by debbugs.gnu.org; 17 Aug 2025 17:28:14 +0000 Received: from localhost ([127.0.0.1]:47815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1unhAz-0000mi-RS for submit@debbugs.gnu.org; Sun, 17 Aug 2025 13:28:14 -0400 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]:47190) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1unhAx-0000mO-Ng for 79079@debbugs.gnu.org; Sun, 17 Aug 2025 13:28:12 -0400 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-30cceb83f85so1866825fac.2 for <79079@debbugs.gnu.org>; Sun, 17 Aug 2025 10:28:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755451685; x=1756056485; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=bX2JtWRVNl4rC3WdxeBwLQ1D6W0+IL/hZmPquMRjPiw=; b=UzRK+l5wq8tFRwu6G88a9rMRqadWIpto/nSSOoVPjTzBxZjV+8CK3NkohChf0b6011 x9Z2TZ/cMmwTjAOijklipUOKK8+WuW5kuS736fsM1Rxifr8iagS9onwrikexcd5xZANX bAQ7x6eB+Uell7WHt/Jpj8NkcElusjwh43lReJml29FIq1Pr43IcpVj2Z7lgM06e8aiT jHfpjEpdTVCXQx4wRiIIJeQeHAs5UPCXIHGW6yXE0mwpjtz8pCCCrPvANPYegL1UdeGj sLOaij5JrnZX2eFz93t1UEf8Rco+RbKEBJZI41O+jpopdKPusyP7Ab2VZIp4lx0Rm9Um bxcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755451685; x=1756056485; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bX2JtWRVNl4rC3WdxeBwLQ1D6W0+IL/hZmPquMRjPiw=; b=u4nOJKIZeMPnSSVwcyc3jDG5jdN1guGlgnqBfP78Nx8FXEZwK1EfX8Twq2xwVPuWom kzWka/9qwEexCTDa1xJUEDcDeDkcMMMesfWzdmkjRoEQFNHwOspn+RvoKBFZ93Nf2o/q frBtR8e5CzKEkZQwBq7ikg/2sxRakCqPTXu4o0fqiD0/FvKlo3B0ZcTBqFeQYZuOlXHN b5JYdL9E9uyjZ8OdjsBMIa07QYg7tkBBjRiEsteqXmtYK9107txNpIKArEWXL7/SenaJ jmXKLRVX2NF8/NuDeIFtgI7Hme52BEv8X2WEAMxnIG/4u7Yx78FXOTxWbyofgyx4DJ5C fAKA== X-Forwarded-Encrypted: i=1; AJvYcCWILfYb2JKE6LtDUHYSExcmEQweGzGpJa73C0eBbVAyKFxshNi4hXCewLN425nu7om5sTM6bQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0YylQJ7NzgYTs0N6m5B+kMWvyUiDG7usRhMbA/MJ6H73jHQ6C8Th zq11cV5zS7SSeHdICc51Up9PW2X2fjCP59PzzqTp4R+aP4Z84DsRYII6 X-Gm-Gg: ASbGnctgcigNdpWaP/SfqN/2SxKv56tJMBiiyfAHOnAi+m5c6bAJTR84lEINiyj35Rh nYsMVhbIAclQFj+wYUfLV5ZI7Hp6Kh0+xfVKlm5OzPN6S25eIDXBb0rbPIago+0j8Wz/AuLUhbM BL8ztqLfWTCXfectm620F9+ZuNiQGmhM5yMXyMSCoknH4tw8ecOvawpVwc5rv59YmjECLrm+JAm sVNbM5bPAu0eGaA6tee/J0K0wqErPCuzXj/8Yr/1acbTHjjA2gUE22OTeeKtOpXa9eUhoeaLDsc JwK06lwTjw9GE+ButE4MXOhFWPBkkqbL9KAOjqn0w3cy1KAfxaOJlta0ZSMShJZp2A5wXzutzCg hYBu6u/ZszLqZAo1RIn3lt+RnI6MPc+G58BjF99ExfNR+C2KVbdn3asoWEnVU9/e3eXgyHBYhcH UsJg== X-Google-Smtp-Source: AGHT+IGFFEcluRFH8NE4zTvGUN4l+e0W3ytYZhoakngNaMeztv1iHUVWziD9ba78hEy9ZBH0saNEhw== X-Received: by 2002:a05:6871:5e88:b0:30b:85e1:d3d3 with SMTP id 586e51a60fabf-310aafe4509mr5991545fac.32.1755451685273; Sun, 17 Aug 2025 10:28:05 -0700 (PDT) Received: from [192.168.1.2] (syn-076-168-144-128.res.spectrum.com. [76.168.144.128]) by smtp.googlemail.com with ESMTPSA id 46e09a7af769-7439204d6a1sm1428496a34.42.2025.08.17.10.28.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Aug 2025 10:28:04 -0700 (PDT) Message-ID: <288dce86-c9e5-ff71-772f-d020bf5bb43c@gmail.com> Date: Sun, 17 Aug 2025 10:28:05 -0700 MIME-Version: 1.0 Subject: Re: bug#79079: 31.0.50; Piped command output is sometimes lost in Eshell Content-Language: en-US To: Eli Zaretskii References: <87pldr5iza.fsf@daniel-mendler.de> <26784dc3-a846-b880-a023-c3e7d8da3399@gmail.com> <864iv26tkk.fsf@gnu.org> <79cd6ad9-f939-6b8a-ebe0-83b0b0475b62@gmail.com> <864iuz1cna.fsf@gnu.org> <8b26b547-dfb7-2c7a-bfbf-531db8a1a50e@gmail.com> <80cdb7af-6640-63e0-5c64-57bffd415f7b@gmail.com> <86qzxbls44.fsf@gnu.org> <37eb6d73-a1a3-ddad-9f7e-ab41a80f3091@gmail.com> <861ppbjcmj.fsf@gnu.org> <9a2eac94-62a4-511c-011f-aec83ca79223@gmail.com> <86wm72iloz.fsf@gnu.org> <6e70718b-c304-1cbc-b731-377c7f9b7b3d@gmail.com> <86plcuidnz.fsf@gnu.org> From: Jim Porter In-Reply-To: <86plcuidnz.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79079 Cc: mail@daniel-mendler.de, eggert@cs.ucla.edu, 79079@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 8/17/2025 12:57 AM, Eli Zaretskii wrote: > There's also ERROR_BROKEN_PIPE, which happens when _reading_ from a > pipe whose other end was closed. is that also EPIPE on Posix systems? On Posix, I think that would just be EOF.