From nobody Wed Nov 25 21:51:26 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 4jZYKV4wB5z72HHd for ; Wed, 25 Nov 2026 21:51:26 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jZYKV2hBSz4lPX for ; Wed, 25 Nov 2026 21:51:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795643486; 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=XaE6R+ybxpzmawltfqXUrNvD1+T6Do2XDaR5hRvpOag=; b=etgHXzmwixcHOePg1BuzGBD8jKYC09B49a5K9jC2ivm59S3o0oq3aqONXDZ+CHve5KgBd7 7HkAnqb+FK7t3AaR6T8SSgJ/VtjQUNS3BGOiTt8qD+Y92+/EuVcrH/57KCh8L9E6DrNwX8 mII5o9QyX4Repjziqx85YERSfBUsrPGuwR76vicPjM2kXEP/3uhI3L5IVJQVt1hjVBjF5Z u5yeAsBePBFVBebIMWZnvzF6CbKB734QQD29nt5zRbPSJ1idcLrhddD6liD2MxAKZRojgg y5F/m9g7fXHhgvHWV+X6u4sRYPz0m7kHMj5S+HRZNgZc56o3+8ZFayWFcEjKGw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795643486; b=LxNVYGiCEi3sbhBiKyWVyS00TUQuVbQ/xyx0TCCyE+PpXgS4HFy0ISQA/bjk8/rrmekBQj +wEpfr7367FVHkvO2kzaRTmtsk+3XD2NmutAi1TN8xQIVm+4vmwL/8FjS32qONGGd3k+Zp EBxYwq2F++MjcBw5QgfSa/DXFF5W+VJEtEpGzjqDwU17Rk9eY0RxuxXYn2BiumQvMBaisS gt2v0t9KUOek9S7Pboek8XBj/Kpq0/gqQf1GRN1Pbk5WkbIPjqoWnNT4udsf23gfEAoWoY 9hL+i9i7yg+TBZyFsRMpxARH/Iz3zzLmTyWB2kg9ab2qEtdDYjNKktSEAtLScg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795643486; 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=XaE6R+ybxpzmawltfqXUrNvD1+T6Do2XDaR5hRvpOag=; b=OTJBZEtBqbVCq9oRno+ebPZ3kLYxZl5b1q3HHKJGnDYSRmBnp4wZfU0DYXjhaDGsVL3MWc RrFz7r3AkuR8SafuFR9cvcFmTlrmwveG4bLyyRHZE5gUmkbw6/pMcd8QKn7+KHdTfIZwgS IYkqH2HrQNdC/rFXtOJ35HBdnP7RxP70txFoVX7Tg/bYCdtC7VCSrCY4qVubQlgKh5Uuc3 8znxtuBlFTeesMrxNP0h6EjPnrzE6PYc+aMVcbQ+CEwbcuEcHOPCGxrVhtHkcbzXMcy5cH qQB0So1WGX4t6qt1ZpWARoeMq9afqncr71kFcswBNDilUc4/B9VrpdY44Jqg8g== 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 4jZYKV1yZmzlFs for ; Wed, 25 Nov 2026 21:51:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 14c10 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 25 Nov 2026 21:51:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Devin Teske Subject: git: 9ae40a268c8b - main - sysrc: Add more sanity checks List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: 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: dteske X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9ae40a268c8bbbdc527dfe46282d9f8ebca36e26 Auto-Submitted: auto-generated Date: Wed, 25 Nov 2026 21:51:26 +0000 Message-Id: <6b07585e.14c10.27f2956c@gitrepo.freebsd.org> The branch main has been updated by dteske: URL: https://cgit.FreeBSD.org/src/commit/?id=9ae40a268c8bbbdc527dfe46282d9f8ebca36e26 commit 9ae40a268c8bbbdc527dfe46282d9f8ebca36e26 Author: Devin Teske AuthorDate: 2026-11-25 21:45:47 +0000 Commit: Devin Teske CommitDate: 2026-11-25 21:47:37 +0000 sysrc: Add more sanity checks Potentially a breaking change for some folks. MFC discouraged. This aligns sysrc with the same sanity checks performed by sysconf. It reduces the chance of POLA violations when people use `sysconf rc' (where sysrc is hooked into sysconf as the rc target provider). However, some shell scripts calling out to sysrc may have relied on some of the leniency that is now cause for exit. For example, using `-x' with assignments (such as `sysrc -x foo=bar' which now generates the error `-x does not take a value' -- the same error produced when you try `sysconf loader -x foo=bar'). Reviewed by: kfv Differential Revision: https://reviews.freebsd.org/D61735 --- usr.sbin/sysrc/sysrc | 48 ++++++++++++++++++++++++++++++++++-------------- usr.sbin/sysrc/sysrc.8 | 2 +- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc index b1814948330d..617aff16d9ed 100644 --- a/usr.sbin/sysrc/sysrc +++ b/usr.sbin/sysrc/sysrc @@ -16,7 +16,7 @@ pgm="${0##*/}" # Program basename # # Version information # -SYSRC_VERSION="8.6 Nov-18,2026" +SYSRC_VERSION="8.7 Nov-18,2026" # # Options @@ -123,9 +123,7 @@ help() f_err "$optfmt" "-i" \ "Ignore unknown variables." f_err "$optfmt" "-j jail" \ - "The jid or name of the jail to operate within (overrides" - f_err "$optfmt" "" \ - "\`-R dir'; requires jexec(8))." + "The jid or name of the jail to operate within." f_err "$optfmt" "-L" \ "List all configuration files including rc.conf.d entries." f_err "$optfmt" "-l" \ @@ -265,6 +263,30 @@ while getopts AacDdEeFf:hij:LlNnqR:rs:vXx flag; do done shift $(( $OPTIND - 1 )) +# +# Sanity checks +# +if [ "$SHOW_ALL" ]; then + [ $# -eq 0 ] || usage "-a/-A do not take names" # NOTREACHED +fi +if [ "$DESCRIBE" ]; then + if [ "$CHECK_ONLY$DELETE$LIST_CONFS$LIST_SERVICE_CONFS$RAW" ]; then + if [ "$DELETE" = "2" ]; then + # NB: Do not advertise secret `-X' unless it was used + usage "-d cannot be combined with -c/-l/-L/-r/-x/-X" + # NOTREACHED + fi + usage "-d cannot be combined with -c/-l/-L/-r/-x" # NOTREACHED + fi + for item in "$@"; do + case "$item" in + *=*) usage "-d does not take values" ;; # NOTREACHED + esac + done +fi +[ "$JAIL" -a "$ROOTDIR" ] && + usage "-j and -R are mutually exclusive" # NOTREACHED + # # Process `-L' flag # @@ -434,6 +456,14 @@ errmsg="\`-x' option incompatible with \`-a'/\`-A' options" errmsg="$errmsg (use \`-X' to override)" if [ "$DELETE" -a "$SHOW_ALL" ]; then [ "$DELETE" = "2" ] || die "$errmsg" +elif [ "$DELETE" = "2" ]; then + die "-X requires -a/-A" # NOTREACHED +elif [ "$DELETE" ]; then + for item in "$@"; do + case "$item" in + *=*) die "%s: -x does not take a value" "$item" ;; + esac + done fi # @@ -727,16 +757,6 @@ while [ $# -gt 0 ]; do fi fi - # - # If `-x' or `-X' is passed, delete the variable and ignore the - # desire to set some value - # - if [ "$DELETE" ]; then - f_sysrc_delete "$NAME" || status=$FAILURE - shift 1 - continue - fi - # # Determine both `before' value and appropriate `new' value # diff --git a/usr.sbin/sysrc/sysrc.8 b/usr.sbin/sysrc/sysrc.8 index 8a3ea74e5216..40f60c6ff077 100644 --- a/usr.sbin/sysrc/sysrc.8 +++ b/usr.sbin/sysrc/sysrc.8 @@ -123,7 +123,7 @@ The or name of the .Ar jail to operate within -.Pq overrides So Fl R Ar dir Sc ; requires Xr jexec 8 . +.Pq requires Xr jexec 8 . .It Fl L List all configuration files including rc.conf.d entries on stdout and exit. Can be combined with