Allow deferred word-splitting via f_sysrc_get() by allowing $IFS in the

"clean-room" environment used to query rc.conf(5) parameters.

This brings bsdconfig(8)'s sysrc.subr in-line with both the sysrc(8) manual
[provided by sysutils/sysrc] and sysrc(8)'s own sysrc.subr (now identical to
bsdconfig(8)'s sysrc.subr as of this patch).

Finally, this will allow a clean import of sysutils/sysrc (sans sysrc.subr,
already provided here).

Reviewed by:	jilles
Approved by:	adrian (co-mentor)
This commit is contained in:
Devin Teske 2012-09-29 03:41:21 +00:00
parent e2cfe42430
commit 1f843bc059

View File

@ -143,7 +143,7 @@ f_sysrc_get()
# Clear the environment of all variables, preventing the
# expansion of normals such as `PS1', `TERM', etc.
#
f_clean_env --except RC_CONFS RC_DEFAULTS
f_clean_env --except IFS RC_CONFS RC_DEFAULTS
. "$RC_DEFAULTS" > /dev/null 2>&1
@ -451,8 +451,7 @@ f_sysrc_set()
if [ "${RC_CONFS+set}" ]; then
file="${RC_CONFS%%[$IFS]*}"
else
file=$( f_sysrc_get rc_conf_files )
file="${file%%[$IFS]*}"
file=$( f_sysrc_get 'rc_conf_files%%[$IFS]*' )
fi
fi