From nobody Wed May 21 17:47:38 2025 X-Original-To: dev-commits-src-all@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 4b2f5Q68Whz5wGPd; Wed, 21 May 2025 17:47:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4b2f5Q3vsvz43Ph; Wed, 21 May 2025 17:47:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747849658; 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; bh=oz306/wZSY8JN9a/dmc+9wyTqVqBSY2rZbojO7NJhsw=; b=aH6r72bG6yv04OyivQqiT2scs9EcimzoWgVWymLnd2gZzbAy2mEi+X6RyR59I8CbmDo0VU ET/BlN1taDc1qBwouqtE7h2cIJV8lAbFa+VJxyDqAEKuyaKe9wp2CiBbGDtmnWH1hLGsm3 OSYtOHDLlj4u1Bk4XdulBYGDcTllwk1cntSF/3Tvy9U5ebAnn8qdWog8wg7IOcjH06LCJr XzlDHInjYflDGwqlxgWZhn8KCh6i/nHdsxrVF9GA3aVZepu/UBbkje1X7As3AUX2olDyPW dmw7er+MFxlKtr+xOFXdksniGr4jFQwYDc2GrutfavVCO8s7GbGiseopWEhlnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747849658; 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; bh=oz306/wZSY8JN9a/dmc+9wyTqVqBSY2rZbojO7NJhsw=; b=xAfMzFYstuOWY0AJSGKUYUvYtubIV2uMsY26wHiuWJDbef1qAOB1xCdq+qJBPvaETxNHXF aKrJFUt2U097lv777KEFghAeW057GERYqpp1DHt7O4BqHa5NlVqOAk/ZEswWynbLbBmR0c 9eVA6xIUFCnlcPlxQBwGNxGLUq5mRZFcAHSMN7Xd6x/bWQQv5+7XGCri0CYpsYZm5iisHm pTLrovVxu9OSFseeviIyINFMa9wx97WHbro23dCV+YxtBV0LCsY24XScR+udiGkoaFcfw4 epdgSlTfR5QJ3hpSW8QJSIrIytsqjwDbujNMaG4a/uf86VF1WUIC4GGMI/+SgQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1747849658; a=rsa-sha256; cv=none; b=g0cSSKc5J66Pj84sd6lrRHzHkKIHMH1YBIlPtoyhoqYzEFbGCBgfn4jtrnjLrV456gGRSV Z6pmoGwk0jej1cQGKZwg7llEW3oPpXIlAqIVc0pTYDQU+5vzP2g+d2L8Z4dRori0SbWpb/ imIurEwYyx3mc1/Y/FO6x1hvudmkoqohnY/R70am4IwtHvRJrexzKsr1IjlG5eyaLxxEH5 FPFaDLWnrcRvup6tMG7T/j4KEB1Es2wMf9unlinjp3fO9yzzVLH1bbS4zEpJu8d/5YPnTA imM+4gvSUnuaTUs6z/JcYIUI4vWjYDSJRfGgnHAd0d4PbfE/3cHfjJlzKjRKIg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4b2f5Q3Kh2zlHY; Wed, 21 May 2025 17:47:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 54LHlcDM074972; Wed, 21 May 2025 17:47:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 54LHlcdP074969; Wed, 21 May 2025 17:47:38 GMT (envelope-from git) Date: Wed, 21 May 2025 17:47:38 GMT Message-Id: <202505211747.54LHlcdP074969@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: b71d73af2f68 - stable/14 - mail: exit with the correct exit status on SIGHUP in send mode List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b71d73af2f68d473eda5fd7547a2fd7ec92b70d5 Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=b71d73af2f68d473eda5fd7547a2fd7ec92b70d5 commit b71d73af2f68d473eda5fd7547a2fd7ec92b70d5 Author: Kyle Evans AuthorDate: 2025-05-14 19:20:16 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-05-21 17:33:09 +0000 mail: exit with the correct exit status on SIGHUP in send mode Motivated by POSIX conformance requirements: mailx(1) is expected to take the default action for every signal except SIGINT in interactive mode. We still handle other signals that we shouldn't based on the spec (e.g., SIGTSTP), but conforming there is not as straightforward as we do more than just cleanup in response. Note that when the spec says that we must take the default action, it does not mean so strictly. Namely, we *can* do some sensible cleanup if we'd like, but we enter into nonconformant territory if we don't reflect the termination via signal in our exit status. That is why this change doesn't actually remove the handler; we're still conformant as long as the end result is the same as if we took the default action. Reviewed by: des Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50251 (cherry picked from commit 964557fe9807d473ad11182a332b0d1da4f54ef0) --- usr.bin/mail/collect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/mail/collect.c b/usr.bin/mail/collect.c index e6a6337bcdb0..1155467efcb3 100644 --- a/usr.bin/mail/collect.c +++ b/usr.bin/mail/collect.c @@ -704,7 +704,7 @@ collint(int s __unused) /*ARGSUSED*/ void -collhup(int s __unused) +collhup(int signo) { rewind(collf); savedeadletter(collf); @@ -712,7 +712,8 @@ collhup(int s __unused) * Let's pretend nobody else wants to clean up, * a true statement at this time. */ - exit(1); + signal(signo, SIG_DFL); + raise(signo); } void