From owner-freebsd-bugs@FreeBSD.ORG Sun Jan 6 23:10:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C5BE9935 for ; Sun, 6 Jan 2013 23:10:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 93E101C58 for ; Sun, 6 Jan 2013 23:10:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r06NA0Ym041932 for ; Sun, 6 Jan 2013 23:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r06NA0ae041931; Sun, 6 Jan 2013 23:10:00 GMT (envelope-from gnats) Resent-Date: Sun, 6 Jan 2013 23:10:00 GMT Resent-Message-Id: <201301062310.r06NA0ae041931@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Yuriy Taraday Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 705AF7E0 for ; Sun, 6 Jan 2013 23:02:27 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 5C7321C2E for ; Sun, 6 Jan 2013 23:02:27 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r06N2RXT094381 for ; Sun, 6 Jan 2013 23:02:27 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id r06N2Rmi094380; Sun, 6 Jan 2013 23:02:27 GMT (envelope-from nobody) Message-Id: <201301062302.r06N2Rmi094380@red.freebsd.org> Date: Sun, 6 Jan 2013 23:02:27 GMT From: Yuriy Taraday To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: conf/175079: rc.subr poorly handles recursive run_rc_command invocations X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2013 23:10:00 -0000 >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: