From nobody Wed Oct 09 13:36:14 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XNv6m5vKbz5YY6y; Wed, 09 Oct 2024 13:36:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XNv6m5Qdjz4dT1; Wed, 9 Oct 2024 13:36:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728480976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c/k6hoiHzVnvSh/AHOTM4Z0r/tzD2gytGqDkyP9/nR4=; b=ovqvzho4q2bAgyKLIlNb5c6Y0U0t6Zzgu86Ok6dX0IwSzi3Hmcy5d4JTKCy8VhxEXqa/Wx gZU/fewl7obtwNEK6S8VuEbAvqo1J/i+PRgO2ihnLHMUztTwuVj/fN74mD8SZCtYqLdDzX T+Z8/SS7MPlVBZqOIGqeyXS8pZeCIhAv8G0aFDUeoP9qcIc8cKoec7C+Ey4r26CTdGdg7D BYF9v+5V5P5J/pM0Ks5wpqcC2I4cjZdQ3QmZLJQPRvTEH3uqCd396VuJf4LNMX6f5vK7K1 nFlRmXputPWwcRykNLMaCvnNQam44UqWtjfrt/rZn2O/ZDpkCmORSyoFEz0o9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728480976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c/k6hoiHzVnvSh/AHOTM4Z0r/tzD2gytGqDkyP9/nR4=; b=Kb4N7J91tQ62QjlS3ORJNLflHup05P0APiC34lHltQhfKtnAAg+HUIIwIOiMLgWmMdxEsK EnE9t9f1yGU4gtZTB9sgYhdhxRybFqhfkW6ypp+L1eDxLMlJEO7dXV3b9D/OzRTAMgPpjQ /+6lBByQibv2Ev8jHXoTFDY6Thy6WIMCR8CDpzIgFSJPi+R8rdAT/SXnM9pUxDuArtFuIt Ly8rpAZl8Bk6hjbwCypbGUexqYrbSxUIVJIEqJIHvSFnx5835nfGCT7VuBcxwFqkEazMd1 1qyQQKfbdhroyMQzE4HCvTPzSZ/WHewdkubfdUmVTwDATaFkvLDc6jJmwN7i7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728480976; a=rsa-sha256; cv=none; b=Di8zkqgekOmb1k3J+YJ7pJMD1LyMbSy3QozTxpYWUdJLD+zfYwnzZYfkHEJ2kciIxDLeul WfWi1pKRTbMOfGjx/Z+Og07wa2FtX7LV2Bu5s5Anbg6aKkQ45hDf1yZs6f27zWflglKRts tHFH7GFFWAu4jvi7s8Wlt6iArmnjl21aXDqelTp1xUmDTBiPdX1xNAGtsnGIP0TzCoYCG8 IVUFHRCM0fMvghoKYf8HHdUTXQSSANXIo5FC7vOzXLMA8pOAWSukgk/iby3/m5x8SXfAWA mO8MBR04hxJ05n4GRuATuvfIcW0oSgYE/UtOhtyMf0nuqFxGCuV07Ok2RJFBmQ== Received: from [10.9.4.95] (unknown [209.182.120.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4XNv6m1b49z18HR; Wed, 9 Oct 2024 13:36:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: <91c60145-9f13-48a6-b7cd-4a1a9703e67c@FreeBSD.org> Date: Wed, 9 Oct 2024 08:36:14 -0500 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: c2d93a803ace - main - env: Check the status of stdout. To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, =?UTF-8?Q?Dag-Erling_Sm=C3=B8rgrav?= References: <202410081702.498H2KIP072012@gitrepo.freebsd.org> <86iku2v3o2.fsf@ltc.des.dev> Content-Language: en-US From: Kyle Evans In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/9/24 07:18, Konstantin Belousov wrote: > On Tue, Oct 08, 2024 at 08:40:45PM +0200, Dag-Erling Smørgrav wrote: >> Konstantin Belousov writes: >>> Dag-Erling Smørgrav writes: >>>> + if (fflush(stdout) != 0) >>>> + err(1, "stdout"); >>> Why is this check needed? >> >> POSIX requires it. > Could you please point me to the requirement? > Seconding the assertion that it's somewhere in there, but it's also just a reasonable thing to do. The implicit flush at exit of streams in libc has to ignore errors because it lacks the necessary context to be able to surface anything, so applications must do it on an individual basis to appropriately surface, e.g., output truncation issues that are otherwise hidden (and maybe not obvious) from the caller. The impression I had from talking to folks about this in the past is that it's practically expected that applications will flush-and-error at the end rather than check individual writes so that they can surface logic/execution errors at a higher priority than stdout errors, but stdout errors should still prevent a clean exit. Thanks, Kyle Evans