Date: Sun, 6 Jan 2013 23:02:27 GMT From: Yuriy Taraday <yorik.sar@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: conf/175079: rc.subr poorly handles recursive run_rc_command invocations Message-ID: <201301062302.r06N2Rmi094380@red.freebsd.org> Resent-Message-ID: <201301062310.r06NA0ae041931@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301062302.r06N2Rmi094380>