From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202504 header.b=cAJUjp+t; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id DF4255A0287 for ; Wed, 28 May 2025 04:25:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202504; t=1748399116; bh=tPv1apeLWBvnqm8AFCeGJYhJoI3q2NLn3d8G1+3WFVM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cAJUjp+tNB3SlKVMtJg0ST2OMzgEp07umjyC/tzy17v/ii1j+OJS1jtMN2d4eELU9 YykC3l86xsq8dlUIRkb4vrzlQ4l+y+2NNu7QoKk6T1+vgFnvvWlVpwK8MelcwEoLMd M5uOFCBq4oEdAWMUB4wjjuAgPDQIhIxImIKIxbnaq1ay/m0fnkIHcNU/mdii7aKypo ZAyo4+MFSXOo1HXI6fJ6yACSD3+RL3u2nh8uSWmpavCYIzDTUz7rN8+BPtoPaEtZrN L5URxGDfKZo4j5lSTHRG+IB0xEM5qJArm2f13T+ayFCpYU1jwT7StAp/LyG6+0n0Hs G51TiyGM10YNw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4b6YHw5CrCz4x3S; Wed, 28 May 2025 12:25:16 +1000 (AEST) Date: Wed, 28 May 2025 12:25:10 +1000 From: David Gibson To: "John Radley (jradxl2)" Subject: Re: Can't pipe output of pasta --version Message-ID: References: <1378983862.3469095.1748366479602.ref@mail.yahoo.com> <1378983862.3469095.1748366479602@mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="mcmEeqT+OZEM8Si4" Content-Disposition: inline In-Reply-To: <1378983862.3469095.1748366479602@mail.yahoo.com> Message-ID-Hash: Y6USJVQTLQIF5ZA2DZ7MSVZOOVWNBQ3T X-Message-ID-Hash: Y6USJVQTLQIF5ZA2DZ7MSVZOOVWNBQ3T X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: "passt-user@passt.top" X-Mailman-Version: 3.3.8 Precedence: list List-Id: "For passt users: support, questions and answers" Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --mcmEeqT+OZEM8Si4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 27, 2025 at 05:21:19PM +0000, John Radley (jradxl2) wrote: > Hello,I can't pipe output like this:- > $ pasta --version | grep pasta > but this works:- > $ sudo apt install expect > $ unbuffer pasta --version | grep pasta > pasta 2025_05_12.8ec1341-9-g3262c9b >=20 > If this is the intended action, please can you tell me why? Ouch. No, that's not intended. I initially assumed this was because we were sending the version information to stderr instead of stdout, but that's not the case. This is a bug introduced by d0006fa78 ("treewide: use _exit() over exit()"). For --version we're displaying the information with fprintf(), then immediately exiting with _exit(). When writing to a pipe, stdout is buffered. Normally the buffer would be flushed before exiting, but using _exit() bypasses that. We could fix this specific problem by adding an fflush(stdout) before the _exit(). However, I worry that there might be other bugs we have because we're not running libc installed exit handlers here and elsewhere. I was already a bit dubious about using _exit() by default, and now I really don't think it was a good idea. That said, I don't immediately have a better idea of how to address the problem d0006fa78 was aiming to fix in the first place. Well... I'm on holiday at the moment, so I won't be fixing it. Laurent & Stefano, I hope the analysis above is helpful. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --mcmEeqT+OZEM8Si4 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmg2c/MACgkQzQJF27ox 2GcCpA//drepH4ojGCrRwsOSVgLxzT28wjOU/uPwTbKHM+U5d9e3TgZ1ef/Aiipt FfOpw1EhdKWwYJp4OV2Ey0N4L3iV2vdCN/TdHSphHgcFUiLcYQzQZSPR2rNHribN IjsEyLMQSyFsicnY6utXEROiCUWyWI5MetXBDUYeHxSNcKV2VBlQyBqJ1eY3TEDn RcYqcrIwY7lL1qjl7IXdpqyt/jiL0YhC5xYNOTQZm/ZKOm4ZVOjznBHLw4D0iMNf 8XMlIYSYrAmZmaI/ed7RDl0f+OvPMiQb6ZgZEEoKXB1i+emPzOiBv1CDnrwy1w+V b6fbOMqHQ83ymGmq3zJ8yWU7NFNylJRZGmNUuXoH2T0NlEBVEVqsvm+LV+U9AcoE gFLu9PPnVm4pQqczTZtnMEvb//J3k+tSOmM/Sf3+felMscZS9UxgZGWe1SlCyDCU gIAW6QCXiWlnU0Kc1mVhaToSDlsCtPSNN9HDcNwlJWNIiqywP5W1EzCLpl/VMg2b VvkpIDItLMz/L9FNCFO2/cXB4CMCgWO6nndOHjPR4TD/dz9HkHjcMhfylultmJVs 4xtv8XMUIBK08snusWZZxIpyVbnd2Kz8dqJ+hDJIG1H0L/oG3mIe0Ha/er2C9ZcB 364K5oTyDD/fJAXdgVJ8qO5+nkHls8aIChKtmiiqKp+qrVX7SmM= =eYj8 -----END PGP SIGNATURE----- --mcmEeqT+OZEM8Si4--