From owner-freebsd-bugs@FreeBSD.ORG Thu Jan 2 23:30:01 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AAAE4267 for ; Thu, 2 Jan 2014 23:30:01 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 845B51E9F for ; Thu, 2 Jan 2014 23:30:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s02NU1EC002806 for ; Thu, 2 Jan 2014 23:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s02NU1MJ002805; Thu, 2 Jan 2014 23:30:01 GMT (envelope-from gnats) Resent-Date: Thu, 2 Jan 2014 23:30:01 GMT Resent-Message-Id: <201401022330.s02NU1MJ002805@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, Dreamcat4 Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7F479169 for ; Thu, 2 Jan 2014 23:25:40 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6A3861E7F for ; Thu, 2 Jan 2014 23:25:40 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s02NPenW008465 for ; Thu, 2 Jan 2014 23:25:40 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s02NPelO008460; Thu, 2 Jan 2014 23:25:40 GMT (envelope-from nobody) Message-Id: <201401022325.s02NPelO008460@oldred.freebsd.org> Date: Thu, 2 Jan 2014 23:25:40 GMT From: Dreamcat4 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/185429: rc.subr: ${name}_chroot does not work when there's a custom rc "start_cmd" X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 23:30:01 -0000 >Number: 185429 >Category: misc >Synopsis: rc.subr: ${name}_chroot does not work when there's a custom rc "start_cmd" >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: Thu Jan 02 23:30:01 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Dreamcat4 >Release: 9.1-RELEASE-p5 and higher >Organization: - >Environment: This bug occurs for any / all recent FreeBSD versions since 9.1-RELEASE-p5 >Description: There is a bug in /etc/rc.subr the bug is: if [ there's a custom ${XXX_cmd}, ] E.g. an rc "start_cmd", "stop_cmd". then "${name}_chroot" does not work. Documentation: man -Pcat rc.subr | grep -5 -i chroot ${name}_chroot Directory to chroot(8) to before running command. Only supported after /usr is mounted. It happens at these begin/end points: https://gitorious.org/freebsd/freebsd/source/1e0e806b8822c4570e09508df054f82f9a47ce0e:etc/rc.subr#L684-739 If you look in rc.subr at those lines ^^ control is obviously never getting to the part where it kicks of the chroot case... which only happens in case start). There may be more bugs nearby, and for the same reason. Will fix / wont fix ? Many thanks. >How-To-Repeat: for any rc.d service that sets "start_cmd" at the top of its rc.d script 1) set "${name}_chroot=/path/to/chroot" in rc.conf 2) set "name_enable=YES" in rc.conf 3) start that rc.d service >Fix: need to edit the file "/etc/rc.subr" around these lines: https://gitorious.org/freebsd/freebsd/source/1e0e806b8822c4570e09508df054f82f9a47ce0e:etc/rc.subr#L684-739 So that ${name}_chroot is checked for, even at the top where it says: "# if there's a custom ${XXX_cmd}," ... >Release-Note: >Audit-Trail: >Unformatted: