git: 929b2561250b - main - sysrc: Add -_*~$ as non-delimiter list operation chars

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

URL: https://cgit.FreeBSD.org/src/commit/?id=929b2561250b2f304d04e09ffaab30b1be90a578

commit 929b2561250b2f304d04e09ffaab30b1be90a578
Author:     Devin Teske <dteske@FreeBSD.org>
AuthorDate: 2026-11-18 16:37:45 +0000
Commit:     Devin Teske <dteske@FreeBSD.org>
CommitDate: 2026-11-18 16:37:45 +0000

    sysrc: Add -_*~$ as non-delimiter list operation chars
    
    This is potentially a breaking change (MFC not recommended).
    
    List operators += and -= should not consider some characters as
    delimiters when they appear as the first character.
    
    The += and -= operators allow specifying the list delimter as the
    first character. For example, `sysrc foo+=,123` will iterate over the
    value of foo delimited by commas, and if 123 is not found will append
    `,123` to the value of foo.
    
    However, for the sake of convenience, sysrc has always supported
    defaulting to using $IFS as delimiter when the first character of the
    += or -= list operator is [a-zA-Z0-9./]. For example, if you execute
    `sysrc foo+=abc` or `sysrc bar+=/tmp` or `sysrc baz-=.text` then the
    lists foo, bar, and baz are all presumed to be delimited by $IFS.
    
    By adding [-_*~$] we potentially break lists delimited by any of
    those individual characters, but we gain the ability to simplify list
    operations. This opens up the ability to execute commands such as:
    
    sysrc ldconfig_paths+='${_localbase}/lib64'
    sysrc pppoed_provider+="*"
    sysrc rtsol_flags+=-i
    sysrc foo+=_local32
    sysrc dirs+=~user
    
    Meanwhile, the comma-leading syntax is preserved as-well as colon-
    and semicolon-leading syntaxes.
    
    Reviewed by:    kfv
    Differential Revision:  https://reviews.freebsd.org/D61658
---
 usr.sbin/sysrc/sysrc   |  6 +++---
 usr.sbin/sysrc/sysrc.8 | 12 +++++++++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/sysrc/sysrc b/usr.sbin/sysrc/sysrc
index 5eae2096f8ef..54939cad0b96 100644
--- a/usr.sbin/sysrc/sysrc
+++ b/usr.sbin/sysrc/sysrc
@@ -16,7 +16,7 @@ pgm="${0##*/}" # Program basename
 #
 # Version information
 #
-SYSRC_VERSION="8.1 Nov-16,2026"
+SYSRC_VERSION="8.2 Nov-16,2026"
 
 #
 # Options
@@ -735,7 +735,7 @@ while [ $# -gt 0 ]; do
 			delim="${add%"${add#?}"}" # first character
 			oldIFS="$IFS"
 			case "$delim" in
-			""|[$IFS]|[a-zA-Z0-9./]) delim=" " ;;
+			""|[$IFS]|[-a-zA-Z0-9./_*~$]) delim=" " ;;
 			*) IFS="$delim"
 			esac
 			new="$before"
@@ -759,7 +759,7 @@ while [ $# -gt 0 ]; do
 			delim="${remove%"${remove#?}"}" # first character
 			oldIFS="$IFS"
 			case "$delim" in
-			""|[$IFS]|[a-zA-Z0-9./]) delim=" " ;;
+			""|[$IFS]|[-a-zA-Z0-9./_*~$]) delim=" " ;;
 			*) IFS="$delim"
 			esac
 			new=
diff --git a/usr.sbin/sysrc/sysrc.8 b/usr.sbin/sysrc/sysrc.8
index 2cadeb8f03ca..e0330bfd3769 100644
--- a/usr.sbin/sysrc/sysrc.8
+++ b/usr.sbin/sysrc/sysrc.8
@@ -281,8 +281,18 @@ For convenience, if the first character is alpha-numeric
 .Pq letters A-Z, a-z, or numbers 0-9 ,
 dot
 .Pq Li \&. ,
-or slash
+slash
 .Pq Li / ,
+dash
+.Pq Li - ,
+underscore
+.Pq Li _ ,
+asterisk
+.Pq Li * ,
+tilde
+.Pq Li ~ ,
+or dollar
+.Pq Li $ ,
 .Nm
 uses the default setting of whitespace as separator.
 For example, the above and below statements are equivalent since