From nobody Mon Jun 16 08:53:51 2025 X-Original-To: dev-commits-src-branches@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 4bLP1X0bCNz5Vq0N; Mon, 16 Jun 2025 08:53:52 +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 4bLP1W6v0Jz3wDX; Mon, 16 Jun 2025 08:53:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064032; 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=/AlJM9QLl7PP9BMgc6R28Hz4udJhDxcyBhI5ALO4CuA=; b=JsXXix9zUJ9M7PDOHBgKUogVhbvSVOyongoMrMAD6FH42WzN98Cpmfcxa7oC4niOWPUn4B urJzDf+hReAVA9vRhUCsX9DH9sk5Sy+tdleCt65okbObw/tBD6q5pFoei6kkILclxv7xGL xlgLvzcZN1JQa3LwKCwg5luz7I8SuBpdd0bILxySebIBekbtw2c4hhSjwufHZ1d3nqlYfs Zf3iYxw2Ku2SLtCA5fh5xPp6WXVp2zDq7O7Qffnr4VWWX/6vfTmYP75+tdcFkI5w4UTGwJ tayGJyc3qrNgM1DbwEXv4dK+bLhKRDlZ1R8GO/JqJ2B2KqrCO1mA36wFbQcwMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064032; 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=/AlJM9QLl7PP9BMgc6R28Hz4udJhDxcyBhI5ALO4CuA=; b=pMBmeNsgFNC1E4NrZssfCa6wl1NdDGzMzStMZERbQwKAx8TYI1Hhhcf+zaJaT3zVt8UAIZ wxSJ/1vvQkwGhS4XSdzkeeNdpBFY9MxiD6CMFk+RNQxKXA83BEbR80yhqkpEsPkjo5iKGL FCGCD98kgoyzswgsKVBocVnA1y22/bVfYUlv6rnhX9kLJkMNjUXIO8HblOOZhXrTdcoYRE V72SkLd4brF62p/1SSY5t+R2hXpTlapp22H4bJ3iVhwGwCZv7vO3Xi7h/jU+1R+fzTg8SM +5ekLjiVkkcKlURjKLOWWhw/EQnuGqS77Y4ZR9QolCi3M8ux19p/zw8oPpmFYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064032; a=rsa-sha256; cv=none; b=DYpscmS2z3e9Lb/nPL9EGGbwtId+WiZtvFE+CtgKAjLTlonvwbIQRLwd6sAPmjr8K2NjFH QLsIsbMeossYOmXpyiiQX2z/PXYAWJR+yCW7Qm93nG/KJfCkC3WuWSQYv9t4UkPkKOHwHY fohOooFb0kICD1b2pg4svbdORYifB7SLCQ2sh82puOIJrIOxVJ6ADy0e7kIBmd1Jb0UP3E xfY/MFxtt9+h7i0Yx5TiSBTbqSfaiomsB3XqyiD9ePLOxGsG9LX/mFCidiBfmMumsT3KeX NqohLB4A16af8E0uMLz5NrYZDao6GWMRfoyCEhtylnI9AlQjn2sDJCnBfn4XUw== 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 4bLP1W6RlqzrJ1; Mon, 16 Jun 2025 08:53:51 +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 55G8rpCH042906; Mon, 16 Jun 2025 08:53:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8rpQQ042903; Mon, 16 Jun 2025 08:53:51 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:53:51 GMT Message-Id: <202506160853.55G8rpQQ042903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b748dd9ab46b - stable/14 - timeout_test.sh: Fix typo List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b748dd9ab46bf604ac79debef94c5e690a480317 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b748dd9ab46bf604ac79debef94c5e690a480317 commit b748dd9ab46bf604ac79debef94c5e690a480317 Author: Elyes Haouas AuthorDate: 2023-12-26 23:39:25 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:51 +0000 timeout_test.sh: Fix typo (cherry picked from commit fd4fafa8732203a3e20f5404a65de83d37687e3a) --- bin/timeout/tests/timeout_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/timeout/tests/timeout_test.sh b/bin/timeout/tests/timeout_test.sh index df497d4f3350..2a8e0112b97c 100644 --- a/bin/timeout/tests/timeout_test.sh +++ b/bin/timeout/tests/timeout_test.sh @@ -82,7 +82,7 @@ exit_numbers_body() -s exit:124 \ timeout .1 sleep 1 - # With preserv status exit should be 128 + TERM aka 143 + # With preserve status exit should be 128 + TERM aka 143 atf_check \ -o empty \ -e empty \ From nobody Mon Jun 16 08:53:52 2025 X-Original-To: dev-commits-src-branches@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 4bLP1Y2Z08z5Vpnd; Mon, 16 Jun 2025 08:53:53 +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 4bLP1Y0JkJz3wJq; Mon, 16 Jun 2025 08:53:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064033; 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=o+7G79RLsL1xmeIJOfyqQAUFt26cwdPnFudXGMAliDw=; b=BdNg5BvReOQBgLnhZCijIlILyWkQ4lcIZGD4wWH5+FKvHG66BXczEeRv/uGLiSUT5a17eV eAU1HZ02g8a5awrZMRYss+jFyDfaCywdIwImKqqv6Hm4yI54mLrNAvrTrQqjHiD6jqE3B1 IP8NSdII5J1gMhoh/Xwq/Z8EaSV42yCy5mVxOvqqmVb6S9YMWlISCSbk+q1zv12gaHg/S0 iGgmofKWoWsLAVYh4J3reh0aF+H+zMc58K9MFRelw47sSicNPHjlf6UCXqCthCyEfZHOlB zobpyuTjdTaeoYkQcWFQhwqA1EDnXO62SrGiF6TiMSj8Y3Dmfij6t+4oaxMZKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064033; 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=o+7G79RLsL1xmeIJOfyqQAUFt26cwdPnFudXGMAliDw=; b=lr9sP8jLuluU0cvb1RlsAnazxbYr2HloRIjuBwRBY1weLT3I+NJMqC54K4TZHAYqyesxRl MngxTtpPwMBFrlKOeh/UDRAR3XYWFbMpMv5/FQcRzfoTUGt/ro8wqkGxh90WqxWVaoMjZ1 lBpKVF22VnqRBE2fPsStYCagNFc0WofWcJF9LrMGr4VS91G5v6g9BACrww2GbsVIGKAHLp 4XpWxfvU8mx58rq/bEV93CJax4CoJpJ5qOqUNgKQbD0+V8JVniQ+26mnHqtys12fDDcIFf RjU11lVOp6Ggz5T/IgZkOyuIS1RxaVooyklMp/wbl2Xa6RYj/FyTLaWvFRULCw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064033; a=rsa-sha256; cv=none; b=U/cyGKIexiUfGgUQ6RwF3ZZn8RrP+RxC24dVG3f4rXEZQF32usDiXBH2hjMTEv7OpN9a7N GtUQpJsCR9TlOCMiqdOsHIC/i7LPUetycc+QodfIEWpo8m7f5KKDt3Ysc8/Cdr3OM2fznl HcVF+1Ak6yKuYJqiLsnCdiJx1TS4p/pRaIDlfrWZewbVg1+6+ARj6aCQ3Gel7tpDnNlgt7 8Kh9oswjHHFSs0LjxTMnmRIXJbAr8URpiJ9JMNDwdjJT1bcrzspTgyo5h0kbiviIMDnw5e YC9nS8n1KRwB65K8/fN+NZYp1W9I3UZ4sOWDDI1iUd6yxAA8Lmx2QCOjdCPFiQ== 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 4bLP1X6lvCzrkJ; Mon, 16 Jun 2025 08:53:52 +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 55G8rq1U042952; Mon, 16 Jun 2025 08:53:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8rquW042948; Mon, 16 Jun 2025 08:53:52 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:53:52 GMT Message-Id: <202506160853.55G8rquW042948@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 52b047555dec - stable/14 - bin/timeout: remove unreachable break after usage() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 52b047555dec4f1ac7ff603ca86378bf522d8138 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=52b047555dec4f1ac7ff603ca86378bf522d8138 commit 52b047555dec4f1ac7ff603ca86378bf522d8138 Author: rilysh AuthorDate: 2024-01-03 19:03:52 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:51 +0000 bin/timeout: remove unreachable break after usage() (cherry picked from commit 4d8d9111a4bf79c6d5b41340b47cf768f2c6d080) --- bin/timeout/timeout.c | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 68abb28e2c50..429ca64349e3 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -230,7 +230,6 @@ main(int argc, char **argv) case 'h': default: usage(); - break; } } From nobody Mon Jun 16 08:53:53 2025 X-Original-To: dev-commits-src-branches@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 4bLP1Z3kY2z5Vpnf; Mon, 16 Jun 2025 08:53:54 +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 4bLP1Z12L9z3wH7; Mon, 16 Jun 2025 08:53:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064034; 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=uiqPJhIUjzFIkLi9aFuBGAeeBbYzovMONCDTTL3yV6s=; b=Vnb72vIbLUPSr2SCTtdj48rIwIpWH/Y1/frFE1pMeWrhHjJYxID1RN8IjPQo9c6AdAUSE6 vzj15DMK+tX7gN/xW/PVsoQz0DSfbCqhYXREy1fg0vIQqn4DzxDthHxa78ol5/X/eK8qQZ 6XFij9dhkityV3ULeLHgPBrR13e2bn8X6TsITl39+3ydQOt8G00x6PgNNAoNlqd+GqokuB 21tGYeThIolKqSX6YGp71Jdqsbj4MEg0LIdJXAldjE2TtOuiY2j3XVaZSzjBmN9FcEHpEh w1K495ro2NUhuBRpMAwUmi22b0ioGOVUwdK8DWjihU+k7gC1Mw1ctoQZ3KKpjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064034; 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=uiqPJhIUjzFIkLi9aFuBGAeeBbYzovMONCDTTL3yV6s=; b=Kyr7AshAwlNUswYi3PzjfdtuvzS+5W88AsTQKzHNUQhQF0tuqpE7jYLY7xLAWDl+pvH+yQ UKHKbcosBPmHFq3uItWuiCMlMXgQhT/2BOn/ga6Mx4SR97vJmm3KRsEsP+1X1W4OBhCZD+ Yz9ojW/q3ZAbEieIAmJUUKG3cRdmYSKiAl6QxM1tWd/nlpM9uvMcAYQ6K0ZAtJZMGuu+W/ va/pJF3Ga8r4ZvOogzHM9iSAOLeTlAq1pgsvXA8o6Mqh8MI/Xqzsn2IIjI/xS+5jt5yiXi a1VEZ2QjXkZnZYF2NLvffdY6WmskJa9QXhztm2q1Hr6l4CLULGH9vJB9Bo7PuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064034; a=rsa-sha256; cv=none; b=XlfVnx4TD53b52BsFPd0DHO6vvhDvfdxRyDm9VB1D1LNYuDu2BNMjcZcPH5NLAaHMkT3G7 eKrNcoF800Zz3kRRutPhWqlM3kYbHTsr5fa1H9QPtevHmWlHo2hcdx62n56o57wew4TrWv cW9MXg4K2Z/v4j3QsxLN7biScOZDddZQE0ojZeSSWvLgo6JJXps+iWOkXkUW37C2AtUSS+ FMdTgCVqrHo9YdUu+kh9AETckg2Ar+vv926btlpG/lVvkuuGPH22pz0D8ctgvVWUP/iBkc xpFrBWtr5P4H6gh7TFNVJZVOEDHTLFkt8d/gdJ/+xANu0DacsXrwjefZKJWPkg== 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 4bLP1Z0X9mzqy9; Mon, 16 Jun 2025 08:53:54 +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 55G8rrL6042988; Mon, 16 Jun 2025 08:53:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8rr9A042984; Mon, 16 Jun 2025 08:53:53 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:53:53 GMT Message-Id: <202506160853.55G8rr9A042984@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b57a0597fc1a - stable/14 - timeout(1): Improve duration parsing and error messages List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b57a0597fc1adc207cd5c4298288916c65699908 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b57a0597fc1adc207cd5c4298288916c65699908 commit b57a0597fc1adc207cd5c4298288916c65699908 Author: Aaron LI AuthorDate: 2025-04-02 11:20:02 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:51 +0000 timeout(1): Improve duration parsing and error messages (cherry picked from commit e7bf1e5f1d62c2e735d343c462275e7e2aaf0286) --- bin/timeout/timeout.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 429ca64349e3..83893ba0a601 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -68,19 +68,19 @@ static double parse_duration(const char *duration) { double ret; - char *end; + char *suffix; - ret = strtod(duration, &end); - if (ret == 0 && end == duration) - errx(EXIT_INVALID, "invalid duration"); + ret = strtod(duration, &suffix); + if (suffix == duration) + errx(EXIT_INVALID, "duration is not a number"); - if (end == NULL || *end == '\0') + if (*suffix == '\0') return (ret); - if (end != NULL && *(end + 1) != '\0') - errx(EXIT_INVALID, "invalid duration"); + if (suffix[1] != '\0') + errx(EXIT_INVALID, "duration unit suffix too long"); - switch (*end) { + switch (*suffix) { case 's': break; case 'm': @@ -93,11 +93,11 @@ parse_duration(const char *duration) ret *= 60 * 60 * 24; break; default: - errx(EXIT_INVALID, "invalid duration"); + errx(EXIT_INVALID, "duration unit suffix invalid"); } if (ret < 0 || ret >= 100000000UL) - errx(EXIT_INVALID, "invalid duration"); + errx(EXIT_INVALID, "duration out of range"); return (ret); } From nobody Mon Jun 16 08:53:55 2025 X-Original-To: dev-commits-src-branches@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 4bLP1b37nmz5Vq6S; Mon, 16 Jun 2025 08:53:55 +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 4bLP1b1mZHz3wMX; Mon, 16 Jun 2025 08:53:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064035; 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=LiTvZLyUOUkqjL77rBvG6CgZH4yFcUUgYpDApZWXeWs=; b=PpPhLmoDtWSbYmUdoJioUtq3jRNsXaViQJoigGtKXsXEQMVrjtG/GnOyowTZMHXQXXdzbK gZMlI4X5gXPWF17NEOwSai12mvvI/5mwz4UAtN3TCi8IveS2EvGb7XdpmnEATAC6nDA0bM 4lqd7RHIMcuRVCvBBrLYZJPDOEzin5ncpfvzdjs+idmrQ0kCJyy6rJE15FWv7ar4TYuX1r pNuaO+ceTIpg+i5fnmaXhmdBfo0ZtHotwwGt2tJ588/L4Pssw2rn0c9zfLFPZeM7HHl5az 7qOiHB4vgtB8EhYJoOrx3UN6BqJ2sHsoVR6YuH8MUz9b3lSUEMRHTOR8ESA3Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064035; 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=LiTvZLyUOUkqjL77rBvG6CgZH4yFcUUgYpDApZWXeWs=; b=l2y1uDMep935ACpcl41o6ACalw7mHTQDYbMChOaKbhM3Aqx9hdFvVRrQSccSeOihbFhA9z I17bpifjvTu8powhnBFMlztckZbpCXHaF5vt6b3b27L8A2V4Nj/HJBm2XvyDH0rqpbq/Eg Pl/9X5Fpa8RGNJQo6IrE95CdhsrUvS+i7hcIxT/M0giEoIed0FEjUie9RpxMym53LlYOha PVJTsGuikcbom2R8ca1ej/OI7IHLUzFQsqulVWhAjo2mMOImdw64y3HrmII0TOJpak0ji4 WNkksJX0JLjHL/Mcio0iTE0UiHlwKxsmGFrmT3W4MAi25LG0SrSYQdX2lxF2bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064035; a=rsa-sha256; cv=none; b=hfacZ3TMl9On/qbjEI9tq9Fh0ij5zCJk8owuc52xBhVOGVGtMrgUBaIkEnSEdcsO91U35/ u/2MtPHqyfqvVYJ2G8s0gpQIW9Kk3Scss99xpWg+tXvEKcz0z7zr4tk5rDohm77yVjXFMH V/4E9x/RLiagdqtZ6x4A5VSzFjVbegEvXD/u4drPbLlRcBT1gneYuMvCUhAhnerppWp+am EdgsdRAiiRJ2qkHqWqKScCWMcs+Iet0F0essJX356lOKjaEW4l9yzbRuhuwDIa5nxAtVGh 9qivPcSO2l9NUYLb5rKCnbHOHu8JcCBImEwouaAKsHoWDrOY2b+Tpt8hgkOoIQ== 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 4bLP1b0lvxzrvc; Mon, 16 Jun 2025 08:53:55 +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 55G8rtv3043027; Mon, 16 Jun 2025 08:53:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8rtl7043024; Mon, 16 Jun 2025 08:53:55 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:53:55 GMT Message-Id: <202506160853.55G8rtl7043024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a073aed45e9d - stable/14 - timeout(1): fix test after improvement of error messages List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a073aed45e9d5f5b955e33301286874111df7add Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a073aed45e9d5f5b955e33301286874111df7add commit a073aed45e9d5f5b955e33301286874111df7add Author: Baptiste Daroussin AuthorDate: 2025-04-16 19:26:00 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:51 +0000 timeout(1): fix test after improvement of error messages (cherry picked from commit 672ee7eb800c43a9e29c6e38e7e9927c40cb2477) --- bin/timeout/tests/timeout_test.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/timeout/tests/timeout_test.sh b/bin/timeout/tests/timeout_test.sh index 2a8e0112b97c..d08f6c01e067 100644 --- a/bin/timeout/tests/timeout_test.sh +++ b/bin/timeout/tests/timeout_test.sh @@ -126,31 +126,31 @@ invalid_timeout_body() { atf_check \ -o empty \ - -e inline:"timeout: invalid duration\n" \ + -e inline:"timeout: duration is not a number\n" \ -s exit:125 \ timeout invalid sleep 0 atf_check \ -o empty \ - -e inline:"timeout: invalid duration\n" \ + -e inline:"timeout: duration is not a number\n" \ -s exit:125 \ timeout --kill-after=invalid 1 sleep 0 atf_check \ -o empty \ - -e inline:"timeout: invalid duration\n" \ + -e inline:"timeout: duration unit suffix invalid\n" \ -s exit:125 \ timeout 42D sleep 0 atf_check \ -o empty \ - -e inline:"timeout: invalid duration\n" \ + -e inline:"timeout: duration out of range\n" \ -s exit:125 \ timeout 999999999999999999999999999999999999999999999999999999999999d sleep 0 atf_check \ -o empty \ - -e inline:"timeout: invalid duration\n" \ + -e inline:"timeout: duration out of range\n" \ -s exit:125 \ timeout 2.34e+5d sleep 0 } From nobody Mon Jun 16 08:53:56 2025 X-Original-To: dev-commits-src-branches@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 4bLP1c5jphz5Vpnr; Mon, 16 Jun 2025 08:53:56 +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 4bLP1c2CD2z3wDw; Mon, 16 Jun 2025 08:53:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064036; 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=R3aNtp5qQMmYWIrZHaytHUzl1PGS/tRnfztkds8h1WQ=; b=aq9zfQJ7ScC4H0mgbCIv92U/NSLS8N5xyJijDnUE4HRKqgz4fY3q88LgWmSbtOuaekCzb0 pgSwt/57KNh1bFwaNUBKdfQ8y0MasanqmQDBPJ78XahU0S+egG9bEvtAmyt58mGXgalXHY A3z7J5cOFVyCWK0/eLLIcCsxu/1R87yvoz8lRD5J4j0pQ3CwRMM6aryzp/bxbTP1jwVQno 3PM8RfTkE44cVHqFmPbNfSy/qvb4umzwr7IfgCkZsgCuQWC+t70iPyxiILoVQ8F7fFXPtk oUQRFctoPjeux9NAeONBqsRGPo8U94DxpxDgZw8VTY7ItTEYfoNY/oATZoqpmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064036; 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=R3aNtp5qQMmYWIrZHaytHUzl1PGS/tRnfztkds8h1WQ=; b=JORQmUuHg/YIfvoRTTXd5B6aWjvFNwq71HsRTV/t7HAhAP3vpGZaihDhs/TEeOBpoeWNJ8 y0F07ufkQFc1C0KCuFbM627fBb9gQ3bwJY954yR7Gt47Y8VqiD4FU2nQvN6tAf/0gsV7bl pzhW5RQ7R/gNiQNrOS8kQ9nDzif1Kl6ZsS1/ktQDIgHcWK8dhjqyJn+q9UpJ2wYYe61U4H l3mD9Hg0htxx3Q9RvO133Qzrhxq21e0FHJRbtnuK/ljj/gIt1U60Y+drCxGadmbyPjY2N2 MIFwa2QBHURSGkU4k5PS6DKTa+EOhPT6QLBGJASc/q3tfgCBCyDYab6EgVWhsA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064036; a=rsa-sha256; cv=none; b=x6PVjUsm95wYgGwIIFGuUC6Pxk4QNX0PiISiZN3kpY4MfvikMhZK5EKwN569yW2NXiIQbr /brcfjLtFYys5RbpqLReVOvt/phmyZ0IPCnoBzot+ieOc0fBWbx1VPmndew5ITTKBLpxGx i/3Brshl27EZoYUR/BVkUPZNq9PerqXcG2p94gbhLNWU39um/LT3VrDFPBvDMIYylC3XrK ykAQecyAsGLlziiZQU6Np1QZRhLsZIsHPgrpgeFV6bfrLmITdmtTSO3/X+pN4UB1QdXemp KD5z7Y8Wx8NI8AYshTPoxft+1Iup7gmW3KeaLT83Upyfi1z84XrByiD2NquhNQ== 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 4bLP1c1bl2zrqj; Mon, 16 Jun 2025 08:53:56 +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 55G8ruCq043062; Mon, 16 Jun 2025 08:53:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8ruS1043059; Mon, 16 Jun 2025 08:53:56 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:53:56 GMT Message-Id: <202506160853.55G8ruS1043059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d9e4b110fe91 - stable/14 - timeout(1): Use _exit(2) instead of err() in child if exec failed List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d9e4b110fe919c1e96ba3bd5fdba177f03d365c5 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d9e4b110fe919c1e96ba3bd5fdba177f03d365c5 commit d9e4b110fe919c1e96ba3bd5fdba177f03d365c5 Author: Aaron LI AuthorDate: 2025-04-02 11:23:06 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:51 +0000 timeout(1): Use _exit(2) instead of err() in child if exec failed (cherry picked from commit 35503fe28eb51ef606cf4ae077a96b3c717199d3) --- bin/timeout/timeout.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 83893ba0a601..1817ef24995f 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -178,7 +178,7 @@ main(int argc, char **argv) { int ch; int foreground, preserve; - int error, pstat, status; + int pstat, status; int killsig = SIGTERM; size_t i; pid_t pid, cpid; @@ -280,13 +280,9 @@ main(int argc, char **argv) signal(SIGTTIN, SIG_DFL); signal(SIGTTOU, SIG_DFL); - error = execvp(argv[0], argv); - if (error == -1) { - if (errno == ENOENT) - err(EXIT_CMD_NOENT, "exec(%s)", argv[0]); - else - err(EXIT_CMD_ERROR, "exec(%s)", argv[0]); - } + execvp(argv[0], argv); + warn("exec(%s)", argv[0]); + _exit(errno == ENOENT ? EXIT_CMD_NOENT : EXIT_CMD_ERROR); } if (sigprocmask(SIG_BLOCK, &signals.sa_mask, NULL) == -1) From nobody Mon Jun 16 08:53:57 2025 X-Original-To: dev-commits-src-branches@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 4bLP1d5D52z5Vq13; Mon, 16 Jun 2025 08:53:57 +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 4bLP1d33W2z3wS8; Mon, 16 Jun 2025 08:53:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064037; 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=DbhK4r0WT60Dhz0IuPNj90Rw2RIgse3rJpDucSiodVM=; b=UEeJ0pqk272ZrS/TlfWmHaushIq7L+KNB8zn9E9unAsFpBmT9ldwvxtiYVpud+ZCTHmFRH oCkN20q2XXFaz8kLTinV2Xu5+OByNcA50xN3Sc21QHeSOjvyDdxDbSJhe2cr77re2CJDQJ /A2/P1E+FYTitoVqi5j+OVpS2V94KTGszBgNb6GJZUcgfblDJwIlKQXn5MBc41NbnpLgIJ bGfQPkN1ZQf1SKBcJmFmfmJbaLdkwJDJey7Jc9IhaDLwLTH+85/jhhozuPqn2O18zw7ZHd CgW6fYa3EQK7/3x6+GvqzsWi4VG1np71MEJXHcb8jKgUp1P0sGX8tKK5VRpLjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064037; 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=DbhK4r0WT60Dhz0IuPNj90Rw2RIgse3rJpDucSiodVM=; b=aO26eh+5Na47RH8668ZP1wbqM/1TmuAh07r2pQ0WsveEE8YaYidK4zqQn9SD/yfbmzVCLB M7Vsq3drrlNjDPg852eoTCF/QkvKPJAGn4iybAmfxqSq3al8elhiB4gmKxzUdG48mpu3k/ X0NwRFBmAlJsp0pTf6fRuwHJz0KLC8y24wJ5C7TNSRZjIlDhKBZpnBFukYNHPWZXm7FOz9 o2Yd9wijGDP2v+Dk1X6lux0btkS1cF8Fv7y49N4tbGMCK7u4N4IQEpuxx9Hu633dqk8IGo BZTX0eUwHewlnTjNi5WznbRmfkOa3GKRmAoTc6yx0Z/jtKySZg9qp/NB4oZccQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064037; a=rsa-sha256; cv=none; b=d5dYlmYOPjlO0BeToEyl90DkH8FNd22INCQCcy1SRrPY7iwEFIF1cUoHzTWK1qRES96G5J leZAnaJhgC1A8DY0HAOqGW8/2H2EZu5aLy2adKdK2vtamVO3ZA/ex7rq6FrtuTTBV6zd2r RelX+kgvcWFJ+fccprst9ZAQ1Yp9iFYAf3Xtu0wPNIps4j1grQfGy8VhBEQqFqcbyh3Smc 4BRU1vY0ZnApe3KhDIJty6uhYni4I5VljRtASpSOMvhjW5snfTUovXFoBLmSaFC7td39oc knDQwRdmfvJ1OIkmzBg0zmhhk4XxP8rGv3DVm+c85sGJ/fVkVm3EOXvndh8eaw== 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 4bLP1d2F6HzrdB; Mon, 16 Jun 2025 08:53:57 +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 55G8rvHd043096; Mon, 16 Jun 2025 08:53:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8rvLs043093; Mon, 16 Jun 2025 08:53:57 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:53:57 GMT Message-Id: <202506160853.55G8rvLs043093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 6081c375d6e6 - stable/14 - timeout(1): sig_atomic_t variables must also be 'volatile' List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6081c375d6e6582df95c97aa79606694867c03de Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6081c375d6e6582df95c97aa79606694867c03de commit 6081c375d6e6582df95c97aa79606694867c03de Author: Aaron LI AuthorDate: 2025-04-02 11:24:10 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:52 +0000 timeout(1): sig_atomic_t variables must also be 'volatile' (cherry picked from commit 92f8006e8901f876af1b97d996dd245aa2c92ec0) --- bin/timeout/timeout.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 1817ef24995f..397d692d8647 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -45,10 +45,10 @@ #define EXIT_CMD_ERROR 126 #define EXIT_CMD_NOENT 127 -static sig_atomic_t sig_chld = 0; -static sig_atomic_t sig_term = 0; -static sig_atomic_t sig_alrm = 0; -static sig_atomic_t sig_ign = 0; +static volatile sig_atomic_t sig_chld = 0; +static volatile sig_atomic_t sig_term = 0; +static volatile sig_atomic_t sig_alrm = 0; +static volatile sig_atomic_t sig_ign = 0; static const char *command = NULL; static bool verbose = false; From nobody Mon Jun 16 08:53:58 2025 X-Original-To: dev-commits-src-branches@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 4bLP1f5Vc8z5Vq80; Mon, 16 Jun 2025 08:53:58 +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 4bLP1f3s1xz3w6L; Mon, 16 Jun 2025 08:53:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064038; 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=QPWRhrGWRFcZGibiCvtRcYZ4SKhP9nk2XStVUEAb2B0=; b=FzYahm/I1GO3IKAj0yI9DtzjuPv89aVE2/vYGHcWXGp9RqmSBuXsNyD4Zi5D0qV8LSLQVS RYIp+cD+GrK6BoP8x8nPsKOrM+Px2AT72sAlG1oFvNldBmJ11LNAwaAXGRTmp2GUd6FZch +Z1+orn4IKSZsCuTtKVDH+joycxQH8LCe0peilMekC78eCx6eq3SqH5zzVJHCeB9+g9XLc iO8WtPcHYnYh/l+YRuI7QlJKxo8xXGlEsLd+u8PKUa+iqg7ElMXF7Mf8Y11Vk7zqXC5tDq WXPDEJ2QmsKFMTF5J11UtuiPSROB8Sw0UfDFOURnMEyumSeuta9MiwDtAK+gvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064038; 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=QPWRhrGWRFcZGibiCvtRcYZ4SKhP9nk2XStVUEAb2B0=; b=Wfh+zXq7wZmD+fn/uC/oadzhSL+W0BuZZc3GoK52Ark4kmGLAgrQXss20JFlNI8nnVg7er f3XlWCAhGJQUpmqj+v39YhR299d1fpiwVX/Qu+JBaXmNwvShZw0SjlomSQ4Puu4yKYmgpn Os0/g4XTZOLskvSsljZSj2GjuI6+kMMAzKjwwnBZ5fguuTWElbx+BWVOtfTSHlrQ/oEoQt DktrurjRJR2DSZE/lRrle2AKHpbr1bbqYxA0XELJ5i0ljx2vTZzxo90YTPxLEXXDq1TKtE wveYnkIrWCTUYxLbxuKvMIZQnz2KpgzXNHsPQuFpPNuERZzGeWExN/pRCjiFRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064038; a=rsa-sha256; cv=none; b=Jlu+Hn6pVhUBRdI4o0uOjl0jE5RIKt/6A6o8VR+kB6ZjoHTwgLocxpdXvN5AqRbeU9NrK4 Dv/Up0pez9gl6zSPvP4zdz1fFn1fUkk8Lgw/gHXKTBZ3mkCQdCQAKE77Rw6zwSJT72D6ve EU0dFyNMDOOHgB+WNWkosXNHFZ7KlTIvcMfmP9D2I0JqXKR/ZcnJq5lY5s9/c9cRipXBwG uvP1wsiT3TJpC8VZwANeQifJjqrR5gB+tIRrouWOzkftmMguYlv7h07WgVHQx58ahSOy+9 ZK9WB/W3hiRK8g0lpNe6lCDpxhhL4WLKCrl8g/XOrYEaqKmjwg8/GwIfKzpjFw== 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 4bLP1f37xMzrvd; Mon, 16 Jun 2025 08:53:58 +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 55G8rw1x043136; Mon, 16 Jun 2025 08:53:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8rwQR043133; Mon, 16 Jun 2025 08:53:58 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:53:58 GMT Message-Id: <202506160853.55G8rwQR043133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 8461d567cfab - stable/14 - timeout(1): Multiple minor tweaks and cleanups List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8461d567cfab1d108768f2ceb21bd0a5773d1fab Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8461d567cfab1d108768f2ceb21bd0a5773d1fab commit 8461d567cfab1d108768f2ceb21bd0a5773d1fab Author: Aaron LI AuthorDate: 2025-04-02 11:53:42 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:52 +0000 timeout(1): Multiple minor tweaks and cleanups (cherry picked from commit 790e3617361a686c76276e0c2252a761726cd919) --- bin/timeout/timeout.1 | 65 ++++++++++++++------------ bin/timeout/timeout.c | 124 +++++++++++++++++++++++++------------------------- 2 files changed, 97 insertions(+), 92 deletions(-) diff --git a/bin/timeout/timeout.1 b/bin/timeout/timeout.1 index 1a5fd95a6256..b81ce2f74625 100644 --- a/bin/timeout/timeout.1 +++ b/bin/timeout/timeout.1 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 4, 2025 +.Dd April 2, 2025 .Dt TIMEOUT 1 .Os .Sh NAME @@ -33,36 +33,44 @@ .Sh SYNOPSIS .Nm .Op Fl k Ar time | Fl -kill-after Ar time -.Op Fl s Ar sig | Fl -signal Ar sig +.Op Fl s Ar signal | Fl -signal Ar signal .Op Fl v | Fl -verbose .Op Fl -foreground .Op Fl -preserve-status .Ar duration .Ar command -.Op Ar args ... +.Op Ar arg ... .Sh DESCRIPTION -.Nm +.Nm Timeout starts the .Ar command with its -.Ar args . +.Ar arg +list. If the .Ar command is still running after .Ar duration , -it is killed. -By default, +it is killed by sending the +.Ar signal , +or .Dv SIGTERM -is sent. +if the +.Fl s +option is unspecified. The special .Ar duration , zero, signifies no limit. -Therefore a signal is never sent if +Therefore, a signal is never sent if .Ar duration is 0. .Pp The options are as follows: .Bl -tag -width indent +.It Fl -foreground +Only time out the +.Ar command +itself, but do not propagate signals to its descendants. .It Fl k Ar time , Fl -kill-after Ar time Send a .Dv SIGKILL @@ -70,32 +78,29 @@ signal if .Ar command is still running after .Ar time -after the first signal was sent. -.It Fl s Ar sig , Fl -signal Ar sig +since the first signal was sent. +.It Fl -preserve-status +Always exit with the same status as +.Ar command , +even if the timeout was reached. +.It Fl s Ar signal , Fl -signal Ar signal Specify the signal to send on timeout. By default, .Dv SIGTERM is sent. .It Fl v , Fl -verbose Show information to stderr about any signal sent on timeout. -.It Fl -foreground -Do not propagate timeout to the children of -.Ar command . -.It Fl -preserve-status -Exit with the same status as -.Ar command , -even if it times out and is killed. .El -.Sh DURATION FORMAT +.Ss Duration Format The .Ar duration and .Ar time are non-negative integer or real (decimal) numbers, with an optional -unit-specifying suffix. +suffix specifying the unit. Values without an explicit unit are interpreted as seconds. .Pp -Supported unit symbols are: +Supported unit suffixes are: .Bl -tag -offset indent -width indent -compact .It Cm s seconds @@ -152,9 +157,9 @@ $ echo $? Run .Xr sleep 1 for 4 seconds and terminate process after 2 seconds. -124 is returned since no +The exit status is 124 since .Fl -preserve-status -is used: +is not used: .Bd -literal -offset indent $ timeout 2 sleep 4 $ echo $? @@ -162,8 +167,8 @@ $ echo $? .Ed .Pp Same as above but preserving status. -Exit status is 128 + signal number (15 for -.Va SIGTERM ) : +The exit status is 128 + signal number (15 for +.Dv SIGTERM ) : .Bd -literal -offset indent $ timeout --preserve-status 2 sleep 4 $ echo $? @@ -171,9 +176,9 @@ $ echo $? .Ed .Pp Same as above but sending -.Va SIGALRM +.Dv SIGALRM (signal number 14) instead of -.Va SIGTERM : +.Dv SIGTERM : .Bd -literal -offset indent $ timeout --preserve-status -s SIGALRM 2 sleep 4 $ echo $? @@ -186,9 +191,9 @@ the PDF version of the .Fx Handbook. Send a -.Va SIGTERM +.Dv SIGTERM signal after 1 minute and send a -.Va SIGKILL +.Dv SIGKILL signal 5 seconds later if the process refuses to stop: .Bd -literal -offset indent $ timeout -k 5s 1m fetch \\ @@ -202,7 +207,7 @@ $ timeout -k 5s 1m fetch \\ .Sh STANDARDS The .Nm -utility is compliant with the +utility is expected to conform to the .St -p1003.1-2024 specification. .Sh HISTORY diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 397d692d8647..aaecd7fec2e5 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -40,10 +40,10 @@ #include #include -#define EXIT_TIMEOUT 124 -#define EXIT_INVALID 125 -#define EXIT_CMD_ERROR 126 -#define EXIT_CMD_NOENT 127 +#define EXIT_TIMEOUT 124 +#define EXIT_INVALID 125 +#define EXIT_CMD_ERROR 126 +#define EXIT_CMD_NOENT 127 static volatile sig_atomic_t sig_chld = 0; static volatile sig_atomic_t sig_term = 0; @@ -52,15 +52,14 @@ static volatile sig_atomic_t sig_ign = 0; static const char *command = NULL; static bool verbose = false; -static void +static void __dead2 usage(void) { - - fprintf(stderr, "Usage: %s [-k time | --kill-after time]" - " [-s sig | --signal sig] [-v | --verbose] [--foreground]" - " [--preserve-status] \n", + fprintf(stderr, + "Usage: %s [--foreground] [-k time | --kill-after time]" + " [--preserve-status] [-s signal | --signal signal] " + " [-v | --verbose] [arg ...]\n", getprogname()); - exit(EXIT_FAILURE); } @@ -109,13 +108,11 @@ parse_signal(const char *str) const char *errstr; sig = strtonum(str, 1, sys_nsig - 1, &errstr); - if (errstr == NULL) return (sig); if (strncasecmp(str, "SIG", 3) == 0) str += 3; - for (i = 1; i < sys_nsig; i++) { if (strcasecmp(str, sys_signame[i]) == 0) return (i); @@ -133,7 +130,6 @@ sig_handler(int signo) } switch (signo) { - case 0: case SIGINT: case SIGHUP: case SIGQUIT: @@ -154,7 +150,7 @@ send_sig(pid_t pid, int signo) { if (verbose) { warnx("sending signal %s(%d) to command '%s'", - sys_signame[signo], signo, command); + sys_signame[signo], signo, command); } kill(pid, signo); } @@ -165,9 +161,11 @@ set_interval(double iv) struct itimerval tim; memset(&tim, 0, sizeof(tim)); - tim.it_value.tv_sec = (time_t)iv; - iv -= (double)tim.it_value.tv_sec; - tim.it_value.tv_usec = (suseconds_t)(iv * 1000000UL); + if (iv > 0) { + tim.it_value.tv_sec = (time_t)iv; + iv -= (double)(time_t)iv; + tim.it_value.tv_usec = (suseconds_t)(iv * 1000000UL); + } if (setitimer(ITIMER_REAL, &tim, NULL) == -1) err(EXIT_FAILURE, "setitimer()"); @@ -176,9 +174,9 @@ set_interval(double iv) int main(int argc, char **argv) { - int ch; + int ch, status; int foreground, preserve; - int pstat, status; + int pstat = 0; int killsig = SIGTERM; size_t i; pid_t pid, cpid; @@ -204,38 +202,36 @@ main(int argc, char **argv) second_kill = 0; const struct option longopts[] = { - { "preserve-status", no_argument, &preserve, 1 }, - { "foreground", no_argument, &foreground, 1 }, - { "kill-after", required_argument, NULL, 'k'}, - { "signal", required_argument, NULL, 's'}, - { "help", no_argument, NULL, 'h'}, - { "verbose", no_argument, NULL, 'v'}, - { NULL, 0, NULL, 0 } + { "foreground", no_argument, &foreground, 1 }, + { "help", no_argument, NULL, 'h' }, + { "kill-after", required_argument, NULL, 'k' }, + { "preserve-status", no_argument, &preserve, 1 }, + { "signal", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 }, }; while ((ch = getopt_long(argc, argv, "+k:s:vh", longopts, NULL)) != -1) { switch (ch) { - case 'k': - do_second_kill = true; - second_kill = parse_duration(optarg); - break; - case 's': - killsig = parse_signal(optarg); - break; - case 'v': - verbose = true; - break; - case 0: - break; - case 'h': - default: - usage(); + case 'k': + do_second_kill = true; + second_kill = parse_duration(optarg); + break; + case 's': + killsig = parse_signal(optarg); + break; + case 'v': + verbose = true; + break; + case 0: + break; + default: + usage(); } } argc -= optind; argv += optind; - if (argc < 2) usage(); @@ -247,7 +243,7 @@ main(int argc, char **argv) if (!foreground) { /* Acquire a reaper */ if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1) - err(EXIT_FAILURE, "Fail to acquire the reaper"); + err(EXIT_FAILURE, "procctl(PROC_REAP_ACQUIRE)"); } memset(&signals, 0, sizeof(signals)); @@ -263,7 +259,7 @@ main(int argc, char **argv) signals.sa_flags = SA_RESTART; for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i++) { - if (signums[i] != -1 && signums[i] != 0 && + if (signums[i] > 0 && sigaction(signums[i], &signals, NULL) == -1) err(EXIT_FAILURE, "sigaction()"); } @@ -273,9 +269,9 @@ main(int argc, char **argv) signal(SIGTTOU, SIG_IGN); pid = fork(); - if (pid == -1) + if (pid == -1) { err(EXIT_FAILURE, "fork()"); - else if (pid == 0) { + } else if (pid == 0) { /* child process */ signal(SIGTTIN, SIG_DFL); signal(SIGTTOU, SIG_DFL); @@ -285,14 +281,15 @@ main(int argc, char **argv) _exit(errno == ENOENT ? EXIT_CMD_NOENT : EXIT_CMD_ERROR); } + /* parent continues here */ + if (sigprocmask(SIG_BLOCK, &signals.sa_mask, NULL) == -1) err(EXIT_FAILURE, "sigprocmask()"); - /* parent continues here */ set_interval(first_kill); + sigemptyset(&signals.sa_mask); for (;;) { - sigemptyset(&signals.sa_mask); sigsuspend(&signals.sa_mask); if (sig_chld) { @@ -300,9 +297,7 @@ main(int argc, char **argv) while ((cpid = waitpid(-1, &status, WNOHANG)) != 0) { if (cpid < 0) { - if (errno == EINTR) - continue; - else + if (errno != EINTR) break; } else if (cpid == pid) { pstat = status; @@ -328,16 +323,18 @@ main(int argc, char **argv) killemall.rk_flags = 0; procctl(P_PID, getpid(), PROC_REAP_KILL, &killemall); - } else + } else { send_sig(pid, killsig); + } if (do_second_kill) { set_interval(second_kill); do_second_kill = false; sig_ign = killsig; killsig = SIGKILL; - } else + } else { break; + } } else if (sig_term) { if (!foreground) { @@ -345,34 +342,37 @@ main(int argc, char **argv) killemall.rk_flags = 0; procctl(P_PID, getpid(), PROC_REAP_KILL, &killemall); - } else + } else { send_sig(pid, sig_term); + } if (do_second_kill) { set_interval(second_kill); do_second_kill = false; sig_ign = killsig; killsig = SIGKILL; - } else + } else { break; + } } } while (!child_done && wait(&pstat) == -1) { if (errno != EINTR) - err(EXIT_FAILURE, "waitpid()"); + err(EXIT_FAILURE, "wait()"); } if (!foreground) procctl(P_PID, getpid(), PROC_REAP_RELEASE, NULL); - if (WEXITSTATUS(pstat)) - pstat = WEXITSTATUS(pstat); - else if (WIFSIGNALED(pstat)) - pstat = 128 + WTERMSIG(pstat); - - if (timedout && !preserve) + if (timedout && !preserve) { pstat = EXIT_TIMEOUT; + } else { + if (WIFEXITED(pstat)) + pstat = WEXITSTATUS(pstat); + else if (WIFSIGNALED(pstat)) + pstat = 128 + WTERMSIG(pstat); + } return (pstat); } From nobody Mon Jun 16 08:53:59 2025 X-Original-To: dev-commits-src-branches@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 4bLP1h1Glwz5VpgC; Mon, 16 Jun 2025 08:54:00 +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 4bLP1g4d87z3wSn; Mon, 16 Jun 2025 08:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064039; 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=l84g8cKXhYMV3vPFb3mB1OLKita99yzRKMKXjZxD15Y=; b=LuTNaBZSaD1eW2DxaTFCOWVJPVguwEc8QH+8je3Oh4pQP5cNi8n5tjMLuJfWOPZtFitKqj xflbvnndaZMuO3TVVBCww5bP+eKWO9UbD2j5XwThY1eNI/xU8lprkkFqcigbdxoGj+shzS nTwONCyYN4U76oFEzFhE9E7FInD+ufBzR1vV8jlubhTIbzLs3VbXE6gBVGNLk+pGCaJieF rBY5OxtlGDbk4stnjLGqDz9JZ+9oBgsFr2UDo5vruqu5oYeVHYncRwIXkzPXmMV0r0/V6x BWBWWuKG8Ta9RPP1RsJzA+jjqKGnNAp8p3csuBqMWq5guYQ562BH5IOzRjfQQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064039; 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=l84g8cKXhYMV3vPFb3mB1OLKita99yzRKMKXjZxD15Y=; b=lWZB3BATINi/lv4zpZHcUtCdFAqDdCmkZJzrjvDNIebymxDwdYXCUh5I7qp7J1vQqADjGT fM4tG5JIhj0uoacTLO8AZwc+ugAkgSK0CML/dhWYUBPtLOwoOGu5Wbucwm6JJDLiaGl+zi Z3DolXi9Rr5AraxbzgtQnOUMVPOXzCxV4l5wxx/1u+aX/Thi59QgB1ifMgRw2289NaLLfe H6U5HJP+w8eK29me+7nyP/fKZg5HqnFAbp/xUFsye7bsSwVuXwamnJm8lIt5ef/01/dwwo kCG/mqT7RbYzTyxEi7I5vKs1Mug1qct6Z7OKWzVbWE+aFq6yN5PjZ7S5uL8lXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064039; a=rsa-sha256; cv=none; b=lhcNoiokB+n1sjnMXIyiajVEHHo7oALJ5nZVTlWtr8hbj468miQtV9O+o5w0NntLINNLKY olDYSskAVD7pJPLpVgtfLf/+ctpYB6k9QVJm1Ryqk0WNTsy2eZoEf5dLU3RFZOqoIcQKAG zpmR9pHo/ZqJhu/UH7+stvhBMARQDcE77Ml5UIZgrWru5hDBJMsh5Q9P0V4YHiZWU3VeNh V+C+5II/tF/LPODUq7UtjI0TAfO0f8yXnCxw7JZpvvChmb2GZg78mTiHk3miFRG4wU4Uyr z6gh9NqiuFXpfNv4zVYMAuffGVCCxkqQwOuwEz17xBa2X8Cx3OISuqpfYLZmgA== 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 4bLP1g47qVzrqk; Mon, 16 Jun 2025 08:53:59 +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 55G8rxkD043171; Mon, 16 Jun 2025 08:53:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8rxwC043168; Mon, 16 Jun 2025 08:53:59 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:53:59 GMT Message-Id: <202506160853.55G8rxwC043168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: a56833c9f727 - stable/14 - timeout(1): Handle sig_alrm and sig_term together to dedup code List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a56833c9f72703ad6438c7236e60c2c44030c6ea Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a56833c9f72703ad6438c7236e60c2c44030c6ea commit a56833c9f72703ad6438c7236e60c2c44030c6ea Author: Aaron LI AuthorDate: 2025-04-02 14:34:45 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:52 +0000 timeout(1): Handle sig_alrm and sig_term together to dedup code (cherry picked from commit c5cdc13045650a9daf33dd6316ef57496e4a5dbc) --- bin/timeout/timeout.c | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index aaecd7fec2e5..4c81b64cd2b6 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -174,7 +174,7 @@ set_interval(double iv) int main(int argc, char **argv) { - int ch, status; + int ch, status, sig; int foreground, preserve; int pstat = 0; int killsig = SIGTERM; @@ -314,36 +314,23 @@ main(int argc, char **argv) break; } } - } else if (sig_alrm) { - sig_alrm = 0; - - timedout = true; - if (!foreground) { - killemall.rk_sig = killsig; - killemall.rk_flags = 0; - procctl(P_PID, getpid(), PROC_REAP_KILL, - &killemall); + } else if (sig_alrm || sig_term) { + if (sig_alrm) { + sig = killsig; + sig_alrm = 0; + timedout = true; } else { - send_sig(pid, killsig); + sig = sig_term; + sig_term = 0; } - if (do_second_kill) { - set_interval(second_kill); - do_second_kill = false; - sig_ign = killsig; - killsig = SIGKILL; + if (foreground) { + send_sig(pid, sig); } else { - break; - } - - } else if (sig_term) { - if (!foreground) { - killemall.rk_sig = sig_term; + killemall.rk_sig = sig; killemall.rk_flags = 0; procctl(P_PID, getpid(), PROC_REAP_KILL, - &killemall); - } else { - send_sig(pid, sig_term); + &killemall); } if (do_second_kill) { From nobody Mon Jun 16 08:54:00 2025 X-Original-To: dev-commits-src-branches@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 4bLP1j3krVz5Vplc; Mon, 16 Jun 2025 08:54:01 +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 4bLP1j21G4z3wJ5; Mon, 16 Jun 2025 08:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064041; 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=4ziVaiVqJO8irIJTZz1KbQg8CUTakTxuDV38CsnZlqE=; b=a0RXDt5Nr1R4iNJ7BNb9t2b/BQdFhLPLabmaspGvLM2l0YY0LAPXoQXIRz3PmvXttdnMpf uW9kCrxQuxDBrchZuZUD4757VSr73+jQ+9/ZedN7/qJ7owjuyE7PcWwqcbq6xHErdiK4bf 5ya/bG7oDjWHMXvya5sudTOTFx0yCGkYjaGc26FeHPsrPi2AxkuayCeNXfH/JThx7FUOEV w2eRMhI3JEE2tc2rZfQktb/+VQoSFKHoXNNF1jaynyRg7vm9ikwaOifWLKb4Yl5f1GdOIZ /S9yA0/W5r+G8zoLtNFh9pKTiPxGS4yO8++RVK7GSYeCAWD2IrhvyQ1kpu67Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064041; 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=4ziVaiVqJO8irIJTZz1KbQg8CUTakTxuDV38CsnZlqE=; b=Mx1YnZEQygPfr4Ak46AmSXNmZVJRnJbbN5PvJRSzfQIm/UKHRIsideuWE0vwPmUq4k2ewZ Qs1ZxoJAdKh0KsKQNk2lcOA/2+oD1xI7SGmpH823JefACePgSPv7pEi3SWUNnB8O5BisSn ClRdLdb9ozbVe2vMhYpHS9zgZC+gTxyvHXRREv0O2MDNYjUSbrJLO0EFzKcDSoczyKZzia xZQj0xiYINmU6ncAbZatC5teq47tpy/ZLQEAy3Oxsw2F6+aM0ERo/32xPKIIHrYYWl25dj jUyB1LIo5MacSCDToI26fTpGpmbbs/LupjsoPQsluUDnN66pzzCxdsGGMe9c8g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064041; a=rsa-sha256; cv=none; b=rzzq9QXsQnLWRJeUYck/QQP53G7WzaUKbW/3lDiAQ5k77Y5pHl9LGWRJddyr3iKKlwBzpk xhtjd2cQpPL9La13alL2fBAf7QeV1k5DD0G3iDC+qPQZMyj6tTBe06sNQhdr4WbNoG2/Pq E+6M2pY4MpJpB7F8tsVZJJn6LNcz49ngqEpAQYj20UM/roudxKpwQBjdwGpjx2UoYZTk/V pbpMec7q43GaG2ZKKaV4U7osxh+AFCeBHwQOqUjr92aaS/r0MaK/rBY3ICLy5VvcOxzsMX NWYnxWo/YrucEhm0o55+N9oYztBx7a8wCqoDo1IRhhUwhdF9Lcg+HbahqxmAqg== 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 4bLP1h4tQrzrkK; Mon, 16 Jun 2025 08:54:00 +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 55G8s0oR043211; Mon, 16 Jun 2025 08:54:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s0a1043208; Mon, 16 Jun 2025 08:54:00 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:00 GMT Message-Id: <202506160854.55G8s0a1043208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 865510547e24 - stable/14 - timeout(1): Add -f and -p options as per POSIX.1-2024 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 865510547e2499cb536137633419f47c7e4f5dea Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=865510547e2499cb536137633419f47c7e4f5dea commit 865510547e2499cb536137633419f47c7e4f5dea Author: Aaron LI AuthorDate: 2025-04-02 15:29:57 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:52 +0000 timeout(1): Add -f and -p options as per POSIX.1-2024 (cherry picked from commit 8a9927ecd4b6e8cb306e4b940201b4efbfbc5dcb) --- bin/timeout/timeout.1 | 8 ++++---- bin/timeout/timeout.c | 35 ++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/bin/timeout/timeout.1 b/bin/timeout/timeout.1 index b81ce2f74625..3eacdd768410 100644 --- a/bin/timeout/timeout.1 +++ b/bin/timeout/timeout.1 @@ -32,11 +32,11 @@ .Nd run a command with a time limit .Sh SYNOPSIS .Nm +.Op Fl f | Fl -foreground .Op Fl k Ar time | Fl -kill-after Ar time +.Op Fl p | Fl -preserve-status .Op Fl s Ar signal | Fl -signal Ar signal .Op Fl v | Fl -verbose -.Op Fl -foreground -.Op Fl -preserve-status .Ar duration .Ar command .Op Ar arg ... @@ -67,7 +67,7 @@ is 0. .Pp The options are as follows: .Bl -tag -width indent -.It Fl -foreground +.It Fl f , Fl -foreground Only time out the .Ar command itself, but do not propagate signals to its descendants. @@ -79,7 +79,7 @@ signal if is still running after .Ar time since the first signal was sent. -.It Fl -preserve-status +.It Fl p , Fl -preserve-status Always exit with the same status as .Ar command , even if the timeout was reached. diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 4c81b64cd2b6..7e4009f8ac8a 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -56,8 +56,8 @@ static void __dead2 usage(void) { fprintf(stderr, - "Usage: %s [--foreground] [-k time | --kill-after time]" - " [--preserve-status] [-s signal | --signal signal] " + "Usage: %s [-f | --foreground] [-k time | --kill-after time]" + " [-p | --preserve-status] [-s signal | --signal signal] " " [-v | --verbose] [arg ...]\n", getprogname()); exit(EXIT_FAILURE); @@ -175,13 +175,14 @@ int main(int argc, char **argv) { int ch, status, sig; - int foreground, preserve; int pstat = 0; int killsig = SIGTERM; size_t i; pid_t pid, cpid; double first_kill; - double second_kill; + double second_kill = 0; + bool foreground = false; + bool preserve = false; bool timedout = false; bool do_second_kill = false; bool child_done = false; @@ -198,25 +199,29 @@ main(int argc, char **argv) SIGQUIT, }; - foreground = preserve = 0; - second_kill = 0; - + const char optstr[] = "+fhk:ps:v"; const struct option longopts[] = { - { "foreground", no_argument, &foreground, 1 }, - { "help", no_argument, NULL, 'h' }, - { "kill-after", required_argument, NULL, 'k' }, - { "preserve-status", no_argument, &preserve, 1 }, - { "signal", required_argument, NULL, 's' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, 0, NULL, 0 }, + { "foreground", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "kill-after", required_argument, NULL, 'k' }, + { "preserve-status", no_argument, NULL, 'p' }, + { "signal", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 }, }; - while ((ch = getopt_long(argc, argv, "+k:s:vh", longopts, NULL)) != -1) { + while ((ch = getopt_long(argc, argv, optstr, longopts, NULL)) != -1) { switch (ch) { + case 'f': + foreground = true; + break; case 'k': do_second_kill = true; second_kill = parse_duration(optarg); break; + case 'p': + preserve = true; + break; case 's': killsig = parse_signal(optarg); break; From nobody Mon Jun 16 08:54:01 2025 X-Original-To: dev-commits-src-branches@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 4bLP1k1Svkz5Vplg; Mon, 16 Jun 2025 08:54:02 +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 4bLP1j6T3Vz3wJF; Mon, 16 Jun 2025 08:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064041; 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=NRzxHIiEq+bOgRlblvsdUlqKfX3csse8LImkH4wFtu4=; b=mW9RIv+XghA/fa4xI3gxIKQ+oo9QwcmZEzgewJBRccIwG8qMEfdEFl1RMLwfauc1DJSz+A ljpBsBd6bNBImSKTH+SM9GHivIukDAeYrkcQf2c95z2isxEhifDtwcskMCeVxfxbBBQzBE Xw2UzHGalQV7U6Zw0VBYR7FXvr/fnyO2qBoeE0ehMy5ZSGPfUCkPAntnbkMszUT0SIDJy3 0KMDa7UuHMkFE5mECiAX0MJ6jjaoaIqht7zVvXnr/dSA58TDo96hgXQNfxYqaRfQjjesLE DiCwLHyDrDdKfy9pfMkQww6male6cpyIiFhCTOomQg8oE8rps5AA7vZurFfi8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064041; 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=NRzxHIiEq+bOgRlblvsdUlqKfX3csse8LImkH4wFtu4=; b=Z2h3nVFpc3CU78HBUKNRXwuNZJVp6WKdVbxDqznYlBMQ1FODwdmZhUZHwEPSsQ9Wt096TZ 0vaNjszsGHzYazcGfZ5jkJyzfshWfezKH5q1/3QF2P52Rzcs8qEG5/f9cHYEvgcQQEBBdA pJkUuoHg5KDvb2AVaXj5Y8UC+iHDPssOsyy6brtmdfGb8J1NBmmP3jjj9Mjht18hiRxXRX xnEw9NXet/xWT5Vzp+P8Srcn4afRwSO4VJgkyq6l6MhmAf2du6xc7p3xiEB06vTzew0q57 1X9I4e4DQi4yv2FfRN6Mw0cwlAjLRMXcrV4AvzSxs/8XvdJTZr10gyc/qVlXJg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064041; a=rsa-sha256; cv=none; b=VjGB2EkJ8bjrmg2Ruua0yAucy4iMteTOsF4w7Cqo3EwH8dD8FXwjX1g3Lh+fhUP8EPk/q0 oL6uRD2YrDCPixwfVSB5Pwe206UvQBts76vnUyTSyD5M+TOG7EsCAkvJX89I8gilK8M6ra KUbudxmGOfu9XEtgoEkiI+2cg67dTQvNxEhPJHu5lAPuEDV5DqoPZ8PeeJU+60O9RHqTOz de7TIRwuDbzQlB54OxZVw9FC3TnFb4vP6L98de88vVFxFk2RPf3bOIwIhtvAQSha757m+A 58Dj6sVLDR/o312AaTUZwUSS+NKuWvH9H064RYvtONlsnqPXrV0wNHABLEV3Uw== 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 4bLP1j5s6JzrJ2; Mon, 16 Jun 2025 08:54:01 +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 55G8s1T9043245; Mon, 16 Jun 2025 08:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s162043242; Mon, 16 Jun 2025 08:54:01 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:01 GMT Message-Id: <202506160854.55G8s162043242@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 48cbc068c88f - stable/14 - timeout(1): Enhance send_sig() and prepare for later updates List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 48cbc068c88f96cc19c658bd6f759496e00fcca4 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=48cbc068c88f96cc19c658bd6f759496e00fcca4 commit 48cbc068c88f96cc19c658bd6f759496e00fcca4 Author: Aaron LI AuthorDate: 2025-04-02 15:51:47 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:52 +0000 timeout(1): Enhance send_sig() and prepare for later updates (cherry picked from commit 086f17853677d072b8c5f4b2440f9e3a9aea7bdf) --- bin/timeout/timeout.c | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 7e4009f8ac8a..8f933f509407 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -63,6 +64,19 @@ usage(void) exit(EXIT_FAILURE); } +static void +logv(const char *fmt, ...) +{ + va_list ap; + + if (!verbose) + return; + + va_start(ap, fmt); + vwarnx(fmt, ap); + va_end(ap); +} + static double parse_duration(const char *duration) { @@ -146,13 +160,25 @@ sig_handler(int signo) } static void -send_sig(pid_t pid, int signo) +send_sig(pid_t pid, int signo, bool foreground) { - if (verbose) { - warnx("sending signal %s(%d) to command '%s'", - sys_signame[signo], signo, command); + struct procctl_reaper_kill rk; + + logv("sending signal %s(%d) to command '%s'", + sys_signame[signo], signo, command); + if (foreground) { + if (kill(pid, signo) == -1) + warnx("kill(%d, %s)", (int)pid, sys_signame[signo]); + } else { + memset(&rk, 0, sizeof(rk)); + rk.rk_sig = signo; + if (procctl(P_PID, getpid(), PROC_REAP_KILL, &rk) == -1) + warnx("procctl(PROC_REAP_KILL)"); + else if (rk.rk_fpid > 0) + warnx("failed to signal some processes: first pid=%d", + (int)rk.rk_fpid); + logv("signaled %u processes", rk.rk_killed); } - kill(pid, signo); } static void @@ -188,7 +214,6 @@ main(int argc, char **argv) bool child_done = false; struct sigaction signals; struct procctl_reaper_status info; - struct procctl_reaper_kill killemall; int signums[] = { -1, SIGTERM, @@ -329,14 +354,7 @@ main(int argc, char **argv) sig_term = 0; } - if (foreground) { - send_sig(pid, sig); - } else { - killemall.rk_sig = sig; - killemall.rk_flags = 0; - procctl(P_PID, getpid(), PROC_REAP_KILL, - &killemall); - } + send_sig(pid, sig, foreground); if (do_second_kill) { set_interval(second_kill); From nobody Mon Jun 16 08:54:02 2025 X-Original-To: dev-commits-src-branches@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 4bLP1l5wDlz5Vq1D; Mon, 16 Jun 2025 08:54:03 +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 4bLP1l0Lzkz3wWd; Mon, 16 Jun 2025 08:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064043; 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=stOH5DSqaWz+Xae20i/qZ3o6EvBXd4MNpw0Sc0WaAmk=; b=vT5/GLiYXFG3cmU0/E30rVCpLgIhrwuLVYrpLze16g5oJlIWzLcsfdyQMumTAZbwlSRp74 nw+lXLouZSb4NxrRCC4be+V+a7SjxQaIaqkt4qOdoQ3AS+18I2CWtc0VWNj2RoSqa7labL X6gp++BfXflAgMOh2yL6vTJ3wq1yGMroUKutOV/uJ2w7CQAx/AIU7qE42ZDQDhwbuU7Az/ 5ci+hHkoOm5zqzbYY3fm+tPkhWmqTWt5TERTndpWEAmCMtderqeOQQfO+0XyxGKjMpUPqk LO2XdwAm5yiUPaknozXtZydqPyPvIK1gSYf9t25KZBGDnXZv7iI07O/WQ4OoPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064043; 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=stOH5DSqaWz+Xae20i/qZ3o6EvBXd4MNpw0Sc0WaAmk=; b=whT5zBOZtaUqbOZWrtTpAernTZCbNqovIH5uR7WEO5H4e2bQQuXMBsW0++iretAfnvo7IH FtsOHv5OeTPYB10FCnR9lHGWN+2dTx0FpzIVEvyUuKddohe9zusmT0NEpakUBT19TqJZn8 yAjxi3cD2LFxAGQNstPpgGjLgKtKr1oeWbBb4GyUkKG10oGAnpJ2BZPeCouhVJM5/Jq0Sc 92Af6wip+V8TGbiDe7otKIMDs6iXc+hzSsNgzdwsCY7VRNZ0f/3EFFBPZCbFXzy13N/IdN AIAqtQ1GdXIr7472hFHJdvTaR3LAZYAmEEOcJ8YfJsaXkaMEULEudhwIPPYObw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064043; a=rsa-sha256; cv=none; b=Op2l4gmRh/c6mk3sdjUW7gAODq0UBC3/U+vFW0iNC7aDh7a+G1Pvd4x3c7pb41dAnpB5wK M8iHpnW+LiXKLKOPOBTsoNTErSnNQ4u0yDJ1nCQQvfVM2ZhhXPJYHO/h0yPgnVLU73JoOi QPq3zZQGzzt06eEKny8WsYWud0NqLFT9M6faiN/O+2MCemSl0r2MRyzJXbF2oDaWcawZ3W tY4In7LiPpN7foBO4YBinltWHhr6FqwMfscKLl/GfJLDd9wuN+rsc5RQTmCAU5nv44D0WT xvbjKNZ6LpFOUXUBKp0aJu879GJASok2CYWGbW8YO6VYFtHxhSSUF1JTLc8rYQ== 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 4bLP1k6y2Tzrql; Mon, 16 Jun 2025 08:54:02 +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 55G8s27q043279; Mon, 16 Jun 2025 08:54:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s2jH043276; Mon, 16 Jun 2025 08:54:02 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:02 GMT Message-Id: <202506160854.55G8s2jH043276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e76807eb2360 - stable/14 - timeout(1): Also send SIGCONT because the child may be stopped List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e76807eb2360f56a823569b9b751ee574e24aceb Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e76807eb2360f56a823569b9b751ee574e24aceb commit e76807eb2360f56a823569b9b751ee574e24aceb Author: Aaron LI AuthorDate: 2025-04-02 16:01:17 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:52 +0000 timeout(1): Also send SIGCONT because the child may be stopped (cherry picked from commit 06c74693c286185f299410afcd312fc54a96a052) --- bin/timeout/timeout.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 8f933f509407..e702803a25c2 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -179,6 +179,24 @@ send_sig(pid_t pid, int signo, bool foreground) (int)rk.rk_fpid); logv("signaled %u processes", rk.rk_killed); } + + /* + * If the child process was stopped by a signal, POSIX.1-2024 + * requires to send a SIGCONT signal. However, the standard also + * allows to send a SIGCONT regardless of the stop state, as we + * are doing here. + */ + if (signo != SIGKILL && signo != SIGSTOP && signo != SIGCONT) { + logv("sending signal %s(%d) to command '%s'", + sys_signame[SIGCONT], SIGCONT, command); + if (foreground) { + kill(pid, SIGCONT); + } else { + memset(&rk, 0, sizeof(rk)); + rk.rk_sig = SIGCONT; + procctl(P_PID, getpid(), PROC_REAP_KILL, &rk); + } + } } static void From nobody Mon Jun 16 08:54:04 2025 X-Original-To: dev-commits-src-branches@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 4bLP1m4yK6z5VqD6; Mon, 16 Jun 2025 08:54:04 +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 4bLP1m21Jrz3wVD; Mon, 16 Jun 2025 08:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064044; 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=dZoDen9LJMTul+B/B8tMYmH9qMmG66L8yaQo/WcVMhY=; b=VHAotpBxvNpowD9CbsSIE0eLiE+Urkg5zaXCBpGeReNdPRwSkIJK1sllfxUXPb9RN7TkTC 71q92o1aqZX677xBU7qogXYJFx9QymRECwVW/BzOylrFi/adQ6K3BbPQNobmj6E+H5iYTs fe5oF8jiDQTfrc8c85R9XULB7v3/CYPxC5XVfaApXFux061nQtPdUXPEbL2Xd8H4CP2EQZ J1bVID9iN2LM3xmZKvRiyOdxrWW04kUSkjlvYCn5BfD1syvwgZXn7wHuUJW+S8/Dqy24Yh u3jiALBjl3dXvAA38WloLZZS3nKkVeMpotsK6OBd48ei+/yKQRBBJGU7nNepyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064044; 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=dZoDen9LJMTul+B/B8tMYmH9qMmG66L8yaQo/WcVMhY=; b=FQLcCYofnknEpClek7EjSB3O0n78OtvHNwVTSr1uA28MPziW/47doe6uI06PFQxoUHg5L2 cTL1JP0leteZV+si//2Q17uvhSesxU5pB2aMHM82RtarVBexaR3yJYt9q1Gx9zjvG9Lqz5 Akfz7ItMCKbJN0qOxAZlctAETcGKaEvTuZjLg6q7Wml3Hwxk0kPBRdMbgzkZNrxtVH9J5o Zl+RSgLVbKYhuQbAqqPDDP2DHyjoNqb5iigDsJaOK4m9L8iJyEZVDJXkDBktv0h3w3UANN dsfLcHVk2xuNTV8lQxWvgE92OGmtCKx20qyKC2SleLEDi/LpYEBmDIzkpEmlqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064044; a=rsa-sha256; cv=none; b=Sw5c+4GDgqy7jAh+X0AbnZeLaeIb6WUnTvcbMaoUFCuEhGp+b7FFPTz6/aDRcY7NFME4uI /1eEtZFo8OpCqhKQtL7oDdH/R9ukV9AM3MSGw9d+QkwzI/UiPt3o81RGatGCRo2muJGUWH a5RJBCd14fUnmMcDQXa6HFChea+8llwnt8wl67l6j6PBv/A0qZZl0JK9uIoRMJoWYmunYc YmTBBefGcKgAOZ88EwYy2V93D+7VWx1RJ0o8XtBs8XJlLDsJC7h2OJMaK09yORWaREIOhK faXTkNa/I/hPixBBpzYyNUjezvypeLhsYDOmOTTAb5DWZzf01QWLCIUaAd2HNQ== 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 4bLP1m0wnZzrqm; Mon, 16 Jun 2025 08:54:04 +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 55G8s4EE043320; Mon, 16 Jun 2025 08:54:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s4ct043317; Mon, 16 Jun 2025 08:54:04 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:04 GMT Message-Id: <202506160854.55G8s4ct043317@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e59571c5a789 - stable/14 - timeout(1): Fix the handling of repeated terminating signals List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e59571c5a78988a13eeaa473302a4029a459022f Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e59571c5a78988a13eeaa473302a4029a459022f commit e59571c5a78988a13eeaa473302a4029a459022f Author: Aaron LI AuthorDate: 2025-04-02 16:14:40 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:53 +0000 timeout(1): Fix the handling of repeated terminating signals (cherry picked from commit aae3eb24dfdbbe0a9e62fe7239d6038060cd07f6) --- bin/timeout/timeout.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index e702803a25c2..c3c7532a9d08 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -49,7 +49,6 @@ static volatile sig_atomic_t sig_chld = 0; static volatile sig_atomic_t sig_term = 0; static volatile sig_atomic_t sig_alrm = 0; -static volatile sig_atomic_t sig_ign = 0; static const char *command = NULL; static bool verbose = false; @@ -138,11 +137,6 @@ parse_signal(const char *str) static void sig_handler(int signo) { - if (sig_ign != 0 && signo == sig_ign) { - sig_ign = 0; - return; - } - switch (signo) { case SIGINT: case SIGHUP: @@ -377,19 +371,11 @@ main(int argc, char **argv) if (do_second_kill) { set_interval(second_kill); do_second_kill = false; - sig_ign = killsig; killsig = SIGKILL; - } else { - break; } } } - while (!child_done && wait(&pstat) == -1) { - if (errno != EINTR) - err(EXIT_FAILURE, "wait()"); - } - if (!foreground) procctl(P_PID, getpid(), PROC_REAP_RELEASE, NULL); From nobody Mon Jun 16 08:54:05 2025 X-Original-To: dev-commits-src-branches@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 4bLP1n5PMCz5VqBH; Mon, 16 Jun 2025 08:54:05 +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 4bLP1n2S4fz3wlB; Mon, 16 Jun 2025 08:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064045; 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=XT5gbQDmiHDdZEKIoMoDcZeLu3No5U6f4mrVrJOp6z0=; b=NWKqtQ7ks9lIjm2FDv/LFY2R4gYVuVMTnIjBfhHadPpTdKFF8TDm2TPPzpnKiagU8iuwSf FGScz3bY5eUOYYbvzaV9Mj8ECnI/+9+smaw3Ku370AMU4p/XytwGYC0nOKexlDwqQuBBhn zp3UkATaEYdpDWPejN8bXQffEugpEVmp+kzWb4BMMZR8quVpdV2o9nbmR2nbsbRWoJFyqG tzYnU2Uj8xmwppqM5iHQMRq/97UHtsjF6GTJTZuVRJHAJw2Hs5b6s93nZmXkrcuRxkmz+v DczMg+jXJjZYx2UwbxqXNpJrlvd6jnMGxBnqXvkN7JNLx5MCkM58W6kxPANF7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064045; 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=XT5gbQDmiHDdZEKIoMoDcZeLu3No5U6f4mrVrJOp6z0=; b=tpwt7NSFw8r9snXgEHgW5zFWB2U2LSX6DEAEdoMaoH0ox2hM5d4qoW+SXzBVzj0CVpOUtl CZ/8MDWKQL/1Qd0BBBINr6R1dMWdSr0hyLVYUS/vCYRTmvMjTgaIMihXJv2Erj2lU6KSxQ NFVcWq4heUrYTkN7idExxJxX/d5euGbOqLslN83K7xQqmeNTddoYMWGx4cKC7Gh5KjuHaZ hmlKRCdQQdV8ERcbnr9AIwcdOyPsN5jMvCEgjnOpkPfXlk9wnP8+Mb8/ttGkbtGcfFv0k2 RGLBMAPxULavhP+xLIPIiAe1d7yurhwLBNAIkDd0PlSU3aVJm0aigDNxU3bkMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064045; a=rsa-sha256; cv=none; b=WwjL5TaVAw+NOKHuIsPUwl5afi/XBMqyXInNWNiugzcpE7Gz/hNS+XnoE+ChPAOcxStTF2 nnP9Tjyc0o2eUH1eu/ZW6mDPoHAWH6HdyjCXNn6kTbX/eLg+2ROsfcBgL8bIYtgiZJKo+R vPIrRh2/wMYUh8AECXxn/bhu2QAo9mVEJ9OlwozD3iCaTT8cVMGUkJ3hnukDf+zTkAwtQX n1PI1kyO9yXwkYPvVRXkbKOK4FvAPwSVkf3cHw8QW8xmGs2kYBsprPTt99lbCdsjFa7PZ4 PZYeF76IrwkmJSaYFwrFWn2OI7cPZuxFdC7Xa2Wx87qii/+TxLLeo6vMEuKJhQ== 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 4bLP1n1vtJzrFl; Mon, 16 Jun 2025 08:54:05 +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 55G8s5hr043353; Mon, 16 Jun 2025 08:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s5se043350; Mon, 16 Jun 2025 08:54:05 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:05 GMT Message-Id: <202506160854.55G8s5se043350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f358b8dc7418 - stable/14 - timeout(1): Improve to show more verbose log messages List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: f358b8dc7418776592470b9f08585431ac81632e Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f358b8dc7418776592470b9f08585431ac81632e commit f358b8dc7418776592470b9f08585431ac81632e Author: Aaron LI AuthorDate: 2025-04-02 16:17:17 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:53 +0000 timeout(1): Improve to show more verbose log messages (cherry picked from commit 8e1d9fe06621e22b9de6b3bf1b6164a00f0f26b5) --- bin/timeout/timeout.1 | 6 +++++- bin/timeout/timeout.c | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/bin/timeout/timeout.1 b/bin/timeout/timeout.1 index 3eacdd768410..14fc19292684 100644 --- a/bin/timeout/timeout.1 +++ b/bin/timeout/timeout.1 @@ -89,7 +89,11 @@ By default, .Dv SIGTERM is sent. .It Fl v , Fl -verbose -Show information to stderr about any signal sent on timeout. +Show information to +.Xr stderr 4 +about timeouts, signals to be sent, and the +.Ar command +exits. .El .Ss Duration Format The diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index c3c7532a9d08..8a2f0faecd83 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -344,6 +344,19 @@ main(int argc, char **argv) } else if (cpid == pid) { pstat = status; child_done = true; + logv("child terminated: pid=%d, " + "exit=%d, signal=%d", + (int)pid, WEXITSTATUS(status), + WTERMSIG(status)); + } else { + /* + * Collect grandchildren zombies. + * Only effective if we're a reaper. + */ + logv("collected zombie: pid=%d, " + "exit=%d, signal=%d", + (int)cpid, WEXITSTATUS(status), + WTERMSIG(status)); } } if (child_done) { @@ -361,9 +374,12 @@ main(int argc, char **argv) sig = killsig; sig_alrm = 0; timedout = true; + logv("time limit reached or received SIGALRM"); } else { sig = sig_term; sig_term = 0; + logv("received terminating signal %s(%d)", + sys_signame[sig], sig); } send_sig(pid, sig, foreground); From nobody Mon Jun 16 08:54:06 2025 X-Original-To: dev-commits-src-branches@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 4bLP1q1BTBz5Vq8M; Mon, 16 Jun 2025 08:54:07 +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 4bLP1p3XW6z3wlQ; Mon, 16 Jun 2025 08:54:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064046; 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=8mx5cH5ItL3IUQve1YRj3oAXeGxLcHlgzcefScGukEY=; b=SpUA4edH0efDxAt1mT8JgJlDq638JAl4TLepkPvDb7Haxs2eymjSSbPs8evqL9nVAEujci +w3ktDE5uT6yyr47asVPWf52fiiGQCdnyPttw6IZcb5lPJL89cW8DFXOWT6Y5euHzjj2Fk 91LMwb3YIIUyVs1mC6GFRDK20boSJKl7AzYv/StihL3ZRRSraRFLKO+JgoAQSiRJBbzssr 5G7IKXwsFtBvKy+IGAbWPMNDB8er4+1p9xdZTIsYcXtfLQM6D+dH20C/XshCXEhzjxtbn4 031JZclUAPbt6fWvTQapnO6FbEXH6xVhvJX0V1vLi1TSGRO6MIuGAGr9Tv1vIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064046; 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=8mx5cH5ItL3IUQve1YRj3oAXeGxLcHlgzcefScGukEY=; b=sexPJDUkO508V+EEU4zmWLgKbklUUPgmJVTtxHDTu31LsN6cSR1WIVG9cC78uKeYIH3j16 nhkGvONocaAG4FUi6zS5vy/sRbcaa2rjuAyLuOzEQXlEEioRSMn/Zvvy4WDwIu2dhbesp8 xEnjnX92EiYTCD0jGaTm06BQTYiUbTTsO4VYT6m8E67LnTmMwcq8h76x7ibRxxrMvmEXrz lDPparJOm8HXJXdMVlv/NVJFdhYBuS9bRZJgsNslKk2oWhUu1w2GeSpt3kYTEPcwmrAa/q xZFdYZdACuPh7AZaf3nXBjem04zdzZ5lZEUCmrNpsd2ObTsi3eDA0/x/kv3dMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064046; a=rsa-sha256; cv=none; b=f5hmMvpNShqn1+l81/XLpYCPjE0DgOJpKAudBVmtlXRFy7B/miAtb+M1u+aZqs9aBXAlJA 6eVxaZ+PglgwKMY/TXBd998ZS/+eKxWrUJ9+EfMUpMLn+PHnc9Yq6L6s5yiGbtH54sdTD/ VHNpFLAa61NHqc4adKMzEpmzmDWSgCu4RMfcfmsALmgac1GOch2dKd+j1rl1xPJwqw9b25 98xjChutpJj0popbEozyvaXUPTjR4c9gwHkkC8wcSx9HeWz9FghwFYFVfaEJkrePRQZM1T /Uj5Rv4QuPDco08MfJ+eJAc8Sz8smEa45oczcL0pFe6OCpADKsNoH8KCiVC6IQ== 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 4bLP1p2xx8zrFm; Mon, 16 Jun 2025 08:54:06 +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 55G8s66v043386; Mon, 16 Jun 2025 08:54:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s6d0043383; Mon, 16 Jun 2025 08:54:06 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:06 GMT Message-Id: <202506160854.55G8s6d0043383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1fe93549714d - stable/14 - timeout(1): Fix the inheritance of signal dispositions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1fe93549714d01e16e76af0d279bd05c5a7e0c7d Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1fe93549714d01e16e76af0d279bd05c5a7e0c7d commit 1fe93549714d01e16e76af0d279bd05c5a7e0c7d Author: Aaron LI AuthorDate: 2025-04-03 01:07:52 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:53 +0000 timeout(1): Fix the inheritance of signal dispositions (cherry picked from commit 2390cbfe55f55916eca25e8ba94a3320535e01c9) --- bin/timeout/timeout.1 | 10 +++++++++- bin/timeout/timeout.c | 50 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/bin/timeout/timeout.1 b/bin/timeout/timeout.1 index 14fc19292684..371a167d19f3 100644 --- a/bin/timeout/timeout.1 +++ b/bin/timeout/timeout.1 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 2, 2025 +.Dd April 3, 2025 .Dt TIMEOUT 1 .Os .Sh NAME @@ -65,6 +65,14 @@ Therefore, a signal is never sent if .Ar duration is 0. .Pp +The signal dispositions inherited by the +.Ar command +are the same as the dispositions that +.Nm +inherited, except for the signal that will be sent upon timeout, +which is reset to take the default action and should terminate +the process. +.Pp The options are as follows: .Bl -tag -width indent .It Fl f , Fl -foreground diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 8a2f0faecd83..1c4cfa6e017d 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -224,6 +224,7 @@ main(int argc, char **argv) bool timedout = false; bool do_second_kill = false; bool child_done = false; + sigset_t zeromask, allmask, oldmask; struct sigaction signals; struct procctl_reaper_status info; int signums[] = { @@ -288,6 +289,33 @@ main(int argc, char **argv) err(EXIT_FAILURE, "procctl(PROC_REAP_ACQUIRE)"); } + /* Block all signals to avoid racing against the child. */ + sigfillset(&allmask); + if (sigprocmask(SIG_BLOCK, &allmask, &oldmask) == -1) + err(EXIT_FAILURE, "sigprocmask()"); + + pid = fork(); + if (pid == -1) { + err(EXIT_FAILURE, "fork()"); + } else if (pid == 0) { + /* + * child process + * + * POSIX.1-2024 requires that the child process inherit the + * same signal dispositions as the timeout(1) utility + * inherited, except for the signal to be sent upon timeout. + */ + signal(killsig, SIG_DFL); + if (sigprocmask(SIG_SETMASK, &oldmask, NULL) == -1) + err(EXIT_FAILURE, "sigprocmask(oldmask)"); + + execvp(argv[0], argv); + warn("exec(%s)", argv[0]); + _exit(errno == ENOENT ? EXIT_CMD_NOENT : EXIT_CMD_ERROR); + } + + /* parent continues here */ + memset(&signals, 0, sizeof(signals)); sigemptyset(&signals.sa_mask); @@ -310,29 +338,11 @@ main(int argc, char **argv) signal(SIGTTIN, SIG_IGN); signal(SIGTTOU, SIG_IGN); - pid = fork(); - if (pid == -1) { - err(EXIT_FAILURE, "fork()"); - } else if (pid == 0) { - /* child process */ - signal(SIGTTIN, SIG_DFL); - signal(SIGTTOU, SIG_DFL); - - execvp(argv[0], argv); - warn("exec(%s)", argv[0]); - _exit(errno == ENOENT ? EXIT_CMD_NOENT : EXIT_CMD_ERROR); - } - - /* parent continues here */ - - if (sigprocmask(SIG_BLOCK, &signals.sa_mask, NULL) == -1) - err(EXIT_FAILURE, "sigprocmask()"); - set_interval(first_kill); - sigemptyset(&signals.sa_mask); + sigemptyset(&zeromask); for (;;) { - sigsuspend(&signals.sa_mask); + sigsuspend(&zeromask); if (sig_chld) { sig_chld = 0; From nobody Mon Jun 16 08:54:07 2025 X-Original-To: dev-commits-src-branches@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 4bLP1r351nz5VprY; Mon, 16 Jun 2025 08:54:08 +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 4bLP1q4n5Jz3wpD; Mon, 16 Jun 2025 08:54:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064047; 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=ZK3/bvBzQLX/NYdsrk44RvJCiYw88asK7yGZgXiNdj4=; b=l4aiyz+IRoVxF5ZrfYY9216vWwWzsDG5dq6faXDkOCegMGOPmVpdNlb5KWABl3nKBKZfMz oww7UtbFfOfHkZ11iDENS/bLpBB4QbuKmMZbQrUa4SEUNCDMKXQLlvYf6EfWjuffRadGES Yp30QiawB3HV7FvMYUrGmxk2OrN5LCH88ZVXQebIoOXd37PUVEtN94P17C2CD0n/2A/Sdk Bsdf1n1eZBOLCnYlHOlBjncT7AnYJyTbniQXADGK/wmWUL/Wff70Kwyr0+vNAytZlSvIQf /JO0etqKMNezlfKbRrHcR0kcmA39jfY53rd9sN9iPxP2ruH2zPFL2WY57yiEfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064047; 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=ZK3/bvBzQLX/NYdsrk44RvJCiYw88asK7yGZgXiNdj4=; b=b1UWRuOw6bBCi1XloB0HJJFJrXQzsRSIQ/+yK3ArvyjWfqYA95PiDezZZTu5OZBlgYsPDD TZvl63LfJ+frlsdl1P/WQ0pP9bQeHYVGleEMLBCb3tnIaNlzLGRAX9DfEU1LFBs+s7WI9r O7qbWgbvxflcVJInVmgvLkYQBlr5dTEvaWpphIL6pXQPZdlrnGzWJl0tEHK6ZxwUl+ZSpU OhRVSHJ8VspBu1JuZn7YFL05yPVJCCivM5SRr+H5mCYQ1M72I1u5o18fi+ey+gjwyUp3PC IBd2ZAHuhbFG02jyd868MPBLHHE5pSXIDcf3yrWg/9nPfn2r9MqYx3gMrh6ekw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064047; a=rsa-sha256; cv=none; b=FSgyWoVNPsR8rbzrXOYl8nWnXMBpNFyl24U3akKYCUEGRSS4cgozqP+9hsvDgUspODp9te cfWagZ5/LwCsVUB/3zlkQTo8B0FAo6XdKlFy2cf0OdZ1/nfT0IG1e7EQrxJJnT8nw4pKXI /y73qgLZpDqapoEBQaxblpX5I/xM82yEdaNVQL3B9Hhd6U+UBHrklv3HzzTlmGtWxToDm7 w2Q4UPvJXnBh/I3g+pDqz6CYAsCyg32bqlI1h84mGZUFaYGlPtQ0lVRw4pbDEkvX6uoOX6 AFpk3KRnwU1yIpvBUx2AH/YGceW9efoZspadzP17URAj3q1eHZpYuNScVj97yQ== 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 4bLP1q41gczrkL; Mon, 16 Jun 2025 08:54:07 +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 55G8s7A3043419; Mon, 16 Jun 2025 08:54:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s7wg043416; Mon, 16 Jun 2025 08:54:07 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:07 GMT Message-Id: <202506160854.55G8s7wg043416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 795153bda6da - stable/14 - timeout(1): Catch all signals and propagate them List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 795153bda6dae27ceac4a7298106c00ca706b0ec Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=795153bda6dae27ceac4a7298106c00ca706b0ec commit 795153bda6dae27ceac4a7298106c00ca706b0ec Author: Aaron LI AuthorDate: 2025-04-03 01:20:01 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:53 +0000 timeout(1): Catch all signals and propagate them (cherry picked from commit 844cef26e810d903e11bf83cc6f6fd2e22a299f1) --- bin/timeout/timeout.1 | 22 ++++++++++++ bin/timeout/timeout.c | 92 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 79 insertions(+), 35 deletions(-) diff --git a/bin/timeout/timeout.1 b/bin/timeout/timeout.1 index 371a167d19f3..44525daaec59 100644 --- a/bin/timeout/timeout.1 +++ b/bin/timeout/timeout.1 @@ -73,6 +73,28 @@ inherited, except for the signal that will be sent upon timeout, which is reset to take the default action and should terminate the process. .Pp +If +.Nm +receives the +.Dv SIGALRM +signal, it will behave as if the time limit has been reached +and send the specified signal to +.Ar command . +For any other signals delivered to +.Nm , +it will propagate them to +.Ar command , +with the exception of +.Dv SIGKILL +and +.Dv SIGSTOP . +If you want to prevent the +.Ar command +from being timed out, send +.Dv SIGKILL +to +.Nm . +.Pp The options are as follows: .Bl -tag -width indent .It Fl f , Fl -foreground diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 1c4cfa6e017d..6e93e9e2911c 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -1,6 +1,7 @@ /*- * Copyright (c) 2014 Baptiste Daroussin * Copyright (c) 2014 Vsevolod Stakhov + * Copyright (c) 2025 Aaron LI * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,8 +48,10 @@ #define EXIT_CMD_NOENT 127 static volatile sig_atomic_t sig_chld = 0; -static volatile sig_atomic_t sig_term = 0; static volatile sig_atomic_t sig_alrm = 0; +static volatile sig_atomic_t sig_term = 0; /* signal to terminate children */ +static volatile sig_atomic_t sig_other = 0; /* signal to propagate */ +static int killsig = SIGTERM; /* signal to kill children */ static const char *command = NULL; static bool verbose = false; @@ -137,19 +140,46 @@ parse_signal(const char *str) static void sig_handler(int signo) { - switch (signo) { - case SIGINT: - case SIGHUP: - case SIGQUIT: - case SIGTERM: + if (signo == killsig) { sig_term = signo; - break; + return; + } + + switch (signo) { case SIGCHLD: sig_chld = 1; break; case SIGALRM: sig_alrm = 1; break; + case SIGHUP: + case SIGINT: + case SIGQUIT: + case SIGILL: + case SIGTRAP: + case SIGABRT: + case SIGEMT: + case SIGFPE: + case SIGBUS: + case SIGSEGV: + case SIGSYS: + case SIGPIPE: + case SIGTERM: + case SIGXCPU: + case SIGXFSZ: + case SIGVTALRM: + case SIGPROF: + case SIGUSR1: + case SIGUSR2: + /* + * Signals with default action to terminate the process. + * See the sigaction(2) man page. + */ + sig_term = signo; + break; + default: + sig_other = signo; + break; } } @@ -214,8 +244,6 @@ main(int argc, char **argv) { int ch, status, sig; int pstat = 0; - int killsig = SIGTERM; - size_t i; pid_t pid, cpid; double first_kill; double second_kill = 0; @@ -225,17 +253,8 @@ main(int argc, char **argv) bool do_second_kill = false; bool child_done = false; sigset_t zeromask, allmask, oldmask; - struct sigaction signals; + struct sigaction sa; struct procctl_reaper_status info; - int signums[] = { - -1, - SIGTERM, - SIGINT, - SIGHUP, - SIGCHLD, - SIGALRM, - SIGQUIT, - }; const char optstr[] = "+fhk:ps:v"; const struct option longopts[] = { @@ -316,22 +335,17 @@ main(int argc, char **argv) /* parent continues here */ - memset(&signals, 0, sizeof(signals)); - sigemptyset(&signals.sa_mask); - - if (killsig != SIGKILL && killsig != SIGSTOP) - signums[0] = killsig; - - for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i++) - sigaddset(&signals.sa_mask, signums[i]); - - signals.sa_handler = sig_handler; - signals.sa_flags = SA_RESTART; - - for (i = 0; i < sizeof(signums) / sizeof(signums[0]); i++) { - if (signums[i] > 0 && - sigaction(signums[i], &signals, NULL) == -1) - err(EXIT_FAILURE, "sigaction()"); + /* Catch all signals in order to propagate them. */ + memset(&sa, 0, sizeof(sa)); + sigfillset(&sa.sa_mask); + sa.sa_handler = sig_handler; + sa.sa_flags = SA_RESTART; + for (sig = 1; sig < sys_nsig; sig++) { + if (sig == SIGKILL || sig == SIGSTOP || sig == SIGCONT || + sig == SIGTTIN || sig == SIGTTOU) + continue; + if (sigaction(sig, &sa, NULL) == -1) + err(EXIT_FAILURE, "sigaction(%d)", sig); } /* Don't stop if background child needs TTY */ @@ -399,6 +413,14 @@ main(int argc, char **argv) do_second_kill = false; killsig = SIGKILL; } + + } else if (sig_other) { + /* Propagate any other signals. */ + sig = sig_other; + sig_other = 0; + logv("received signal %s(%d)", sys_signame[sig], sig); + + send_sig(pid, sig, foreground); } } From nobody Mon Jun 16 08:54:08 2025 X-Original-To: dev-commits-src-branches@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 4bLP1s1VpDz5VppT; Mon, 16 Jun 2025 08:54:09 +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 4bLP1r5K3pz3wZb; Mon, 16 Jun 2025 08:54:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064048; 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=Zw1JZksf3Ov17OtrZbbkoppFRxibyMksUk33SvckVOE=; b=dJsAnm9n25L23uNv2rOM/pypsxLgj+mcbdIqFzZW+GUiXJ2vsxpe96NQFQaYCFz0SccCbO ShdJ5/kFPHbuPeIxJ0GzORGGNYwEyk63zmik4WG1ORn4sUKaziHdejKXhVNyRR/cAaHuIH sPBvyvqFFOD0NUElxEDEIsg28xDhCQdOBOtGQwE59/RNSUavi9nGDtSBrmpVdSkpARf9jC tuWo7RO3KASQvXpA9FtT3JsRQPFDOmG0VWu3gtYM+zSYA1Jr9Scbydjr5WLmxmH0kEyLo4 tF78qOqZG++vSITYomT1Q2YZ9L0TC6VqUnGGZP9FaikXd5R+oBn7j+vIKvr6fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064048; 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=Zw1JZksf3Ov17OtrZbbkoppFRxibyMksUk33SvckVOE=; b=X0QnkDGZsMO3t5a8TO2NeqjHIxtfbZidJG4UCRP0N/TpH7jemH235mcz3EtWBMnTkXc98B iaqHpUs72MWcRFm351o284E4r5gyroAeBKcStH3Ced7cl5kADAlUKpUTgKD9YH7YYyeMVu zgk8tAPVHrMiQ6Qnyq2GSBO7BYd/GB6tO+DWGSc9UndS8962SeL2OZTz9NbQq6ernade45 4+7i6viJSfAHFNmoOD4lhtGwlvVUKD9z+spfPHS345q+JdTDi53kSzVyCuuOtxYIyl/1+W G0rRvQwHdOFe7r64Ws021j/lflailB9IAVVl/zpa0oq6eChrehFSV5pjjWiCNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064048; a=rsa-sha256; cv=none; b=kq/rRb5Ih/OojOi71WWU8rPCXXwjwzmgP5qeXmVD77Et+a4LQex2X0YANADB8bLxrlxNlw Qu9EsF3A9CvqKp0fJf15CRBpRbKkA+rB21GqgP84qGymqt/cGMv3AL9+wVXkk86beg5RyQ i9xxK15/R/l19d63S3TNoxT/evFBR75AtJnC2H69utySrpaAOfHBGgS3nKPb/sN+erPf7a N4utSuabo2pq5UrR7GYzAw8s7t2WmopahHORnujQmDgh9qxnAYfakk4xIlM7LAvyRHTq+n N9AXu/MwhNtnB6AYY61wsWtilhQWR7myiEEzxhQUbMN0KFlttHS2zQ0xNt/N4w== 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 4bLP1r4c5Qzrvf; Mon, 16 Jun 2025 08:54:08 +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 55G8s8AR043452; Mon, 16 Jun 2025 08:54:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s89e043449; Mon, 16 Jun 2025 08:54:08 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:08 GMT Message-Id: <202506160854.55G8s89e043449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: de24ba56a663 - stable/14 - timeout(1): Kill self with the same signal that terminated the child List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: de24ba56a663c608edf8091900a49b48d088896c Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=de24ba56a663c608edf8091900a49b48d088896c commit de24ba56a663c608edf8091900a49b48d088896c Author: Aaron LI AuthorDate: 2025-04-03 02:51:06 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:53 +0000 timeout(1): Kill self with the same signal that terminated the child (cherry picked from commit 613310263ae1f0f65df498dc8e98f460b781946d) --- bin/timeout/timeout.1 | 51 ++++++++++++++++++++++++--------------------------- bin/timeout/timeout.c | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 29 deletions(-) diff --git a/bin/timeout/timeout.1 b/bin/timeout/timeout.1 index 44525daaec59..43a484dac76f 100644 --- a/bin/timeout/timeout.1 +++ b/bin/timeout/timeout.1 @@ -146,37 +146,33 @@ hours days .El .Sh EXIT STATUS -If the timeout was not reached, the exit status of -.Ar command -is returned. -.Pp -If the timeout was reached and -.Fl -preserve-status -is set, the exit status of -.Ar command -is returned. -If +If the time limit was reached and the .Fl -preserve-status -is not set, an exit status of 124 is returned. -.Pp -If an invalid parameter is passed to -.Fl s -or -.Fl k , -the exit status returned is 125. -.Pp -If +option is not specified, the exit status is 124. +Otherwise, +.Nm +exits with the same exit status as the +.Ar command . +For example, +.Nm +will terminate itself with the same signal if the .Ar command -is an otherwise invalid program, the exit status returned is 126. +is terminated by a signal. .Pp -If +If an error occurred, the following exit values are returned: +.Bl -tag -offset indent with indent -compact +.It 125 +An error other than the two described below occurred. +For example, an invalid duration or signal was specified. +.It 126 +The .Ar command -refers to a non-existing program, the exit status returned is 127. -.Pp -If +was found but could not be executed. +.It 127 +The .Ar command -exits after receiving a signal, the exit status returned is the signal number -plus 128. +could not be found. +.El .Sh EXAMPLES Run .Xr sleep 1 @@ -202,7 +198,8 @@ $ echo $? .Pp Same as above but preserving status. The exit status is 128 + signal number (15 for -.Dv SIGTERM ) : +.Dv SIGTERM ) +for most shells: .Bd -literal -offset indent $ timeout --preserve-status 2 sleep 4 $ echo $? diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 6e93e9e2911c..e9c4e22fc7d3 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -239,6 +240,34 @@ set_interval(double iv) err(EXIT_FAILURE, "setitimer()"); } +/* + * In order to avoid any possible ambiguity that a shell may not set '$?' to + * '128+signal_number', POSIX.1-2024 requires that timeout mimic the wait + * status of the child process by terminating itself with the same signal, + * while disabling core generation. + */ +static void __dead2 +kill_self(int signo) +{ + sigset_t mask; + struct rlimit rl; + + /* Reset the signal disposition and make sure it's unblocked. */ + signal(signo, SIG_DFL); + sigfillset(&mask); + sigdelset(&mask, signo); + sigprocmask(SIG_SETMASK, &mask, NULL); + + /* Disable core generation. */ + memset(&rl, 0, sizeof(rl)); + setrlimit(RLIMIT_CORE, &rl); + + logv("killing self with signal %s(%d)", sys_signame[signo], signo); + kill(getpid(), signo); + err(128 + signo, "signal %s(%d) failed to kill self", + sys_signame[signo], signo); +} + int main(int argc, char **argv) { @@ -430,10 +459,12 @@ main(int argc, char **argv) if (timedout && !preserve) { pstat = EXIT_TIMEOUT; } else { + if (WIFSIGNALED(pstat)) + kill_self(WTERMSIG(pstat)); + /* NOTREACHED */ + if (WIFEXITED(pstat)) pstat = WEXITSTATUS(pstat); - else if (WIFSIGNALED(pstat)) - pstat = 128 + WTERMSIG(pstat); } return (pstat); From nobody Mon Jun 16 08:54:10 2025 X-Original-To: dev-commits-src-branches@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 4bLP1v3FZXz5VpT9; Mon, 16 Jun 2025 08:54:11 +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 4bLP1v0y28z3wgJ; Mon, 16 Jun 2025 08:54:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064051; 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=t6xMhPRHF6P2v2tJQgkK+Mp74WJMnQedljGHAE/Y3Ps=; b=ocOWeg+mBjv7s3dekMEF4oidfLcMoObb7kdml++/YGQUVt6nqnxAbQzZ7qmOgkvjq6o48h iTcxpTUQvHraG7O8LyGCEinqes5Fjd5KBA2EcCmsfvUsCKAlySSX8NFzeXqfzTH9w0VF5Q TCvyZyHhLhdwX7rPzXsTZPG/LFU+JXczfXFC/4brCwEpZgSnY5Rau4F3V0XWOXieQdYmxE UIWcIa7L87ZA1ritAmZFi6jW/c3RXpcY7TQamMegkfP8/CtfWZQIi7lmleI60QbAVYiM2H 4GXcH2nryVIjmlqEBbjnkHk8/zjzYQdZxCrQ25QSbsei5TpYCrHSBrGGid/J0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064051; 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=t6xMhPRHF6P2v2tJQgkK+Mp74WJMnQedljGHAE/Y3Ps=; b=yx2ssCRqdK/Sil530nEZZQcK7+uq4qKulneHxM+/y03+lG/luSq0j8CMFwhFuxgD7OkLvT fGOLi4O6PYWRXLrZcXw3fN4GAP5UDHqSEGBYaw7z4Q9Srm1amwZTm1vv4heOX1FNhl0CgF cAzHL3SkTY2eLn3hmYmEabRdI4vqVhPCxlmt5dpGEP7n0TVWQCNA65E2pUnpAEOc4PFLk8 mwMnvyzMiQi3HEl1aY4M9kvIfGfcWqMNThqFGxpNgRht51/cJhQV0p2MDfS11KnmZNlGrp 4BiH6L6bo3Os2C6iiAL1mf+BFo4vVQMUFSSYPU8z4xITwyxYhR/maXgGuF4QWw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064051; a=rsa-sha256; cv=none; b=ywA3Z0+7AHBT2Ua1PmUZShYqH+jrXyA7IvEsx1IN3qyyvrZ9sj0DoMg3g+f/uiIveoufX5 kTApHev+L5RnMCs69w99N/6WO5OzulLrBhL4mWV9A5SwMKgZCLMGMY+orxGRekRHfklZbN bko/fwrs/2xE0RN7Lw8STFsBgusJDIaZ7D11yohO+0CfrLwp/uOkNXws7KI6gacojtCGWt qdyuustNNVU7q9PIzJG4geJHziKwiGIK4P5JNmxhhNiolt/7jtsCp0e908CiJ6v6aCW2Kb Cxa7fnkNM9brjtKkEDIBayKGRfKQtuEFDJLtdBK9JNldoxjy/UG2b8f9wxxfZA== 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 4bLP1t6HpKzrtF; Mon, 16 Jun 2025 08:54:10 +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 55G8sAOG043524; Mon, 16 Jun 2025 08:54:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8sALA043521; Mon, 16 Jun 2025 08:54:10 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:10 GMT Message-Id: <202506160854.55G8sALA043521@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 91dc8fcff090 - stable/14 - timeout(1): Document the reaper implementation and behaivor List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 91dc8fcff09013ee44f72ee2c202466cb446afcb Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=91dc8fcff09013ee44f72ee2c202466cb446afcb commit 91dc8fcff09013ee44f72ee2c202466cb446afcb Author: Aaron LI AuthorDate: 2025-04-03 02:54:49 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:53 +0000 timeout(1): Document the reaper implementation and behaivor (cherry picked from commit c362781c8d6a878ac93f3debc45d401bd5296eee) --- bin/timeout/timeout.1 | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/bin/timeout/timeout.1 b/bin/timeout/timeout.1 index 43a484dac76f..6486ccf99a36 100644 --- a/bin/timeout/timeout.1 +++ b/bin/timeout/timeout.1 @@ -1,6 +1,7 @@ .\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2014 Baptiste Daroussin +.\" Copyright (c) 2025 Aaron LI .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -101,6 +102,9 @@ The options are as follows: Only time out the .Ar command itself, but do not propagate signals to its descendants. +See the +.Sx IMPLEMENTATION NOTES +section for more details. .It Fl k Ar time , Fl -kill-after Ar time Send a .Dv SIGKILL @@ -145,6 +149,30 @@ hours .It Cm d days .El +.Sh IMPLEMENTATION NOTES +If the +.Fl -foreground +option is not specified, +.Nm +runs as the reaper (see also +.Xr procctl 2 ) +of the +.Ar command +and its descendants, and will wait for all the descendants to terminate. +This behavior might cause surprises if there are descendants running +in the background, because they will ignore +.Dv SIGINT +and +.Dv SIGQUIT +signals. +For example, the following command that sends a +.Dv SIGTERM +signal will complete in 2 seconds: +.Dl $ timeout -s TERM 2 sh -c 'sleep 4 & sleep 5' +However, this command that sends a +.Dv SIGINT +signal will complete in 4 seconds: +.Dl $ timeout -s INT 2 sh -c 'sleep 4 & sleep 5' .Sh EXIT STATUS If the time limit was reached and the .Fl -preserve-status @@ -247,9 +275,9 @@ The command first appeared in .Fx 10.3 . .Pp -The +The initial .Fx -work is compatible with GNU +work was compatible with GNU .Nm by .An Padraig Brady , @@ -258,6 +286,7 @@ The .Nm utility first appeared in GNU Coreutils 7.0. .Sh AUTHORS -.An Baptiste Daroussin Aq Mt bapt@FreeBSD.org -and +.An Baptiste Daroussin Aq Mt bapt@FreeBSD.org , .An Vsevolod Stakhov Aq Mt vsevolod@FreeBSD.org +and +.An Aaron LI Aq Mt aly@aaronly.me From nobody Mon Jun 16 08:54:09 2025 X-Original-To: dev-commits-src-branches@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 4bLP1t5m1bz5VqDV; Mon, 16 Jun 2025 08:54:10 +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 4bLP1t2MTMz3wdr; Mon, 16 Jun 2025 08:54:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064050; 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=iEw6meZT2O5S8I7zTy6DsiB+BE0TGSuoA57Xr6NcWbI=; b=P0lpZmlHtz/rk3EqFBfBt+yfCck/0vc6pFAV68kgk3CEy17T1qzV/AangUGEOr03oUdY0q cH2n1xDSI3/O3eVdWxQ6Wl35KvUJYSEWqK0y14K/b2hFye321F4Y1RjNvj74kFAAEhi4A3 qN3Y1k13i3voF323H4x9VkK8VjxhT0UqqZpouzrJEb1LgXxBPIzYmoZQkqBMmDSzgTfbu7 DHhUtwEhvjO0/+dNLnbik0HQeISqqQVh9nLOJIzjq6ivba80kuKMHn0WCl55qJSoqyumcO qtp2MhZyH/PdFFTn4Hvc5RvnjsFeW4+Gun7EyNarn78q8FJXsZjobyaaShrkJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064050; 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=iEw6meZT2O5S8I7zTy6DsiB+BE0TGSuoA57Xr6NcWbI=; b=MnaJAYi90jelbmCAVoR6onNjos6Hlv7lflKmSZ3uJTVSpGG22tgFfzoKWnN1njItBeHDGP DYg2fM4dX+zexVnwIvfYFPlCioVaWYNEbHxn4hbOQ3P9D59hsTGRM/4OwWOAisCun7eF03 d7fcZn4P6mQR8/sEkFdnZHpThiLG3l6nbVI9uLKEqxfN8gToLEggLYSbY6OBL7TZmYldeh 9eLibFKvdZYZzKEFadeWo30/wwbmB0ekCEEnRm5nwHp16JzXbM7yFvwBKeIvuJKz8W4EFI xF7hRXs90LFDLYcAkM7GxEkWhlYWsfiOmAYAAGE7dxyVvvCUvBMq5yGd4gVuxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064050; a=rsa-sha256; cv=none; b=FTSbE3Vt4kl1DmAzfE7LbECKiObD/ABl0DAqoOG1v/pryCtbOBTT1/p13kt9ZUHHNeF1xr vYGJGHhROmqaScmkjCsupdEwO/jjCpx+wdCH/+J3rGQI43KYc0ZWhFCbuedP2RBs/zZeQS qIegXXMflqKJLsW8h0kUlVkauMwhzxOFeyj18IKypTikcCooBYKepPxT+IEm/q6Uhw2pvH zxSKt6o8tEaSV1AlyiBJX3Gqfd9irQNUKCPRljyJXOwD3HuS2jBvk2GjAmHYIFUik6nM5x u5FO3mSD4G5JT+WKLmoslP7/iPacgsmFHiWrvslg3GgZO1Qvxl+0hAzRa2IYIQ== 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 4bLP1s5P8VzrkM; Mon, 16 Jun 2025 08:54:09 +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 55G8s9P3043489; Mon, 16 Jun 2025 08:54:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8s9rT043486; Mon, 16 Jun 2025 08:54:09 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:09 GMT Message-Id: <202506160854.55G8s9rT043486@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 08d43f70eabf - stable/14 - timeout(1): adapt the preserve_status test to the new behaviour List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 08d43f70eabf1d769c7038dec1953b1275ea690e Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=08d43f70eabf1d769c7038dec1953b1275ea690e commit 08d43f70eabf1d769c7038dec1953b1275ea690e Author: Baptiste Daroussin AuthorDate: 2025-04-16 19:41:30 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:53 +0000 timeout(1): adapt the preserve_status test to the new behaviour (cherry picked from commit a25b03791764b7817a1a3e05ac1ab91c75a946ac) --- bin/timeout/tests/timeout_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/timeout/tests/timeout_test.sh b/bin/timeout/tests/timeout_test.sh index d08f6c01e067..a72aed609d47 100644 --- a/bin/timeout/tests/timeout_test.sh +++ b/bin/timeout/tests/timeout_test.sh @@ -86,7 +86,7 @@ exit_numbers_body() atf_check \ -o empty \ -e empty \ - -s exit:143 \ + -s signal:15 \ timeout --preserve-status .1 sleep 10 atf_check \ From nobody Mon Jun 16 08:54:11 2025 X-Original-To: dev-commits-src-branches@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 4bLP1w6FQ4z5Vq8c; Mon, 16 Jun 2025 08:54:12 +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 4bLP1w2pR9z3wrL; Mon, 16 Jun 2025 08:54:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064052; 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=qq6UYtmZdGCtQ4fuheit/ABBBvDuSVoPau29dXUWnxE=; b=PRRtLiPdiRn7rYA39PFbPCxnIRk2lzqGzdc7Apde30X9jenxWtYOeG0Gtte4eIr8acFK+e zLx8MGVIl0y2ZJtIzwrynVJysmoN9ESCZcjVAF8+BIs3AF7hxcj3ld69Fx+ofHsHNjMnMc qFB5FpZv6j/bjJKGW0zwu0l/VWgQBl6kDR6nf/hTbbZrPIMsGIM/Qab/1pyHcY5tSNfLiq z1m85kkr8HwlelE6ntsmbiPNuzux50/D82eXeFItqBwe5ayP0PA9NivKJd6g9B9CUlbvIm pBo2zg7DCU4SpH0X6psrTQitzpj4T4wLrD7jMa1ELyC8hFc3A+7AAC4dtZTHWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064052; 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=qq6UYtmZdGCtQ4fuheit/ABBBvDuSVoPau29dXUWnxE=; b=EVA2bL4MpIlpX8kSfaKSJNq/UdBzts/l2G8JdKnWhKyyeEtIT/c6RkNkiFWOY3P7pnjVqn YXFxZ+I7tMkR2FGZryir9OxvN8cKT1s+Evww3pMuKLr2F54PjFSYChbNO+0ZwhZLH9qjuR RGFtwyYTCm3vsQ3N7RXymg0IUmfFm3+MzTJM4aYYO0RB6VEcwcArKqrS+CeGgG6G+JB30Q dY3sRDx0Yh3t4RbW4R4E/NSKogKcU2RWYcrd9c4t9/FjgDP2Zbi1NxODw/Y8IAUFlGp1nD mAjjelblAFpC4s0rttWJzFaAVr6uoGsoxrUqUeVPdjT74rl7ZeOhGTODU5rvlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064052; a=rsa-sha256; cv=none; b=vEKh0ej0eiRRtA5eVi7eB7McK4OkRrfuUZFT904J1fHqu8UPngPSIENi8rrEi73h50IMT4 8RBTimluV9pvJnSuerO1m67ZePsO/MlIzCZFc3YP6oEYOpSd4nvbbc1SwjmYpNFmQH2dC6 shQWEOTGVIDWzyeasJWo8OidMLtpp9OnoEHR5i7hxnl9H7t8YFcq/JBk4jUA8flygdqsPs zOCRh1uipeTdNkfPV7hypBoBDLyEAwLSGO8lxhptzOmm2tPc/U9HhKXDU60HJS39Ma8h2x td3rFV7vTGIEVCjmM125RQCRNtnkfsZva/vGhEvkuui6pKoy/pkoSMO5SDaPZQ== 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 4bLP1w09Wlzrqn; Mon, 16 Jun 2025 08:54:12 +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 55G8sBGO043556; Mon, 16 Jun 2025 08:54:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8sBgb043553; Mon, 16 Jun 2025 08:54:11 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:11 GMT Message-Id: <202506160854.55G8sBgb043553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c55fd0184a17 - stable/14 - timeout(1): silence warnings for ESRCH List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: c55fd0184a17d2cb56884e6e2a15e70ad503ff76 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c55fd0184a17d2cb56884e6e2a15e70ad503ff76 commit c55fd0184a17d2cb56884e6e2a15e70ad503ff76 Author: Konstantin Belousov AuthorDate: 2025-06-07 11:24:32 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:54 +0000 timeout(1): silence warnings for ESRCH (cherry picked from commit 15e4b8d5ef845066819c4cbb5d03b63148688298) --- bin/timeout/timeout.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index e9c4e22fc7d3..424e72dac9ad 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -188,16 +188,23 @@ static void send_sig(pid_t pid, int signo, bool foreground) { struct procctl_reaper_kill rk; + int error; logv("sending signal %s(%d) to command '%s'", sys_signame[signo], signo, command); if (foreground) { - if (kill(pid, signo) == -1) - warnx("kill(%d, %s)", (int)pid, sys_signame[signo]); + if (kill(pid, signo) == -1) { + if (errno != ESRCH) + warnx("kill(%d, %s)", (int)pid, + sys_signame[signo]); + } } else { memset(&rk, 0, sizeof(rk)); rk.rk_sig = signo; - if (procctl(P_PID, getpid(), PROC_REAP_KILL, &rk) == -1) + error = procctl(P_PID, getpid(), PROC_REAP_KILL, &rk); + if (error == 0 || (error == -1 && errno == ESRCH)) + ; + else if (error == -1) warnx("procctl(PROC_REAP_KILL)"); else if (rk.rk_fpid > 0) warnx("failed to signal some processes: first pid=%d", From nobody Mon Jun 16 08:54:13 2025 X-Original-To: dev-commits-src-branches@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 4bLP1x3XKNz5Vpm8; Mon, 16 Jun 2025 08:54:13 +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 4bLP1x1bJHz3wxQ; Mon, 16 Jun 2025 08:54:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064053; 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=Fq3JIfTCi6dxf+wNZzZ03RNYhmbc88pQMA3eGf0KTPw=; b=RDtr1ieCROVqis5nLU8lubOGQyY5Z9RRkZC0LCRxFQ2w7ZgOh0fwvfxOP8QEyq67bXb7Si 78X9ANkjqOYKJYmjkq6163KQDEgPnYzGG3JEtxgqWnDmPhulg24Y8ykeThHRoevJNwS5nz SZUxn6KuYNX2RdyoQRxkC4qJAPEGh01V/tVsrKiI2zkvzIrvn62OP6Fy63LRjA7+mKbJNy umwt8c6RTyQk32hAS9W2Iac8dX0JRO83+Iy+owubzK2sJlDuK4pIz/b6pDnTjHizmfXBTG Yatb7DllIQkx5vnIW2C9frTRhC24rnF/H5VOjMJj4tgqa9zLC9PAR+gJcMKBTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064053; 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=Fq3JIfTCi6dxf+wNZzZ03RNYhmbc88pQMA3eGf0KTPw=; b=x2/z5uF6i9a8/VHaKMSlFZohcNwO7hdMmypLjiZn8LbjCujTZi9d2IDZ58cnr+ZZLpDIUm IxP9N2u4gkosiku8ThN9GNDSE1SX7bw7juFbGzl4KaNDhaJb587XCoq0Oj0XfjR43HXSEq taQuF8ysxYMAPBKHfTLIx6nE++he11TK+wH7JF5+j5HsVbYuf2EcjhOWq99fEpmxba8WlY uuI2qhr0sw9jdCKeFi+7SWs2rT/KtgYoNlhSqp3VQ+QRTV3W70PZlAl8FW7fOwkVb1JoSp bFOl5igls3i6+yabj0d8deno40lzczDS6UHBNEM70GC2bNT3wRrPqzcq76lyJQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064053; a=rsa-sha256; cv=none; b=ix3bl6j/K0MrjgsI9lhFi5zQfPMrFCjed03sq5g5aguFNbcK6PxmDTR7MR4WUN2uv2kUyU zP/IjqGcVcBEw0Ht3RS41cqR16daZNxJ/BUfJYqxBoAp11xQtWGer5s5EwACx7stUdmnwO SQaZCKVxjj9GQ1PRdBgDbAVhs87emwj8WOFzoahLAJIcXhmeFO9SFrhB2giTVeMeHf103L rzbuDG0nUMu4amtT9Y9OqU9y0V+eX8uvHm/vuXzPC8y/YK0XHunhcKD27WRrfyzEyD4UVS HkRPPsfgTxnc/0eGmWGwweP+GYCExQQnFZF0pStN7VnTDmY5BwP2gRBfenrwGA== 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 4bLP1x19r7zrkN; Mon, 16 Jun 2025 08:54:13 +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 55G8sDJL043588; Mon, 16 Jun 2025 08:54:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8sDvh043585; Mon, 16 Jun 2025 08:54:13 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:13 GMT Message-Id: <202506160854.55G8sDvh043585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1adea6e97f81 - stable/14 - timeout(1): print errno when signalling syscalls failed List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1adea6e97f814194d986daeaf2ae1327183a6156 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1adea6e97f814194d986daeaf2ae1327183a6156 commit 1adea6e97f814194d986daeaf2ae1327183a6156 Author: Konstantin Belousov AuthorDate: 2025-06-07 11:29:15 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:54 +0000 timeout(1): print errno when signalling syscalls failed (cherry picked from commit bff05e8a8c3c64bfe6152870cb758d00991ec66b) --- bin/timeout/timeout.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 424e72dac9ad..05904522c5b5 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -195,7 +195,7 @@ send_sig(pid_t pid, int signo, bool foreground) if (foreground) { if (kill(pid, signo) == -1) { if (errno != ESRCH) - warnx("kill(%d, %s)", (int)pid, + warn("kill(%d, %s)", (int)pid, sys_signame[signo]); } } else { @@ -204,11 +204,13 @@ send_sig(pid_t pid, int signo, bool foreground) error = procctl(P_PID, getpid(), PROC_REAP_KILL, &rk); if (error == 0 || (error == -1 && errno == ESRCH)) ; - else if (error == -1) - warnx("procctl(PROC_REAP_KILL)"); - else if (rk.rk_fpid > 0) - warnx("failed to signal some processes: first pid=%d", - (int)rk.rk_fpid); + else if (error == -1) { + warn("procctl(PROC_REAP_KILL)"); + if (rk.rk_fpid > 0) + warnx( + "failed to signal some processes: first pid=%d", + (int)rk.rk_fpid); + } logv("signaled %u processes", rk.rk_killed); } From nobody Mon Jun 16 08:54:14 2025 X-Original-To: dev-commits-src-branches@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 4bLP1y5Wwnz5VqBf; Mon, 16 Jun 2025 08:54:14 +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 4bLP1y2wKRz3wbb; Mon, 16 Jun 2025 08:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064054; 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=Z3+6lWlhD8dyyLdzBnqQdA+KFJcj+56gYAxpt+nmaV0=; b=Sgi43nenYYYrGnAZ7XGKMOTOyqwRd22C6FLTW0HxnkeAVHvz/MLpYwFpSWURD3F+xB9LUq dA+hwwFqMFDkN5Da4VVI1V5Y+WIbXEUMjv4mf5VqqdpSrh0IpLkWtPmVu2smb0GdZ+ba04 C2pRRjLj1+dpGz/HeU6oncKgdupiRRdH0kSMSL0OIPZ7RWybT8daLim1DS7ufKuxviVx2v A54tUTe4JICDfRCweHSiv5QYyQH29VbGdaL6HF0mgHF2mgazontoK2fT4EUiMx5bZkuip5 iCxRfvqGRgBLVJW0t0kNjARbHoc6A08A6QqIl/NS5ImEn+Pyx/Yb3D0d7w07eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064054; 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=Z3+6lWlhD8dyyLdzBnqQdA+KFJcj+56gYAxpt+nmaV0=; b=Rtjnkw9M1wHCf0tXuskQ3B9iyYrjHGbiXasj+lQAyR4vHuQ0eXYpFf/jZFZQI46Owv9Cbo oZBdOrN3mWDtHiLRiRBx+GeMyvIVOgoGZeviTWcMUOMOHkag7rvXGJElLW0g0GMNvEsKxN KlOtfPEdCBJQ9CngBfKYWFbm0fE7p2X+mPz9dv1AhrCbss/jc0DVnzvGjKvGNOJOB1hdwn 6ina/L7jmDyyPnOdFEggJFo4di4T2zJQfySgFDh6mQUy8/n+iZCAo+m9pRXzmBhIgBwuZw nubigdPilA1Dn7rSae8fexeD2xNRzKen13kpx1fV2RyAGmsa6340rtC5GY310A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064054; a=rsa-sha256; cv=none; b=EHz+UF4n/2JLK8McMn9BG/wVDTiEp6AdzD72zAAw7oyKLgUN+UAIsPe2XIpopavw4k2u1r yRt2VpMF/buc7fESVvHdHyPHQEks+crWThXzfidiHq1n9wkBbQ9fo0nCHwHJagm4s0fPRR /niDr0rLPwcMGMYuLbWj9Vhg4Z3aELtOEHiwLDz4ZsoObIDSpRk7mYIFtRZqb1SQpQSHF1 xpSO2IcJtn3S4ZYVZAy21wT33OLcxW9bLh6IUQ72FcyumZk1DnHkmwSpwG5AatBzK5ROT2 EjxdS66FTF+vHnrQYL7OJ32twzNET3hFmFpWysdfPXCO0FKN87Ib0VLylzBZmQ== 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 4bLP1y20q0zrJ3; Mon, 16 Jun 2025 08:54:14 +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 55G8sErj043620; Mon, 16 Jun 2025 08:54:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8sEpp043617; Mon, 16 Jun 2025 08:54:14 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:14 GMT Message-Id: <202506160854.55G8sEpp043617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b535341df32c - stable/14 - timeout(1): only start the child command after the parent is fully set up List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b535341df32cccaa097da4be304b0fad2290ab43 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b535341df32cccaa097da4be304b0fad2290ab43 commit b535341df32cccaa097da4be304b0fad2290ab43 Author: Konstantin Belousov AuthorDate: 2025-06-08 15:47:49 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:54 +0000 timeout(1): only start the child command after the parent is fully set up (cherry picked from commit aa8cdb7cae7b7550d5cb81d85ee294c4f182f694) --- bin/timeout/timeout.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index 05904522c5b5..f47976aa27df 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include @@ -283,6 +283,8 @@ main(int argc, char **argv) int ch, status, sig; int pstat = 0; pid_t pid, cpid; + int pp[2], error; + char c; double first_kill; double second_kill = 0; bool foreground = false; @@ -351,6 +353,9 @@ main(int argc, char **argv) if (sigprocmask(SIG_BLOCK, &allmask, &oldmask) == -1) err(EXIT_FAILURE, "sigprocmask()"); + if (pipe2(pp, O_CLOEXEC) == -1) + err(EXIT_FAILURE, "pipe2"); + pid = fork(); if (pid == -1) { err(EXIT_FAILURE, "fork()"); @@ -366,6 +371,11 @@ main(int argc, char **argv) if (sigprocmask(SIG_SETMASK, &oldmask, NULL) == -1) err(EXIT_FAILURE, "sigprocmask(oldmask)"); + error = read(pp[0], &c, 1); + if (error == -1) + err(EXIT_FAILURE, "read from control pipe"); + if (error == 0) + errx(EXIT_FAILURE, "eof from control pipe"); execvp(argv[0], argv); warn("exec(%s)", argv[0]); _exit(errno == ENOENT ? EXIT_CMD_NOENT : EXIT_CMD_ERROR); @@ -391,6 +401,11 @@ main(int argc, char **argv) signal(SIGTTOU, SIG_IGN); set_interval(first_kill); + error = write(pp[1], "a", 1); + if (error == -1) + err(EXIT_FAILURE, "write to control pipe"); + if (error == 0) + errx(EXIT_FAILURE, "short write to control pipe"); sigemptyset(&zeromask); for (;;) { From nobody Mon Jun 16 08:54:15 2025 X-Original-To: dev-commits-src-branches@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 4bLP200Tpxz5Vq23; Mon, 16 Jun 2025 08:54:16 +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 4bLP1z3Ykvz3x0v; Mon, 16 Jun 2025 08:54:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064055; 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=nOyI7lEtqTDFXUhX3LKzinXQqgT5FU9+hGgMz3ZSCR4=; b=FhtvGyPVcIGpVZwAzu5mdlJb8uv7A4b3h9/YqTgSzfsBEKyQRDi70UTFJMbTcfFvvc1npf VnOr06Uqwsu6Mo8Mn18Yk8F75lYmSnsn9m/hlvXCEfXWhRGHxIXifgLQFJBajKifyVEHvp L4nM9HbKVyn9Ni2qQMVUd7xdnOmriFFIBEkUkaHFvAjKqeE8iJUYAWOUd9/EtRyAJ6u57X /N+sIlB1nIlT0dFrI5B7ZQjXvcVnJu1sXwTslT52nwowNrfRC35ds6RbI5L57QWnFk8AHh XGO0lNwhfNs26babVgQc31KKuLmIKFqmwCCAG+N21SeTMPZ3GQJtby3bVFZijg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064055; 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=nOyI7lEtqTDFXUhX3LKzinXQqgT5FU9+hGgMz3ZSCR4=; b=l+hmkIfsFMJoBPSwFKLR3P7Im3xDZHEGxaqKiwqB0j07SDknQ5kXKbSQrjM6OYVLubZz5f 1VFqPwnBK9ZQaoCOBKmGq7CXa7q1eoG1qwTeCG0Lo6+2WNHgw+ZSeolA0xLHuuoQNrnC0t 7IhAWZkKnh5/Wp6KgRqO+UCGS3jTH2qQhOxkXuSw9yUPtTiNXTidE5yoSHjkGOtKV9stsY ZvNOvZix5CEF76FPcQv0kSh7OwfsMLxynzkolbt7B0nVvttd3Fdn51rw1MKu/tDtkZYKxG pYG4Cli1WM98034Vw+BBo9i5poRVIGYkqTymludoasDH/d6Jf7AjmLG1hsB6Ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064055; a=rsa-sha256; cv=none; b=BS03jkEYwk51FKcvzqBezZ4695vpA/u7g6cIT+FSyF9ZDk9lfsz5pgGNYaS0sqJbSPY46w 54ExVB+xcn3eoQh5QXujgqEoIrkq1BtQlVqNjFSVe1gkjYb3YY82uoSzJseacTw+O3YHoY cC6vfGmbyefm2yMt8Xj3V/tnutVr7I39g2KBGp2FdcUYOT0OUfLySt5bTAEgHcMnPrEEUx 4S6ASigUVo7iXbGBn37MObGF4BA+m06vJNtoNmJ425gGgjuyNLVSFtYfORygq4e1jOs8cR EvtjBIDYwHJF7ZtN005JxaGcIktX2XFqEvjD/yDGK0zbjb/gIAfk5EMkIpDasg== 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 4bLP1z337zzrkP; Mon, 16 Jun 2025 08:54:15 +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 55G8sFWj043656; Mon, 16 Jun 2025 08:54:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8sFkn043653; Mon, 16 Jun 2025 08:54:15 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:15 GMT Message-Id: <202506160854.55G8sFkn043653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5c2e905a7599 - stable/14 - timeout(1): pass full 32bit error return code from the exited child List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5c2e905a75996a5a2aa16631f951502b7c43cc3e Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5c2e905a75996a5a2aa16631f951502b7c43cc3e commit 5c2e905a75996a5a2aa16631f951502b7c43cc3e Author: Konstantin Belousov AuthorDate: 2025-06-09 03:20:16 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:55 +0000 timeout(1): pass full 32bit error return code from the exited child (cherry picked from commit 81ef00125056a68ca3bba1424d6cb13533bf474c) --- bin/timeout/timeout.c | 58 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c index f47976aa27df..58a5797f3eaf 100644 --- a/bin/timeout/timeout.c +++ b/bin/timeout/timeout.c @@ -277,12 +277,25 @@ kill_self(int signo) sys_signame[signo], signo); } +static void +log_termination(const char *name, const siginfo_t *si) +{ + if (si->si_code == CLD_EXITED) { + logv("%s: pid=%d, exit=%d", name, si->si_pid, si->si_status); + } else if (si->si_code == CLD_DUMPED || si->si_code == CLD_KILLED) { + logv("%s: pid=%d, sig=%d", name, si->si_pid, si->si_status); + } else { + logv("%s: pid=%d, reason=%d, status=%d", si->si_pid, + si->si_code, si->si_status); + } +} + int main(int argc, char **argv) { - int ch, status, sig; + int ch, sig; int pstat = 0; - pid_t pid, cpid; + pid_t pid; int pp[2], error; char c; double first_kill; @@ -295,6 +308,7 @@ main(int argc, char **argv) sigset_t zeromask, allmask, oldmask; struct sigaction sa; struct procctl_reaper_status info; + siginfo_t si, child_si; const char optstr[] = "+fhk:ps:v"; const struct option longopts[] = { @@ -414,26 +428,27 @@ main(int argc, char **argv) if (sig_chld) { sig_chld = 0; - while ((cpid = waitpid(-1, &status, WNOHANG)) != 0) { - if (cpid < 0) { + for (;;) { + memset(&si, 0, sizeof(si)); + error = waitid(P_ALL, -1, &si, WEXITED | + WNOHANG); + if (error == -1) { if (errno != EINTR) break; - } else if (cpid == pid) { - pstat = status; + } else if (si.si_pid == pid) { + child_si = si; child_done = true; - logv("child terminated: pid=%d, " - "exit=%d, signal=%d", - (int)pid, WEXITSTATUS(status), - WTERMSIG(status)); - } else { + log_termination("child terminated", + &child_si); + } else if (si.si_pid != 0) { /* * Collect grandchildren zombies. * Only effective if we're a reaper. */ - logv("collected zombie: pid=%d, " - "exit=%d, signal=%d", - (int)cpid, WEXITSTATUS(status), - WTERMSIG(status)); + log_termination("collected zombie", + &si); + } else /* si.si_pid == 0 */ { + break; } } if (child_done) { @@ -482,13 +497,14 @@ main(int argc, char **argv) if (timedout && !preserve) { pstat = EXIT_TIMEOUT; + } else if (child_si.si_code == CLD_DUMPED || + child_si.si_code == CLD_KILLED) { + kill_self(child_si.si_status); + /* NOTREACHED */ + } else if (child_si.si_code == CLD_EXITED) { + pstat = child_si.si_status; } else { - if (WIFSIGNALED(pstat)) - kill_self(WTERMSIG(pstat)); - /* NOTREACHED */ - - if (WIFEXITED(pstat)) - pstat = WEXITSTATUS(pstat); + pstat = EXIT_FAILURE; } return (pstat); From nobody Mon Jun 16 08:54:16 2025 X-Original-To: dev-commits-src-branches@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 4bLP2108bKz5Vprr; Mon, 16 Jun 2025 08:54:17 +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 4bLP204rNDz3wsB; Mon, 16 Jun 2025 08:54:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064056; 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=k2emwGjVF+oRp1I1tvDrVMI8QmsBASPLc+agHSAYBdw=; b=mq48rR+csK2+z2YNpoXYnL3e4fNBIJzYufaiPerQC9wDnEEmjPwCFi74T7X5x7gnDHABGq adyfHhqxtU7p0atc/rVJRzzEBEioKSwviMG3AZStC5IsWPDxiv026crq1BRQAaKRA45ia0 pjAAyClM7Jmantz0EG3/kVfqEuJhptV9Bej2UH3STp83U2rvHwK8XZSeEQoYxNJBeFCkJB aXRVaqIqEKK6HcgtVWIq95vwDu5Cy2zqH3Rnb0zGhLV1hUd+KXM3Av1wPJ/iR2YD5VZwo3 +qlt++QcxuzNVJPFvgQt8SVcCps7IJkyXfSEj3GowvVlQaSlVxyI9LkRGtzeNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750064056; 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=k2emwGjVF+oRp1I1tvDrVMI8QmsBASPLc+agHSAYBdw=; b=LMNzI+ra3C/s7cl4wxGCAMogA/G90hA3puxO3IRXulqu6U3MapxgnUR7t+gos3rjqg2lTA kt0FAMFMx0CDHkbX3aEe6No8PPX1MCI/lztU5VC/wioyjRgcUrwH1pWXTZX1bG9mmvjxkI FYT96VjxPIiNcCVHlGM0YGVHJpLrcT2WJI9u/m2bNLetqhw01/2xvAgf5JU/5OGlPmTUdD wErM5LP8cCsG6PlIswY785pYk6+w+PHgXt29EGXoe5iV4prE3dpw2RSplSnx51ORaBlZ1U 0MBhAu7pFSlCWw5dro4bS5F1s+Irh45+e2UR7lqokbKBj6ivd5xo8KprTu0FFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750064056; a=rsa-sha256; cv=none; b=vEnpQWka8Vjct+uYPytHefWSKoK8mnfi5Zqbac0qG+fF8m0dTjzbOH4NX0uypP6qQK2tR2 bJD9S2qjpDcw6Kbiyc/11tTkALOYhlKGFUVzvp5wzZSGBIpQhkE0lOIhnB+qBTEs/aHo9v CWDYWdGY3wG4UGUo5eTh+LpR5cXOGbrc0C+6wwlyLbsFlZHrH4wkzrRIUcF59pwZP+lcoI ppFNPXQzxFfAWBDJs9veyMbC630L3FZxaudP8l3+kMY84LLYjYrI/2v6jP/Ssbgu1G+XQl TmQbVkHdJodD39oEmdQ7SOr7rwrvIvu4YuxJoqgCMHAmaVdSGGlrPOuSMvs2kA== 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 4bLP2040Bpzrqp; Mon, 16 Jun 2025 08:54:16 +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 55G8sGxx043690; Mon, 16 Jun 2025 08:54:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55G8sGlA043687; Mon, 16 Jun 2025 08:54:16 GMT (envelope-from git) Date: Mon, 16 Jun 2025 08:54:16 GMT Message-Id: <202506160854.55G8sGlA043687@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d4922e20a980 - stable/14 - timeout(1) tests: atf_fail requires a reason List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d4922e20a980de452a66b014fb56d5492c60d934 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d4922e20a980de452a66b014fb56d5492c60d934 commit d4922e20a980de452a66b014fb56d5492c60d934 Author: Konstantin Belousov AuthorDate: 2025-06-09 10:26:07 +0000 Commit: Konstantin Belousov CommitDate: 2025-06-16 08:51:55 +0000 timeout(1) tests: atf_fail requires a reason (cherry picked from commit 4078e0d1d6f8189bff44fcad04df256220035f76) --- bin/timeout/tests/timeout_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/timeout/tests/timeout_test.sh b/bin/timeout/tests/timeout_test.sh index a72aed609d47..b1bf69968e84 100644 --- a/bin/timeout/tests/timeout_test.sh +++ b/bin/timeout/tests/timeout_test.sh @@ -112,7 +112,7 @@ with_a_child_body() { out=$(sleep .1 & exec timeout .5 sh -c 'sleep 2; echo foo') status=$? - test "$out" = "" && test $status = 124 || atf_fail + test "$out" = "" && test $status = 124 || atf_fail "wrong status $status" } From nobody Mon Jun 16 20:24:41 2025 X-Original-To: dev-commits-src-branches@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 4bLhLf2zKNz5yMkR; Mon, 16 Jun 2025 20:24:42 +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 4bLhLf0pdxz3JRg; Mon, 16 Jun 2025 20:24:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750105482; 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=xidhFoG+oW7SGpPwh1m67XKwzdyqLtAVrdUT2pA176E=; b=SkCFXWiNP3XaAAihfJvCB9VcxyhLhCwiRMugn/tqN82IXggRtWMPJtGr2md/3q9W4xyW/g MK2S5xXrfL+vOYFZ14tJqc9V14+Ow4po52/ScvISORpXMZsgjj0Lxh9d210Z5ZSAoFTLS1 3Yd1ipTMHRCVZJhYUpKTun11h3TL5R+k/ppzQziBBTnOne+5nDPem2B8/Ek66Dpx9yfqKC O5VezVNNjJyY0+Y4kG4NhF8qwObum3vOIrpfJdD+4y1StXNalFl/ukQLlcj3lTON68G+DQ VC6kHgaueRgb/LO4zlUeEmAJVbBCX008+iVMU8JWC0a9zmq24SbMbx1mOaKdFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750105482; 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=xidhFoG+oW7SGpPwh1m67XKwzdyqLtAVrdUT2pA176E=; b=Y3CUkghaJoM6AL9kTz+6itx8OL8xSxZP4s8n8qv9njXZcdnEet8iA+Ivt7jiF737kYcgQw 1nX5mbgZ6e2EhDs9Eksh9IivJaGlAn+vugsT0mpSWzH3QoQ1IuY+B9xNhsIeGpEczyWIYO Tpai1xliYAsVvccxj0t/nPm/V3ELUykXwl7ioU0H/FkwmhS7uTVkH3e6mXr/FaqL5GaqKg ntgVgdxxO+wjxS6iFERi1QCAr+JPSGMt5Rvn4eHvVRW8V9bDXqiSo2CoVkkHYFj2TcHWiF lw0rbKzfrfIqnvbj8DrX09ubdnQknxLIXoyiq5ZdSPjkA3aOwx0KtGGg8DgA1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750105482; a=rsa-sha256; cv=none; b=og0WrFd0al6GhwTGODl2yQ32NXi+3bQ78b0e3Cdd8FGOxuZXPLUSynDY2bR2Ikqg67tkGW 4bZkgHLL2FGdSjgL91XjMBXo8VC+CBW9gaWVwRQOs4Er5LaUn1rwLpysvA5tby2EUiKZUs mPzngerFpDVBYt70ClTZaEWHUaqoofjn1+rwcrfsNsbZ3GLZ+VYysrFnQJb/oz562rVcyx 2cwhuRIHOJNdUXbZBi1hpv6DBYVcgd9K10Cn7TAzBOgnjHEoGAb3bNm5lm16MB2Op8b+rB ZRmRSH15jSW6GxTyr0TRSSKtp0/mNhXVNuvqP+gqmsk8MZeNFL/aj0xCahK5+g== 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 4bLhLf0MYgz1BZt; Mon, 16 Jun 2025 20:24:42 +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 55GKOf8j040240; Mon, 16 Jun 2025 20:24:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55GKOfpw040237; Mon, 16 Jun 2025 20:24:41 GMT (envelope-from git) Date: Mon, 16 Jun 2025 20:24:41 GMT Message-Id: <202506162024.55GKOfpw040237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 27955ed58e19 - stable/14 - mac_do(4): Examples: Fix some descriptions and a typo List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 27955ed58e1900549d9da48b3fb7d615c0470e40 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=27955ed58e1900549d9da48b3fb7d615c0470e40 commit 27955ed58e1900549d9da48b3fb7d615c0470e40 Author: Olivier Certner AuthorDate: 2025-06-11 23:07:49 +0000 Commit: Olivier Certner CommitDate: 2025-06-16 20:08:19 +0000 mac_do(4): Examples: Fix some descriptions and a typo MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit 94828b33803314b5c8e833b233ca6894a340aa88) Event: Kitchener-Waterloo Hackathon 202506 --- share/man/man4/mac_do.4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/mac_do.4 b/share/man/man4/mac_do.4 index 4c067205225c..f64eae600436 100644 --- a/share/man/man4/mac_do.4 +++ b/share/man/man4/mac_do.4 @@ -348,12 +348,12 @@ Here are several examples of single rules matching processes having a real user ID of 10001: .Bl -tag -width indent .It Li uid=10001>uid=10002 -Allows the process to switch any of its real, effective or saved user ID to +Allows the process to switch all of its real, effective or saved user ID to 10002, but keeping the groups it is already in, and with the same primary/supplementary groups split. .It Li uid=10001>uid=10002,uid=10003 Same as the first example, but also allows to switch to UID 10003 instead of -10002. +10002, or possibly having both in different user IDs. .It Li uid=10001>uid=10002,gid=10002 Same as the first example, but the new primary groups must be set to 10002 and no supplementary groups should be set. @@ -387,7 +387,7 @@ group, allowing its members to switch to root without password. .It Li gid=10001>gid=10002 Allows the process to enter GID 10002 as a primary group, but only if giving up all its supplementary groups. -.It Li security.mac.do.rules=gid=10001>gid=10002,+gid=.\& +.It Li gid=10001>gid=10002,+gid=.\& Same as the previous example, but allows to retain any current supplementary groups. .It Li gid=10001>gid=10002,!gid=.\& From nobody Mon Jun 16 20:24:43 2025 X-Original-To: dev-commits-src-branches@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 4bLhLh0Z3bz5yMrZ; Mon, 16 Jun 2025 20:24:44 +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 4bLhLg1c9Fz3JXF; Mon, 16 Jun 2025 20:24:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750105483; 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=YvbZjHAvPQ6NnYvXWpCagIO/wxp4F4TowFho78qENV0=; b=HaD4mISt1GxLP8mYXZc5Zra4nwgco4BSwZ/pXRAdAv4VJFKhuNX8RTq2+c5wsN6uUUYs1q xpMI1rhvHveI0Ad1w+RoaaXgjPeLY6yMSGjpBqyZFfynC7LgfFhyjClNm0OWAgsHVXYasP ezXZuPx8BMeDY+DnUBY070OY3uU8Mrrm2lLMFSK7zmhz1j+aYjrNB8ttJeJmmrKvQk1f+S 788X35N1EVp47Obj0EGxrVziMuh3NK/CQJ4JOgaQtI6stx4Z0HpfOfC4YCPyZTfZOqj3xb JVYReg3a1gtpl1Hgp0CrKJYT57nwUjSta5ueRMWUNl+j+j54TD148B8Vuk6HFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750105483; 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=YvbZjHAvPQ6NnYvXWpCagIO/wxp4F4TowFho78qENV0=; b=H1IZQLamiABwf4ABra6x/ioFvQNjLxxopbeHANE1jj903r8YTIZUT4uPfgKisc2HMspQGk BezOhllT1+87b81EPa4Ee37Ss/eCSf5AeUYhrm6B7AFmxVbtkl2B1jo/8JQI7mzWHOf7Tv t3XroJr+5qNpxgvnmY19moS1tnqw0uVpKm/eRuOhZSKhnEQEwd8NouMipkPUX5kdqPevGm badwLS2TuQh0o5z2f2c/L+/FEzjOaG0L8QqDPnr3Ufe+w8Rmf2sg36zSXz6g77Y8vlZjbl 6bsIs6Qe5UG75c3JTfiufGRnm1FYUK3hJQG2FcpwYmtnoM1e/rgCZtAxicOU7Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750105483; a=rsa-sha256; cv=none; b=KmBsh2hOP2v+XZoOUXShWZBgWL3E4AVfndQCRbQybvGPAcP6ibj+tsaiBwZbUlpO0w+d/D AIi9jEogjdqUo0n0s+aM8SXQ3VIKweNIaNPyo0uYs9cwolCQ1LNOdZ7LiaxvBuJqgzz2iI JeGXPMtVKBYcmhUC5uDvR0F3dh+/0P+CGwapoiO/WpRJVFPCUIrhobpEmedwmXBRghuISO uKRlrrqgglVoE6NBnUACZ6Dk7cUlEGSiqDF2YY73I0DX1cJ8llnFleaXh+zfvbVo5xG4CM V1Lyh7cWYgd/kSOEq3XGJ9DyuX171RjWUJACC6iq7EHIPTJoJ6QaL3cWvCwLHg== 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 4bLhLg0zF6z1Byl; Mon, 16 Jun 2025 20:24:43 +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 55GKOhvc040273; Mon, 16 Jun 2025 20:24:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55GKOh5c040270; Mon, 16 Jun 2025 20:24:43 GMT (envelope-from git) Date: Mon, 16 Jun 2025 20:24:43 GMT Message-Id: <202506162024.55GKOh5c040270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 9e185ae1d4b5 - stable/14 - mac_do(4): Bump .Dd to reflect latest update List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 9e185ae1d4b5c589b2cf8d940eb775520bc945ee Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=9e185ae1d4b5c589b2cf8d940eb775520bc945ee commit 9e185ae1d4b5c589b2cf8d940eb775520bc945ee Author: Olivier Certner AuthorDate: 2025-06-13 18:06:24 +0000 Commit: Olivier Certner CommitDate: 2025-06-16 20:08:59 +0000 mac_do(4): Bump .Dd to reflect latest update MFC with: 94828b338033 ("mac_do(4): Examples: Fix some descriptions and a typo") Sponsored by: The FreeBSD Foundation (cherry picked from commit 7747d826573a38e6caa06619f5596b792dc5a976) Event: Kitchener-Waterloo Hackathon 202506 --- share/man/man4/mac_do.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/mac_do.4 b/share/man/man4/mac_do.4 index f64eae600436..fb165dfe5a1a 100644 --- a/share/man/man4/mac_do.4 +++ b/share/man/man4/mac_do.4 @@ -8,7 +8,7 @@ .\" at Kumacom SARL under sponsorship from the FreeBSD .\" Foundation. .\" -.Dd December 19, 2024 +.Dd June 11, 2025 .Dt MAC_DO 4 .Os .Sh NAME From nobody Mon Jun 16 20:24:44 2025 X-Original-To: dev-commits-src-branches@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 4bLhLh42Qlz5yMmG; Mon, 16 Jun 2025 20:24:44 +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 4bLhLh2QlLz3JjL; Mon, 16 Jun 2025 20:24:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750105484; 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=uw0lHvG8ZSR0WdSfAax7AKsIedykbUi5UxjbW4rQAuU=; b=WH8b6FY2d387XEXob3D5cnvbpSTpOgPzpdq3XzSdf4F9qwJXc3fxIRbbDwJK5c0/c+d7EP i5scGBAlca7Ri7qVQ1Q3JJyJIfh79xJ8c/34UQ6C/FR7gEvOhWGIomNVsx0JURxHjgnT4R XQWmYfbj6KvVsGvxcmmlLiyKONoMR7EFKwoTxc1sG5QagCzyVNzoI7+yanlyo7PpUevkhB MQSlTBb5MQtqJON9buBhg8W8m771BQyNsdrMCoJOB0Uu+gBY54SKQe2pim1UOnl1eMnwXy hOFUOSJP2IcIlyJTEllLQC55JqYt+nOk5piejdAMPhcyjGrpvMgFA9oGBDDB0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750105484; 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=uw0lHvG8ZSR0WdSfAax7AKsIedykbUi5UxjbW4rQAuU=; b=Elkw7QjNawmglMPbYfmUgx5gLoun0yzOj0EpcrxkPfKJqrrj5Zu9lnKKpE4Sig1OItj14r NgoN1c9yrYX8SiYqywGriGjjfpI9PK+VG6DaCbPCJ81aUMBIOhZbpWtIyTYQGOpX/s0m8G KBWRYF70NcZvJTU+Q/xtQkOKqncbktrKc4iK64oR1yn4gIUIOeVw0YoFC/81/cIqnzYZ+g YTQXs1wDsQweKn/G/uZMFePnT3cR27uxLjhfB83s2tEX5Rp4cOXjD+dqrg/QhcpjgiLEiv 9CmPUVaw5jKtlc7TRajumAX5BBjJgf/vjZTPC+pVFUpnjc2jfxGxXYlxfya6Cw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750105484; a=rsa-sha256; cv=none; b=pnheWuSlp0m1WtuVGCxQyuYUba9V5SqdX+SE+bkQQ++AARP2WiRVm+lbmukjR4HH8ywQAr HoiHu7XdVVEboRVCpW4+tAK6jCcGi1FH9lcu1Jllgu++tgbI/Ko8k5cKLPqkap9C0/36C3 dsX/sQyx96UNcB6n8cyc3iFewfL0MMVjpYOD/0bI36ASCdCkgW23M+1m9cglLBqVvEmjud 8aLc+nQXnGGhyQrVl+kNXBFbKUfpp+9PvtJu1Tlsqt0Q6YdB3gJlqgEjg3+Yiuvr/kGC+m UKoAtGPZIvg3S5FX+aZaniZ/uzS8CGVWare5spEL5gMQzjg8f849VO/hyK2yYw== 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 4bLhLh1vfwz1BZv; Mon, 16 Jun 2025 20:24:44 +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 55GKOiYu040312; Mon, 16 Jun 2025 20:24:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55GKOiZh040309; Mon, 16 Jun 2025 20:24:44 GMT (envelope-from git) Date: Mon, 16 Jun 2025 20:24:44 GMT Message-Id: <202506162024.55GKOiZh040309@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: bb5a2106555d - stable/14 - config.5: Document CONF_CFLAGS under 'makeoptions' List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bb5a2106555d810bb6a5ec0a80584abf8154cfbd Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=bb5a2106555d810bb6a5ec0a80584abf8154cfbd commit bb5a2106555d810bb6a5ec0a80584abf8154cfbd Author: Olivier Certner AuthorDate: 2025-05-27 07:41:19 +0000 Commit: Olivier Certner CommitDate: 2025-06-16 20:09:06 +0000 config.5: Document CONF_CFLAGS under 'makeoptions' This variable serves to tweak CFLAGS from the kernel configuration file, easing some custom kernel builds. It was introduced by bde@ in 1999. The description has been kept simple on purpose. It does not completely reflect reality as the build infrastructure actually appends variables to CFLAGS after CONF_CFLAGS has been processed in a few cases. However, these cases do not collide with expected common uses of CONF_CFLAGS, so have not been mentioned. Reviewed by: markj (older version) MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50544 (cherry picked from commit 1bdf1b8186359d4ea26e26de03e03b7c1543b707) Event: Kitchener-Waterloo Hackathon 202506 --- usr.sbin/config/config.5 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5 index f77b79a31510..a04ecd4ac0fe 100644 --- a/usr.sbin/config/config.5 +++ b/usr.sbin/config/config.5 @@ -307,11 +307,28 @@ variable is specified, .Ar value is assumed to be the empty string. .Pp +Note that, as the common makefiles overwrite the +.Va CFLAGS +variable after having processed the configuration file, +customizing +.Va CFLAGS +directly via +.Ic makeoptions +is not possible. +Nonetheless, custom compiler flags can be specified using the +.Va CONF_CFLAGS +variable instead. +Its content is appended to +.Va CFLAGS +after the common makefiles have set the latter, allowing to override their +compilation flags. +.Pp Example: .Bd -literal -offset indent -compact makeoptions MYMAKEOPTION="foo" makeoptions MYMAKEOPTION+="bar" makeoptions MYNULLMAKEOPTION +makeoptions CONF_CFLAGS+="-DSOME_CONTROLLING_MACRO" .Ed .\" -------- MAXUSERS -------- .Pp From nobody Mon Jun 16 20:24:45 2025 X-Original-To: dev-commits-src-branches@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 4bLhLk1nsVz5yMZm; Mon, 16 Jun 2025 20:24:46 +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 4bLhLj3SWHz3JPV; Mon, 16 Jun 2025 20:24:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750105485; 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=eHl/DrjMQ1KGbA/7jw4DWYBeZLdtN1G9+aFussv/Np4=; b=IHBcTIV90rgrTp840sCtBKTR3MvJErE90ZOdojPQpLl5o4AJQ6GKDlVsazd2M0vH1VvVx+ FmJyrOVcHPKFbLC15Pe6fa2NlOudMpm4MC3g6bqRFVIzB22UU30R6j/PQ/HvF7R/4aZVRL zNpoXXMJbF7SztKPHoxCONuxVXh7TyPDZThjoY6ugKdsbgPvsTyOrBuPUo2OzB24vvRw+v ofskEEkxjzxqY/iRv7hA6OtYNV7VQwEEfy80iuj2FNtVuAyCib74I814kPQ/li+xgO8Jbi NkN8eH8S5hapEfFcan/caT6gVHG2V2FEK4Kkn+H+pPOOaOiX2OmNSk7L5ItCRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750105485; 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=eHl/DrjMQ1KGbA/7jw4DWYBeZLdtN1G9+aFussv/Np4=; b=HOCHWaHMVpsMCMXJbFOJiWetZM25mSskmHhKQ3WEmLt58Fy55UjPfp3L6OAQxaSeGY3JD1 O7TlVnl4yWm5t9oDfcP0u0qV/4epnCkcKN1eNEzMP8L6Hn6yEAsoQdCr7YnOdoBgG4mUNB HCDO8Ba31IN7gBOja6PYH3hn5XlI67SrR6PqCYK3SCfVtJy/zSgxvGCohSUALf7eZlZWfT 7yN7e7ksA2gsfDCAol2MRfXm/ehhdm12jTdkN0aGqimyLlFEXClwtSoXCtk7H7deptp9cv 7eGnE9v0XbSelK9V46U7H+796kjHw5PFGWmVXO8MoATkhTspSb2eOVC6EiDPng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750105485; a=rsa-sha256; cv=none; b=doOgkqMQYNkgBzKeloZIri0mvwtbKNWYq/t2/gvujCpUeYV545/3hCkwdOAxIAOJnzVt8h tpBAAe5op/yogyc5/wQ3G7hFf9mYnyHjvsjEPT/yxtcTqfujAfyNJPqwN7q+Uo1AeTivuG wx8RQaxLvIC3s8XdjDwoyScdA3Be/2w2gnCqjCMAvsqcuDufILSHcufej+Fz1/UmrhXPoZ TYhwKHWs6K/pHckgfF5Q8aX/GJjO1clYOV4gmoZnZ1MnLTvkUATLNSJk/V7O81kpcO3EKL kpJz26dAeQyCCYZ05DOq3EVF8lECkLkgTbaIIF86G0idheXKvGGB7sIRY/nH1Q== 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 4bLhLj2rylz1C51; Mon, 16 Jun 2025 20:24:45 +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 55GKOjSq040346; Mon, 16 Jun 2025 20:24:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55GKOjcw040343; Mon, 16 Jun 2025 20:24:45 GMT (envelope-from git) Date: Mon, 16 Jun 2025 20:24:45 GMT Message-Id: <202506162024.55GKOjcw040343@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 14fc13501409 - stable/14 - config.5: Bump .Dd to reflect latest update List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 14fc135014091e3df222f3276cfba1412b17c208 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=14fc135014091e3df222f3276cfba1412b17c208 commit 14fc135014091e3df222f3276cfba1412b17c208 Author: Olivier Certner AuthorDate: 2025-06-16 18:56:33 +0000 Commit: Olivier Certner CommitDate: 2025-06-16 20:13:17 +0000 config.5: Bump .Dd to reflect latest update MFC with: 1bdf1b818635 ("config.5: Document CONF_CFLAGS under 'makeoptions'") Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation (cherry picked from commit 956100d60fa86daebc1bd46ea62f207f6b54d93d) Fixed the "MFC with" tag (which is wrong in main). Event: Kitchener-Waterloo Hackathon 202506 --- usr.sbin/config/config.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5 index a04ecd4ac0fe..11832c55be94 100644 --- a/usr.sbin/config/config.5 +++ b/usr.sbin/config/config.5 @@ -21,7 +21,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 17, 2022 +.Dd June 13, 2025 .Dt CONFIG 5 .Os .Sh NAME From nobody Mon Jun 16 23:46:05 2025 X-Original-To: dev-commits-src-branches@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 4bLmq170WJz5Vd0Y; Mon, 16 Jun 2025 23:46:05 +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 4bLmq11shPz41jF; Mon, 16 Jun 2025 23:46:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750117565; 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=DOGW6It/aG0evghIKZO9HSvSvRNBt36rblBk4eOJr3E=; b=LpdRbOm6MdqrtTiSpUbq5sRYHF+0a56urQhbG8aiIk1EAm7x8QKNlYIgkGggYnma7sNrFs qKjoL5076dyvi4Obnd8visM9/UWFV6AwXXas445D/+LYKcUSUjQHOdzRkPrGuoQ+pcRBzN +05Ofz2jG3AQy5QF4euaV8oYcz0WVFfTsRSAisS3ukEmTtXbT1iZ3izk2zyb99c2sXen/V GpsSYXdjAXWbQSo0WjcuqmiwbQEfmvx8vFVogbU6R6pPQPa6ggDJKn/c/KG6rWVVxSX+A4 io9V8CB6kEUL/thPcBKGqAX4cmONKeSPkWfWQ6bnUrD/sMF7CF9/M9SqGjvNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750117565; 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=DOGW6It/aG0evghIKZO9HSvSvRNBt36rblBk4eOJr3E=; b=WKfk7UZ2KgxJ/11rT6zkqZ7nf682JNE5H90/VUhYeKCwQQQmolv7vVZtLliclNghbXOJDf n2G9BmCU2AD18GejOh5SvGKrtQ+H2EBaCJVhgunmlmkCZBOTnLVyMpvCZYYpCtnc9XoDKg tZX/7KC3jmGO7DwSCa1DQdzaW6rZUtStDLZPuFbnu5Otjh9jMDrfnw7S0MG4BqBoKE0Jwh sYmpN/WSqJjtFzTOIjJz9sL3gZ1CBG8iu9iLpqMUMcqkNLJxDQgq62QIfRuCiLNcVuAF77 sbnLZNZSnBHPrb73Aey8Y1tEvSsKIh3Rdo3+j4iLOzve+rOT9fWpCAb1oALCJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750117565; a=rsa-sha256; cv=none; b=GTuQHfJckPsMZkc5N+vs0fVbNrWQIPo9i9uXiKuO7Q3Anxvh6DlTARHOcwDdoBj8gGoNaZ oS+hKrHfjmtxVqO+coLvPHcMIjGO0zLfRZu3ta7ysKDyaxOW3Uy6+DeGeUbQPmfxl33MRu CUOWTprHyppVg420+xpYsO1Jyc9L6K0gh+M8EbvOdspCLUABQJ1uwe69MwlQ3nc/b2s426 8Jt+6aNy0nRcGViusBWluVW+KeBH9heMgrUF3ET0hDRfog36BBpGOHnoXJe2v59aCEQTgl NYT7PNxxklIMKJzxz0mbT4cbW5V1yIRrjvz9Qmu9beVf7r0TQvtdG5HvNDz+RQ== 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 4bLmq10rQ7z3rZ; Mon, 16 Jun 2025 23:46:05 +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 55GNk5NM017165; Mon, 16 Jun 2025 23:46:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55GNk5qf017162; Mon, 16 Jun 2025 23:46:05 GMT (envelope-from git) Date: Mon, 16 Jun 2025 23:46:05 GMT Message-Id: <202506162346.55GNk5qf017162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ahmad Khalifa Subject: git: 0e8890a425bc - stable/14 - Add a new sysctl in order to diffrentiate UEFI architectures List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vexeduxr X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 0e8890a425bc778d323566c881e26bad7c54baf2 Auto-Submitted: auto-generated The branch stable/14 has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=0e8890a425bc778d323566c881e26bad7c54baf2 commit 0e8890a425bc778d323566c881e26bad7c54baf2 Author: Ahmad Khalifa AuthorDate: 2024-06-03 01:40:43 +0000 Commit: Ahmad Khalifa CommitDate: 2025-06-16 23:07:25 +0000 Add a new sysctl in order to diffrentiate UEFI architectures With the new 32-bit UEFI loader, it's convenient to have a sysctl to figure out how we booted. Can be accessed at machdep.efi_arch Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1098 (cherry picked from commit b538d4911004ca541507166b8ec9689d2e87d1aa) Approved by: imp (mentor) --- stand/efi/loader/bootinfo.c | 8 +++++++- sys/amd64/amd64/machdep.c | 21 +++++++++++++++++++++ sys/x86/include/metadata.h | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index 5afb4c78353e..2961b8b97fb7 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -447,9 +447,15 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) module = *modulep; file_addmetadata(kfp, MODINFOMD_MODULEP, sizeof(module), &module); #endif -#if defined(EFI) && !defined(__i386__) +#ifdef EFI +#ifndef __i386__ file_addmetadata(kfp, MODINFOMD_FW_HANDLE, sizeof(ST), &ST); #endif +#if defined(__amd64__) || defined(__i386__) + file_addmetadata(kfp, MODINFOMD_EFI_ARCH, sizeof(MACHINE_ARCH), + MACHINE_ARCH); +#endif +#endif #ifdef LOADER_GELI_SUPPORT geli_export_key_metadata(kfp); #endif diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index e4109b0ff791..70a7aa677c9f 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1691,6 +1691,27 @@ SYSCTL_PROC(_machdep, OID_AUTO, efi_map, efi_map_sysctl_handler, "S,efi_map_header", "Raw EFI Memory Map"); +static int +efi_arch_sysctl_handler(SYSCTL_HANDLER_ARGS) +{ + char *arch; + caddr_t kmdp; + + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + + arch = (char *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_EFI_ARCH); + if (arch == NULL) + return (0); + + return (SYSCTL_OUT_STR(req, arch)); +} +SYSCTL_PROC(_machdep, OID_AUTO, efi_arch, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + efi_arch_sysctl_handler, "A", "EFI Firmware Architecture"); + void spinlock_enter(void) { diff --git a/sys/x86/include/metadata.h b/sys/x86/include/metadata.h index dbc6d3275e53..b3eb4b16c1ba 100644 --- a/sys/x86/include/metadata.h +++ b/sys/x86/include/metadata.h @@ -34,6 +34,7 @@ #define MODINFOMD_EFI_FB 0x1005 #define MODINFOMD_MODULEP 0x1006 #define MODINFOMD_VBE_FB 0x1007 +#define MODINFOMD_EFI_ARCH 0x1008 struct efi_map_header { uint64_t memory_size;