conf/175079: rc.subr poorly handles recursive run_rc_command invocations
Yuriy Taraday
yorik.sar at gmail.com
Sun Jan 6 23:10:00 UTC 2013
>Number: 175079
>Category: conf
>Synopsis: rc.subr poorly handles recursive run_rc_command invocations
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Jan 06 23:10:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Yuriy Taraday
>Release: 8.3-RELEASE-p5
>Organization:
>Environment:
reeBSD greater 8.3-RELEASE-p5 FreeBSD 8.3-RELEASE-p5 #1: Wed Dec 12 15:30:21 GST 2012 root at greater:/usr/obj/usr/src/sys/MYCONF amd64
>Description:
When custom precmd or cmd calls run_rc_command, postcmd and/or cmd are most likely to be missed.
For example, when squid stop_cmd calls "run_rc_command poll", _postcmd variable is overwritten and my postcmd was never called.
>How-To-Repeat:
Add your custom stop_postcmd for squid in /etc/rc.conf.d/squid. It will never be called.
>Fix:
Proposed patch makes these variables local to function so that they are not overwritten in caller's namespace.
Patch attached with submission follows:
*** /usr/src/etc/rc.subr 2012-03-03 10:15:13.000000000 +0400
--- /etc/rc.subr 2013-01-07 02:48:43.000000000 +0400
*************** run_rc_command()
*** 717,722 ****
--- 717,723 ----
# if there's a custom ${XXX_cmd},
# run that instead of the default
#
+ local _cmd _precmd _postcmd
eval _cmd=\$${rc_arg}_cmd \
_precmd=\$${rc_arg}_precmd \
_postcmd=\$${rc_arg}_postcmd
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list