Date: Mon, 5 Dec 2005 05:04:12 +0900 (JST) From: NIIMI Satoshi <sa2c@sa2c.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: conf/89945: rc script in /usr should be run in subshell Message-ID: <20051204200412.295761145B@berkeley.l.sa2c.net> Resent-Message-ID: <200512042010.jB4KA6NV089289@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 89945 >Category: conf >Synopsis: rc script in /usr should be run in subshell >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Dec 04 20:10:06 GMT 2005 >Closed-Date: >Last-Modified: >Originator: NIIMI Satoshi >Release: FreeBSD 6.0-RELEASE i386 >Organization: >Environment: System: FreeBSD freebsd7.localdomain 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Mon Dec 5 00:32:37 JST 2005 root@freebsd7.localdomain:/usr/obj/usr/src/sys/GENERIC i386 >Description: /usr/*/rc.d/*.sh should be run in subshell instead of in current shell. >How-To-Repeat: After "pkg_add -r portupgrade", sshd won't start on boot. >Fix: --- rc.subr.diff begins here --- Index: rc.subr =================================================================== RCS file: /home/ncvs/src/etc/rc.subr,v retrieving revision 1.44 diff -u -r1.44 rc.subr --- rc.subr 2 Dec 2005 20:06:07 -0000 1.44 +++ rc.subr 4 Dec 2005 19:57:49 -0000 @@ -832,6 +832,9 @@ eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd case "$_file" in + /usr/*) # user scripts + run_in_subshell + ;; *.sh) # run in current shell set $_arg; . $_file ;; @@ -839,19 +842,24 @@ warn "Ignoring scratch file $_file" ;; *) # run in subshell - if [ -x $_file ]; then - if [ -n "$rc_fast_and_loose" ]; then - set $_arg; . $_file - else - ( trap "echo Script $_file interrupted; kill -QUIT $$" 3 - trap "echo Script $_file interrupted; exit 1" 2 - set $_arg; . $_file ) - fi - fi + run_in_subshell ;; esac } +run_in_subshell() +{ + if [ -x $_file ]; then + if [ -n "$rc_fast_and_loose" ]; then + set $_arg; . $_file + else + ( trap "echo Script $_file interrupted; kill -QUIT $$" 3 + trap "echo Script $_file interrupted; exit 1" 2 + set $_arg; . $_file ) + fi + fi +} + # # load_rc_config # Source in the configuration file for a given command. --- rc.subr.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051204200412.295761145B>