From nobody Wed May 14 19:20:48 2025 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 4ZyNV91QYfz5vd7s; Wed, 14 May 2025 19:20:49 +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 4ZyNV90Hq5z3N8k; Wed, 14 May 2025 19:20:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747250449; 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=gqJUcMBPayffIe+l6G77QTJXzBVBfp7Af1UNJAGF7CE=; b=tL27EAGyqJqUVn10DZTAda23A75gdT+11tdb93NbLxGIuQGWRE18NFhaNylw1qItgjaQog srBgBmi4TDas4NcnnSbyjTwaTwlSTb5N1mW+DTTdlWrf88oQ0Yi6Knkyof0d/cvRUkjtVc onaHBmLyhgcI30ubUjZSNMh56ibYIrC4VO7pf7Ei/7VRmo1wZ/2WJ4Ul/HzJr/J6G3+n+T A1ZvTYf+aiN2xrgZtt6Bgk//M8lVKiI52F0U4hwNQ26g3KGmr4xdQyOa2gbQ0i3Vf0MW73 J0Ruxel+07EQ/nrAK+H2oN05qrr/dhCxAkKTuTwMZMglcMlJmr2C6c0i3EMV7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747250449; 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=gqJUcMBPayffIe+l6G77QTJXzBVBfp7Af1UNJAGF7CE=; b=eM7VFB3nj11jUbEmkG36Z6xOsUOR45HtQ7dZPK2T9ctMtMce1XU7sGbneLMEqC3dGeAHJc jdF1Sz8PJy0wKYfm80sQrYpCTAOCMrDjziD0y0JCu6iWYDGx5EQFSVTw4Jj7SeZSUhQRxx wMroD2UoVrjrMCRAsCDonF8waNYqqR48C6dhEiNDAICycmtZeg4gfXHq0CoFp7kzgRTzRv alMm/ESQaQxjstfSn59k+68BS2VPBL6ehYGVI5JCL6RXQfrbz228U6baY/KgjDycKUrGRx cWuPr4Fzot/NbOTzv9WshUC57MwO/cLlNAKt+JSP8im8lWtcnzJ/6czDSUZhQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1747250449; a=rsa-sha256; cv=none; b=VolT/Qx9OztNhDx9yiyu5Di5Wh97+blvCGYrZUA0NCaioahgJpTmSb/3I1ejKBMUHAG351 uKnNBILr7BHkQlgyVLop3r7N5QPdzffXMrAyWX5B5tMypDRF+owdkh+gWOuhhRfsja8Yps uZhddyUlkviAjgek8r3DatXG+ImzfzL9HT7kztxar0sIr3b222eiXiEnr3+w6j42fQbrru GskExy/IdpZXfSCksSz1pflxGaNCFwjSfDke9B/rrsBzjC2Nti9M3YUgLEQaaG0CqV2vY9 Os6UCdYVJuJgkNMVYnoDqywM9Wr/cxCM72HUm2opmj3kHBUzwcTlb+oh2i2LDw== 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 4ZyNV86xFfzlTR; Wed, 14 May 2025 19:20:48 +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 54EJKmBF015189; Wed, 14 May 2025 19:20:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 54EJKmnl015186; Wed, 14 May 2025 19:20:48 GMT (envelope-from git) Date: Wed, 14 May 2025 19:20:48 GMT Message-Id: <202505141920.54EJKmnl015186@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 964557fe9807 - main - mail: exit with the correct exit status on SIGHUP in send mode 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 964557fe9807d473ad11182a332b0d1da4f54ef0 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=964557fe9807d473ad11182a332b0d1da4f54ef0 commit 964557fe9807d473ad11182a332b0d1da4f54ef0 Author: Kyle Evans AuthorDate: 2025-05-14 19:20:16 +0000 Commit: Kyle Evans CommitDate: 2025-05-14 19:20:35 +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 --- 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 2423bcf7b262..97c4d499ea3a 100644 --- a/usr.bin/mail/collect.c +++ b/usr.bin/mail/collect.c @@ -698,7 +698,7 @@ collint(int s __unused) /*ARGSUSED*/ void -collhup(int s __unused) +collhup(int signo) { rewind(collf); savedeadletter(collf); @@ -706,7 +706,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