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.