From nobody Wed Nov 18 16:41:55 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 4jV6nb4RXdz6w637 for ; Wed, 18 Nov 2026 16:41: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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jV6nb3lSVz4VFH for ; Wed, 18 Nov 2026 16:41:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795020115; 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=NYXBMChkAW2tPdRf01E2zu5GbHELO7Q/OryZb9f13hM=; b=x18mL3VOf2ciVb5TsKLYmPImaaFk2VKFkxRBx1JcZT55e0rJba3OT+pY0tScJTykflzdG3 Fn5+59v40XLv3F2NS3K6LkmVXp4yUtHklFCu1qRM9eMGhC5zNwTw2FLh8H2XIDf2HerDB+ bZnWePXZozLtO3YDv7ST+zlfDR3dN+mmfBVj6sr5s956qsdCjuCpRVJi2L3BxTSrRvVBQT nyrOQ+t7p58681xoPXmdKF9PYpUHz49uDMpZgDNY7dCKRjq1zFbXVI6tuL7ZTSNdkSU9jv 2UTqOJhX0Wf4dc4CukG2pFRFCf+gL/Exhxe4BwSwn+zIt8nPcSysToyENQGfWg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795020115; b=hxp3ac7jcTuMMVGQcDpz8t2A5V+dEOM56kO1GuQtn7NC4yD/kGTqs8jDEQ5vxXSeogldco LSYj6iY45LYX02+AzZXIyJ0wD+28iUjAXAH1Irqu8CN8aN+Btj+14QFckmOCRHnqJv3txs 4vatJisuNt6mCChvc2lbRP4Db4lob7f6HoNZzJY9ots/XNq8ozi/ocQuhZq4wE15osfb8R TfLJjqRsjA9tq5YVr5YA8T0ppUAiPz1OOyUHKjkh3yz8pMUfK7HTgwREsYIcWeHkuX0SGd yv4O5lSTx4uPrjqigiHlKhtbq5pBRafiXf3QQ9uz/ey2SpXd1r+LKAOhCpTFBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795020115; 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=NYXBMChkAW2tPdRf01E2zu5GbHELO7Q/OryZb9f13hM=; b=XAEo15HZwN54TNotUIJC1r2KHjtCvfLc0ayAVN8nGvqxPQf12419wSPzSH3pEWcjGBk7Wa tOQAq+3UwVvbY5j0ty6emnlorqtwplWvrRYJBfk/ycTy+Bnm+A5mmXrA+h6Kpk74d8hRcZ 3R/L4P4Mrisg8vut/YUMZU14Ts3I3Q3gt8lLmZmEsiSjnayWFWAvZXPnPFc0aToE5V3x1B jwEb6pssvfBjM5W+VQsVn10zDxL5d8Ie5N3pC1VJ+fBEwunx6pYkBLxHQ99OSisnG3M4qE g1e3xI0z+LemVYSK9nUonhD+N6obIRfC8kOObHFyXhifSi+EK8Pb3WYQAuzOfA== 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 4jV6nb1vQZzLBR for ; Wed, 18 Nov 2026 16:41:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 48a9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Nov 2026 16:41:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Devin Teske Subject: git: 51435c6e7bfd - main - sysrc: Enforce raw (-r) mode for all assignments 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: 51435c6e7bfda456650ce1e5ed7302822ecda9ee Auto-Submitted: auto-generated Date: Wed, 18 Nov 2026 16:41:55 +0000 Message-Id: <6afdd553.48a9.7fcc4af8@gitrepo.freebsd.org> The branch main has been updated by dteske: URL: https://cgit.FreeBSD.org/src/commit/?id=51435c6e7bfda456650ce1e5ed7302822ecda9ee commit 51435c6e7bfda456650ce1e5ed7302822ecda9ee Author: Devin Teske AuthorDate: 2026-11-18 16:36:43 +0000 Commit: Devin Teske CommitDate: 2026-11-18 16:36:43 +0000 sysrc: Enforce raw (-r) mode for all assignments This is potentially a breaking change, warranting major version bump (7.x -> 8.0). Assignments with =, +=, or -= should not cause expansion of variables. For example, if rc.conf(5) has one="$1", two="$2", and foo="$one", and you execute `sysrc foo+=' $two'` you should get foo="$one $two" but at-present (version 7.x) sysrc stores foo="1 $two". This is because when querying current value, we read the expanded (read: not raw) value. Similary, if rc.conf has foo="$one $two" and you execute the command `sysrc foo-=' $two'` you should get foo="$one" but at-present sysrc erroneously stores foo="1 2". Since sysrc was reading the expanded value prior to modifying, it would read "1 2" prior to attempting to elide '$two' from the [space-separated] list (and since '$two' does not appear in the expanded value, no removal is performed and it subsequently wrote back the expanded value). Last but not least, for regular assignments with simple `=` the standard output message (without `-q') was misleading. Executing `sysrc cron_flags='$cron_flags -J 15'` would result in the message: `cron_flags: -> -J 15`. Worse, if you then executed the command `sysrc cron_flags="$( sysrc -nr cron_flags )"` the message would be: `cron_flags: -J 15 -> -J 15`. This is because both the before and after values queried are expanded instead of read raw. The program stores the correct value of "$cron_flags -J 15" but the message that is displayed to the user is misleading. While true that passing `-r' will correct the message in both cases, the expanded value should only be displayed when querying the value. That is to explain, that `sysrc -r cron_flags='$cron_flags -J 15'` will display correctly `cron_flags: -> $cron_flags -J 15` and the latter command of `sysrc -r cron_flags="$( sysrc -nr cron_flags )"` correctly shows `cron_flags: $cron_flags -J 15 -> $cron_flags -J 15`. Point of keeping the display of expanded values on non-assignment queries is that sysrc is supposed to show you what the boot system will see, leaving `-r' available for querying raw values. Meanwhile, all forms of assignment should instead always show the unexpanded/raw values both in the before and after statements. A mechanism forcing the display of expanded values on assignments is not given. That is behavior we want to discontinue. Reviewed by: kfv Differential Revision: https://reviews.freebsd.org/D61656 --- usr.sbin/sysrc/sysrc | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc index efbe906d9fdd..2206cb640c1c 100644 --- a/usr.sbin/sysrc/sysrc +++ b/usr.sbin/sysrc/sysrc @@ -16,7 +16,7 @@ pgm="${0##*/}" # Program basename # # Version information # -SYSRC_VERSION="7.4 Nov-14,2026" +SYSRC_VERSION="8.0 Nov-16,2026" # # Options @@ -730,11 +730,7 @@ while [ $# -gt 0 ]; do # case "$mode" in APPEND) - if [ "$CHECK_ONLY$RAW" ]; then - before=$( f_sysrc_get_raw "$NAME" ) - else - before=$( f_sysrc_get "$NAME" ) - fi + before=$( f_sysrc_get_raw "$NAME" ) add="${1#*=}" delim="${add%"${add#?}"}" # first character oldIFS="$IFS" @@ -756,11 +752,7 @@ while [ $# -gt 0 ]; do [ "$SHOW_FILE" ] && before=$( f_sysrc_find "$NAME" ) ;; REMOVE) - if [ "$CHECK_ONLY$RAW" ]; then - before=$( f_sysrc_get_raw "$NAME" ) - else - before=$( f_sysrc_get "$NAME" ) - fi + before=$( f_sysrc_get_raw "$NAME" ) remove="${1#*=}" delim="${remove%"${remove#?}"}" # first character oldIFS="$IFS" @@ -784,10 +776,8 @@ while [ $# -gt 0 ]; do *) # ASSIGN if [ "$SHOW_FILE" ]; then before=$( f_sysrc_find "$NAME" ) - elif [ "$CHECK_ONLY$RAW" ]; then - before=$( f_sysrc_get_raw "$NAME" ) else - before=$( f_sysrc_get "$NAME" ) + before=$( f_sysrc_get_raw "$NAME" ) fi new="${1#*=}" esac @@ -830,12 +820,10 @@ while [ $# -gt 0 ]; do if [ ! "$QUIET" ]; then if [ "$SHOW_FILE" ]; then after=$( f_sysrc_find "$NAME" ) - elif [ "$RAW" ]; then + else after=$( f_sysrc_get_raw "$NAME" ) - else - after=$( f_sysrc_get "$NAME" ) fi echo -n "${SHOW_NAME:+$NAME$SEP}" echo -n "$before${SHOW_EQUALS:+\" #}"