git: 26ac2c3189d8 - main - sysrc: Disable filename globbing on list assignment

From: Devin Teske <dteske_at_FreeBSD.org>
Date: Wed, 18 Nov 2026 16:41:56 UTC
The branch main has been updated by dteske:

URL: https://cgit.FreeBSD.org/src/commit/?id=26ac2c3189d8791084f1584532fa38734c292d48

commit 26ac2c3189d8791084f1584532fa38734c292d48
Author:     Devin Teske <dteske@FreeBSD.org>
AuthorDate: 2026-11-18 16:37:14 +0000
Commit:     Devin Teske <dteske@FreeBSD.org>
CommitDate: 2026-11-18 16:37:14 +0000

    sysrc: Disable filename globbing on list assignment
    
    This is potentially a breaking change (MFC not recommended).
    
    Assignments with += or -= should not expand filename globs.
    
    For example, executing `sysrc foo+=' *'` would result in adding to
    foo the glob expansion of `*` instead of a literal `*`.
    
    This was unexpected and inconsistent because `sysrc foo='*' would set
    foo to literal `*`.
    
    If you need the old behavior, you can do `sysrc foo+="$( echo * )"`.
    
    Reviewed by:    kfv
    Differential Revision:  https://reviews.freebsd.org/D61657
---
 usr.sbin/sysrc/sysrc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc
index 2206cb640c1c..5eae2096f8ef 100644
--- a/usr.sbin/sysrc/sysrc
+++ b/usr.sbin/sysrc/sysrc
@@ -16,7 +16,7 @@ pgm="${0##*/}" # Program basename
 #
 # Version information
 #
-SYSRC_VERSION="8.0 Nov-16,2026"
+SYSRC_VERSION="8.1 Nov-16,2026"
 
 #
 # Options
@@ -739,6 +739,7 @@ while [ $# -gt 0 ]; do
 			*) IFS="$delim"
 			esac
 			new="$before"
+			set -f # noglob
 			for a in $add; do
 				[ "$a" ] || continue
 				skip=
@@ -747,6 +748,7 @@ while [ $# -gt 0 ]; do
 				done
 				[ "$skip" ] || new="$new$delim$a"
 			done
+			set +f # glob
 			new="${new#"$delim"}" IFS="$oldIFS"
 			unset add delim oldIFS a skip b
 			[ "$SHOW_FILE" ] && before=$( f_sysrc_find "$NAME" )
@@ -761,6 +763,7 @@ while [ $# -gt 0 ]; do
 			*) IFS="$delim"
 			esac
 			new=
+			set -f # noglob
 			for b in $before; do
 				[ "$b" ] || continue
 				add=1
@@ -769,6 +772,7 @@ while [ $# -gt 0 ]; do
 				done
 				[ "$add" ] && new="$new$delim$b"
 			done
+			set +f # glob
 			new="${new#"$delim"}" IFS="$oldIFS"
 			unset remove delim oldIFS b add r
 			[ "$SHOW_FILE" ] && before=$( f_sysrc_find "$NAME" )