From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XiScB48T; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 1187A5A0280 for ; Thu, 29 May 2025 01:31:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1748475106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eCJGpM4MbhUHOQmKXLX3z8sf/BIo93r5pYSky46mZq8=; b=XiScB48TVvvniYO2LzCaa7SHWuEu6fwtLytSCogYtg4huq0uXtSkrB8TaEHRcwlKgfpTOK auzjU2ibnJ786k5jmW4OsRjr8wsWzdhgNi+Wn04ZOMp0c0r24h4hSoltRksUUMIeWZXd4d mkzxoFpoFHCWLEElXPKbf9jG2fYvrv0= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-85-FmxZTszIOQWQJbjlOjpLUA-1; Wed, 28 May 2025 19:31:44 -0400 X-MC-Unique: FmxZTszIOQWQJbjlOjpLUA-1 X-Mimecast-MFC-AGG-ID: FmxZTszIOQWQJbjlOjpLUA_1748475104 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6faa33468f2so6864516d6.3 for ; Wed, 28 May 2025 16:31:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748475104; x=1749079904; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eCJGpM4MbhUHOQmKXLX3z8sf/BIo93r5pYSky46mZq8=; b=pggAu8Lltc3zNaMUqlBWxfiv6yRfyh9HOXVhp5G+tEdAH7T0EGbKOmWZy8izHS36re bLy5t5XH6mcdzdM1m87Gzh2inBeiuM2M8R2EOOB8Otz5xUUYJmK0Tylwu0xaO7607trz vUWMR65e3krp8BvmZwEXDstf/wST8wD/lLKE2K1YOoy8sL3Ox9qOVxywyxuo1dD7+01F 4JiRNnp8doP9fwwrFFdyvPK53Sj7JqYPKE0ZSwaIPi0eS1xOxc72pO0s++Om63jtyOSo eBdh2GsfXuyUwOGlvjmQeam24eB+8JKOi1m+Ljfiul8+Dyij6b2kJk+GcTnKia7hNfPu avMA== X-Gm-Message-State: AOJu0YzY50PfQ7I/UOtJfa4ZXssyuoV0XD4q8r1/liaB72H6un191VXS 5Lo2nLfvYoqqos6z1ARPi2kvIknY57FZnIT5tyHs3xuIR74HmDqlI6p0hJmdn69iOxP0slROzjk yuke5EMda3IDKRnPqq9klYzy6+P2sULkafJtTNXCDYDeyk4Psw3lY7MZz4GbB2pDXF1oDotnAIK dZsQiG3NBJnN2qtdk4oWvyvZGqTBoyt6wbjZHL X-Gm-Gg: ASbGnctmDuo9UEi4dMBNJ9MRqZO+2cBBEcBDLTVqSg+8il5rwSnI6bZVCMUN0O7scJ1 9GB3PJswpnZjE5eDYyGf+N0AMr7xEl7QsziX9R5p2jk9vSvHactYZv9o/2TcdFeaEYppb+4N51b I7+nLRWyedx747iiAD8rSIhWvKclVyy9TewSYA9PT1T8TzpZzTyDnINWVWT83xtW6oBaGCquvxl 4XGHLEpsvNEVyh/AHmvdw5zoB6IQ+HSASfRZKq7FKQ2D0AQbdUMsaRoSpBCZWrJKGaDG4OLCq+X 5MQHHdCppWyhw9PSA7VdXAITKuUD020Y9D51zmflnZRHw3230eO1rMfY X-Received: by 2002:ad4:5b8d:0:b0:6fa:bb44:fddf with SMTP id 6a1803df08f44-6fac841e366mr1900756d6.16.1748475104189; Wed, 28 May 2025 16:31:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqDhlIF/HmPB/VD5D/khVRfCwVVayh+VCnzZKFSrSkSSOPE3cUPgyfTTwNnQl8Ujd9EEMNvw== X-Received: by 2002:ad4:5b8d:0:b0:6fa:bb44:fddf with SMTP id 6a1803df08f44-6fac841e366mr1899986d6.16.1748475103460; Wed, 28 May 2025 16:31:43 -0700 (PDT) Received: from ?IPV6:2001:4958:236b:9301:2d53:afdf:4ab:b9e9? ([2001:4958:236b:9301:2d53:afdf:4ab:b9e9]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fac6e1cb6asm1733066d6.118.2025.05.28.16.31.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 May 2025 16:31:43 -0700 (PDT) Message-ID: <7fbb6024-1584-45e1-b443-b646c85051a9@redhat.com> Date: Wed, 28 May 2025 19:31:42 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Can't pipe output of pasta --version To: passt-user@passt.top References: <1378983862.3469095.1748366479602.ref@mail.yahoo.com> <1378983862.3469095.1748366479602@mail.yahoo.com> <174841834113.3062894.7293539982980796043@maja> From: Jon Maloy In-Reply-To: <174841834113.3062894.7293539982980796043@maja> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: rwrWtQmuNuvCyBALudufo-6ahe1n3w1nwaBPMbjHJG0_1748475104 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: DN5752T7I6CBEIP7SP6JJVSTKVDM7OYU X-Message-ID-Hash: DN5752T7I6CBEIP7SP6JJVSTKVDM7OYU X-MailFrom: jmaloy@redhat.com 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 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: On 2025-05-28 03:45, Stefano Brivio via user wrote: > [Cc: Paul as author of d0006fa78] > > On Wed, 28 May 2025 12:25:10 +1000 > David Gibson wrote: > >> 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 >>> >>> 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. > Well, that's something we looked into (of course...), and (I?) concluded > that we never needed to flush stdio, which is the only otherwise useful > thing glibc handlers would do for us, and which kind of holds... except > for this case. And maybe for --help or any "early" exit. > > So we could fflush() as well in those cases, and just in those > cases, with the added benefit that we don't need to add additional > system calls to the permitted seccomp set, because if we exit early, we > didn't install the seccomp filter yet. > >> 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. > I'm on holiday too, I'll fix this later this week or next week, unless > Paul is particularly inspired (or John wants to look into the issue a > bit further and contribute a patch...?). I'll take a look tomorrow. /jon > > -- Stefano > > > _______________________________________________ > user mailing list --passt-user@passt.top > To unsubscribe send an email topasst-user-leave@passt.top