From nobody Tue Oct 13 23:59:39 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j4BCP2nmmz6w6gn for ; Tue, 13 Oct 2026 23:59:45 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j4BCP17Pyz4qHn for ; Tue, 13 Oct 2026 23:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791935985; 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=0ix7Po3nFZJnccsV32yDRVQOErNIIuNdAhKQZdIrC6M=; b=SkSgoex1t0shun//9lQ9RKza3gTSJISJIri0vxYpwC9tmeMzfWv0Rk1aXutoNKOe/yIY9b eBfPMd0AyKCvwRoUaygc0mT+rIq2sGsGyDTgDMieMjxubwGvwhJOM+BKrV4e8tMWA7bw+Q LHeomB63UE2xJ3U4nPHIiLuFKZOsEDvkONtbqkGO6DJEVyI/lNeFpoQuVxe1uU2RY1Q9XE pPKDFFNdathbD0I6EFPFB0/aYpvtZzdXVbTzBCBf0Z26ho2c/XERzpIN/Pg9Sq1F4m/RUU 6aA4HYnTQYcY/1ffoxSyB5usunbuLqbPVdL0hArYJHeEH9uGz/ts87OQg5w3Yg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791935985; b=DLwPUiIK250ulQ6kgip+d0xtafy3gG4rTZ/I+4IM+lkJa/N3lKXc3QjWdU4mcDFDjxJks4 dhVI8U9/0DFcRhS98ZutQatXtpj4Cw8H8Xpx8rkNHLPGGmMSDPJjZPBZUjCrhUpLhEwA07 ZOIa7rp31f3KrHNHzOd0KhKY9yeEqb0ps90mcobJpd4fz486tXLytrOVeIDCf6xzfF2VyX F9xmJnh47z95fuoUQfPTZeRdYJq+PNjnbNSTA3wr2eAAUHOM2dt7ycsYsPgynUI+0Q/ehp Nwm71CwsfB+rHR0YNY9qFVlsX03r0ELluCf1VaSTwTeGPuVspcAf95Ucd9FXiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791935985; 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=0ix7Po3nFZJnccsV32yDRVQOErNIIuNdAhKQZdIrC6M=; b=X4+z80HawnmaBcJ3xJYZ4Y9rrqRPp6Mc7a/+xI5WRfHeFVMXEXbya/jMThuM8GAMwFt3qh UzySzVyiDjjgKWcWsVXcbMKTcWRnNGNMfniTicrEYsSP2kz8ad2BlEFFuSCUQP/RxFek1p s57qK0y7wUeeIQdtGnlwQSgV6cutP9bRd3q9CscjE7jbxX61oG6mhwwa4NrXLz0rxFIPhf X7CeZw/53PQTJTSDmTydToxDNCh4lwndUPTXuwD/XUQ+sUsezsO+6tgmzTVCS3u4HqROf1 9lbIgb46ndg1Ab8q+IWCmjTeL0yfy5C9GevElpcHaJzOJLoJC5AyCGJFCXkorg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j4BCP0CD2zf8D for ; Tue, 13 Oct 2026 23:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 35d6a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 13 Oct 2026 23:59:39 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Simon J. Gerraty Subject: git: 34e92fb6bd8d - main - hooks.sh allow running DebugO{n,ff} from hooks_run List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 34e92fb6bd8da6569c90ae9ee79c9a01890b8a6b Auto-Submitted: auto-generated Date: Tue, 13 Oct 2026 23:59:39 +0000 Message-Id: <6acec5eb.35d6a.701893f4@gitrepo.freebsd.org> The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=34e92fb6bd8da6569c90ae9ee79c9a01890b8a6b commit 34e92fb6bd8da6569c90ae9ee79c9a01890b8a6b Author: Simon J. Gerraty AuthorDate: 2026-10-13 23:59:32 +0000 Commit: Simon J. Gerraty CommitDate: 2026-10-13 23:59:32 +0000 hooks.sh allow running DebugO{n,ff} from hooks_run We need to watch out for _debugO{n,ff}_hooks. Also add add_list (hook lists are just lists). Fix bug in hooks_has() - should look for $2 in list. --- libexec/rc/hooks.sh | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/libexec/rc/hooks.sh b/libexec/rc/hooks.sh index 0c577d831101..7c2aa62f80a0 100755 --- a/libexec/rc/hooks.sh +++ b/libexec/rc/hooks.sh @@ -16,6 +16,9 @@ # run_hooks HOOKS [LIFO] ["args"] # run_hooks_all HOOKS [LIFO] ["args"] # +# add_list LIST [options] item [...] +# add_list_once LIST [options] item [...] +# # DESCRIPTION: # The functions add_hooks and run_hooks are retained for # backwards compatibility. They are aliases for hooks_add and @@ -46,11 +49,14 @@ # calls to hooks_add. # Any "args" specified are passed to each hook function. # +# add_list is just another alias for hooks_add, same for +# add_list_once. +# # RCSid: -# $Id: hooks.sh,v 1.26 2025/08/07 21:59:54 sjg Exp $ +# $Id: hooks.sh,v 1.31 2026/10/13 23:52:51 sjg Exp $ # -# @(#)Copyright (c) 2000-2024 Simon J. Gerraty +# @(#)Copyright (c) 2000-2026 Simon J. Gerraty # # SPDX-License-Identifier: BSD-2-Clause # @@ -74,6 +80,11 @@ fi # for backwards compatibility local=$_local +if test -z "$_DEBUG_SH"; then + DEBUG_DO=: + DebugOn() { return 0; } + DebugOff() { return 0; } +fi ## # hooks_add_all list func ... @@ -179,7 +190,7 @@ hooks_has() { eval $_local __h eval "__h=\$$1" case " $__h " in - *" $1 "*) return 0;; + *" $2 "*) return 0;; esac return 1 } @@ -197,6 +208,7 @@ hooks_run() { while : do + : "1=$1" case "$1" in --all) __a=:; shift;; --lifo) __l=$1; shift;; @@ -204,14 +216,23 @@ hooks_run() { esac done __hl=$1; shift + case "$__hl" in + *_debugOn_hooks|*_debugOff_hooks) ;; + *) DebugOn hooks_run hooks_run:$__hl;; + esac case "$1" in LIFO) __l=--lifo; shift;; esac __h=`hooks_get $__l $__hl` for e in $__h do + $DEBUG_DO echo hooks_run:$__hl:$e >&2 $e "$@" || $__a $? done + case "$__hl" in + *_debugOn_hooks|*_debugOff_hooks) ;; + *) DebugOff hooks_run hooks_run:$__hl;; + esac } ## @@ -238,6 +259,14 @@ run_hooks_all() { hooks_run --all "$@" } +# hook lists are just lists +add_list() { + hooks_add "$@" +} + +add_list_once() { + hooks_add_once "$@" +} case /$0 in */hooks.sh)