From nobody Sat Feb 10 18:15:19 2024 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 4TXJmR4Gtdz5B724; Sat, 10 Feb 2024 18:15:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TXJmR3jvSz49Ny; Sat, 10 Feb 2024 18:15:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707588919; 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=6xShfFjluC/T4XgkzHSerb2FxfFJVHHoAnJxA8JTF2E=; b=N8rivg30ZBXgcDogkLRt+krqB4j0kC+hybUHWzQDuDjzSFt1wZalI5HfwcbubAkkwVp+hm /tkG+IzjGEcNzPOqiWZMpRwfAMYjYiO/5lagypA2ow2mDGEIlzHKllkRz60cwrENyzgoW0 njzl6+jTltpBT8Uyhs7GqcWZFYu3kCuSVWjeNpsFFO0Sq502QSuLFeSI4SZr5HYw17LZO9 V07nCzkcesJhc3DM/iRk8zSVOwxajHsqagaVvR34ppNXdeLO0nVO1F9Y1cYkpNCnWoPai2 XO5epzp3/6T0wu8oq3K3D7PqOpv9+vHqK9HqvZJJ+9ljhJIN7/5+0PO1DvO2AA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707588919; a=rsa-sha256; cv=none; b=hCExADoK7rwAfu2cJn81019qOMFKglmw9WMLaSc5ejwwhyZFIxobzlYiTo3Wdky0CbuC17 eEmu1vEFAPY7tpX1P97U7GM978TOFdIVv++KYtCXErcNmbqSpzixp4gn2+W0YePfZGBr9v fcAyTr/8J+VCtJrZktuOely5Ho9/8cWgwSiQREPS2x+Wt+CU2WUU0F2ilXF6z0yXMezqf2 z78nqu2Hd1MYOpgFHRZPVA7ECcvLPTp0ZxdBHln09Gc8u6TdZsd/28jI3IzUDWwhxm3ozi dBUKbigaQjzG8+BAmylT47dkrtHgAPs+WXzlACMt7rQu3Pa+gVXznYZ+eiWHvQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707588919; 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=6xShfFjluC/T4XgkzHSerb2FxfFJVHHoAnJxA8JTF2E=; b=QsdWwCc55Zkh4Esjr+jzTxqom5p/LXgr1W5aj2iTHDPFRAxAyzfImtHjoqrevsRb0+Db0O XDqF9/Sixgqww8wddZ4LCRCeOqT4aTNAOLsL7on/5jG4dMXaisOSPe1GCjZfzpJSdURuKX K/ZEZckWGyMD6oOq6YwTIiF33FI3doESaVLQYtVbP2ynMmYsRgYhU38Mqxm3JZlIYPJpY6 u8K1knBQK/sBmIKL0hEemGi/ZTABm+LfFMcTYPhOI/w18HDdGxMFsFW0ENZQT6P6Jcq1Ci ywIc9l+6Up1YTRB4kzRVupVGb8oyDOH+QwM61faZfiI7bJKF7jczCnWq58fHdQ== 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 4TXJmR2mGczRGb; Sat, 10 Feb 2024 18:15:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41AIFJ7I017591; Sat, 10 Feb 2024 18:15:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41AIFJKu017588; Sat, 10 Feb 2024 18:15:19 GMT (envelope-from git) Date: Sat, 10 Feb 2024 18:15:19 GMT Message-Id: <202402101815.41AIFJKu017588@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: 15483f96207d - main - rc.subr avoid noise if /usr not mounted List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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: 15483f96207de354714fc61f20cdbf971706e6cb Auto-Submitted: auto-generated The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=15483f96207de354714fc61f20cdbf971706e6cb commit 15483f96207de354714fc61f20cdbf971706e6cb Author: Simon J. Gerraty AuthorDate: 2024-02-10 18:14:23 +0000 Commit: Simon J. Gerraty CommitDate: 2024-02-10 18:14:23 +0000 rc.subr avoid noise if /usr not mounted basename, sed and tty are all in /usr/bin and not available until /usr is mounted. basename and tty we can replace with a function, but sed is more important. Fix o_verify to just use shell builtins, and rc_trace should avoid trying to set RC_LEVEL until sed is available. --- libexec/rc/rc.subr | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 19955fa83fbd..d76f0ba4f9a7 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -82,7 +82,10 @@ _VDOT_SH=: # current state of O_VERIFY o_verify() { - set -o | sed -n '/^verify/s,.*[[:space:]],,p' + case $(echo $(set -o)) in + *verify" "off*) echo off;; + *verify" "on*) echo on;; + esac } ## @@ -174,9 +177,15 @@ rc_trace() if [ -z "$RC_LEVEL" ]; then [ -f $cf ] || return - [ -s $cf ] && \ - RC_LEVEL=$(sed -n '/^RC_LEVEL=/ { s/.*=//p;q; }' $cf) - RC_LEVEL=${RC_LEVEL:-0} + if [ -s $cf ]; then + # don't try to set RC_LEVEL without sed + if [ -x /usr/bin/sed ]; then + RC_LEVEL=$(sed -n '/^RC_LEVEL=/ { s/.*=//p;q; }' $cf) + RC_LEVEL=${RC_LEVEL:-0} + fi + else + RC_LEVEL=0 + fi fi [ ${RC_LEVEL:-0} -ge ${level:-0} ] || return rc_log "$@" @@ -2493,8 +2502,22 @@ fi # Use vdot to ensure the file has not been tampered with. vdot /etc/local.rc.subr -# safe_eval.sh provides safe_dot - for untrusted files -$_SAFE_EVAL_SH vdot /libexec/safe_eval.sh +# Avoid noise - when we do not have /usr mounted, +# and we cannot use safe_dot without sed. +if ! have basename; then + basename() + { + local b=${1%$2} + echo ${b##*/} + } + tty() + { + return 0 + } +else + # safe_eval.sh provides safe_dot - for untrusted files + $_SAFE_EVAL_SH vdot /libexec/safe_eval.sh +fi $_DEBUG_SH vdot /libexec/debug.sh # Ensure we can still operate if debug.sh and