git: 763db5893287 - main - rc: save and restore $IFS

Cy Schubert cy at FreeBSD.org
Fri Feb 26 06:04:01 UTC 2021


The branch main has been updated by cy:

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

commit 763db58932874bb47fc6f9322ab81cc947f80991
Author:     Cy Schubert <cy at FreeBSD.org>
AuthorDate: 2021-02-26 05:39:18 +0000
Commit:     Cy Schubert <cy at FreeBSD.org>
CommitDate: 2021-02-26 06:03:38 +0000

    rc: save and restore $IFS
    
    Fix another bug in 77e1ccbee3ed6c837929e4e232fd07f95bfc8294. $IFS
    should be fully restored for its other users.
    
    PR:             249192
    Reported by:    jkim
    MFC after:      3 weeks
    X-MFC with:     77e1ccbee3ed6c837929e4e232fd07f95bfc8294
---
 libexec/rc/rc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libexec/rc/rc b/libexec/rc/rc
index 92eb5c48aab7..2cb840e68919 100644
--- a/libexec/rc/rc
+++ b/libexec/rc/rc
@@ -103,9 +103,10 @@ checkyesno rc_parallel_start && _rc_parallel='-p'
 files=`rcorder ${skip} ${skip_firstboot} ${_rc_parallel} /etc/rc.d/* 2>/dev/null`
 
 _rc_elem_done=' '
+oldifs="$IFS"
 IFS=$'\n'
 for _rc_group in ${files}; do
-	unset IFS
+	IFS="$oldifs"
 	for _rc_elem in ${_rc_group}; do
 		run_rc_script ${_rc_elem} ${_boot} &
 		_rc_elem_done="${_rc_elem_done}${_rc_elem} "
@@ -119,7 +120,7 @@ for _rc_group in ${files}; do
 done
 
 unset files local_rc
-unset IFS
+IFS="$oldifs"
 
 # Now that disks are mounted, for each dir in $local_startup
 # search for init scripts that use the new rc.d semantics.
@@ -138,7 +139,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
-	unset IFS
+	IFS="$oldifs"
 	for _rc_elem in ${_rc_group}; do
 		case "$_rc_elem_done" in
 		*" $_rc_elem "*) continue ;;
@@ -149,7 +150,7 @@ for _rc_group in ${files}; do
 	wait
 	IFS=$'\n'
 done
-unset IFS
+IFS="$oldifs"
 
 # Remove the firstboot sentinel, and reboot if it was requested.
 # Be a bit paranoid about removing it to handle the common failure


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