git: f1ab799927c8 - main - rc: fix rc script parsing

Cy Schubert cy at FreeBSD.org
Thu Feb 25 20:07:31 UTC 2021


The branch main has been updated by cy:

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

commit f1ab799927c8e93e8f58e5039f287a2ca45675ec
Author:     Cy Schubert <cy at FreeBSD.org>
AuthorDate: 2021-02-25 19:04:50 +0000
Commit:     Cy Schubert <cy at FreeBSD.org>
CommitDate: 2021-02-25 19:47:56 +0000

    rc: fix rc script parsing
    
    77e1ccbee3ed6c837929e4e232fd07f95bfc8294 introduced a bug whereby
    rc scripts in etc/rc.d and $local_startup failed to parse output
    from called commands because IFS was set to " " instead of the
    default " \t\n". This caused parsing of output that contains any
    whitespace character, such as tabs and newlines, not matching just a
    space to fail.
    
    PR:             249192
    MFC after:      3 weeks
    X-MFC with:     77e1ccbee3ed6c837929e4e232fd07f95bfc8294
---
 libexec/rc/rc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libexec/rc/rc b/libexec/rc/rc
index b5bc188fc7c0..92eb5c48aab7 100644
--- a/libexec/rc/rc
+++ b/libexec/rc/rc
@@ -105,7 +105,7 @@ files=`rcorder ${skip} ${skip_firstboot} ${_rc_parallel} /etc/rc.d/* 2>/dev/null
 _rc_elem_done=' '
 IFS=$'\n'
 for _rc_group in ${files}; do
-	IFS=$' '
+	unset IFS
 	for _rc_elem in ${_rc_group}; do
 		run_rc_script ${_rc_elem} ${_boot} &
 		_rc_elem_done="${_rc_elem_done}${_rc_elem} "
@@ -138,7 +138,7 @@ fi
 files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} ${_rc_parallel} 2>/dev/null`
 IFS=$'\n'
 for _rc_group in ${files}; do
-	IFS=$' '
+	unset IFS
 	for _rc_elem in ${_rc_group}; do
 		case "$_rc_elem_done" in
 		*" $_rc_elem "*) continue ;;


More information about the dev-commits-src-all mailing list