NetBSD Problem Report #18523

Received: (qmail 3998 invoked by uid 605); 3 Oct 2002 18:01:47 -0000
Message-Id: <200210031801.g93I1j402276@panix5.panix.com>
Date: Thu, 3 Oct 2002 14:01:45 -0400 (EDT)
From: eravin@panix.com
Sender: gnats-bugs-owner@netbsd.org
Reply-To: eravin@panix.com
To: gnats-bugs@gnats.netbsd.org
Subject: /etc/rc.subr failure with some chroot'd programs
X-Send-Pr-Version: 3.95

>Number:         18523
>Category:       bin
>Synopsis:       /etc/rc.subr failure with some chroot'd programs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lukem
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 03 18:04:00 +0000 2002
>Closed-Date:    Fri Jun 27 04:07:03 +0000 2003
>Last-Modified:  Fri Jun 27 04:07:03 +0000 2003
>Originator:     Ed Ravin
>Release:        NetBSD 1.6
>Organization:
All Watched Over by Machines of Loving Grace
>Environment:


System: NetBSD panix5.panix.com 1.6 NetBSD 1.6 (PANIX-USER) #0: Fri Sep 13 20:17:38 EDT 2002 root@trinity.nyc.access.net:/devel/netbsd/1.6/src/sys/arch/i386/compile/PANIX-USER i386
Architecture: i386
Machine: i386
>Description:

If an rc.d script uses a chroot, and the program to be started resides
only in the chroot and not in an identical place in the root filesystem,
then working rc.d scripts from 1.5 will fail on 1.6.

>How-To-Repeat:

The script below worked in 1.5 - but failed to start the daemon
when we upgraded to 1.6.  When I created an executable
/usr/local/sbin/privoxy at the top level, the daemon started properly.

#!/bin/sh

# PROVIDE: privoxy
# REQUIRE: DAEMON

. /etc/rc.subr

name="privoxy"
rcvar=$name

privoxy_chroot="/var/privoxy-chroot"
pidfile=$privoxy_chroot/var/run/$name.pid
privoxy_flags="--user privoxy.privoxy --pidfile ${pidfile#$privoxy_chroot}  /etc/privoxy/config"

command="/usr/local/sbin/privoxy"

load_rc_config $name
run_rc_command "$1"

>Fix:

Apply the following patch to /etc/rc.subr :

--- rc.subr	2002/10/03 17:46:16	1.2
+++ rc.subr	2002/10/03 17:48:24
@@ -486,7 +486,7 @@
 				exit 1
 			fi

-			if [ ! -x $command ]; then
+			if [ ! -x ${_chroot:-}$command ]; then
 				return 0
 			fi

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: bin-bug-people->lukem 
Responsible-Changed-By: perry 
Responsible-Changed-When: Sun Apr 6 09:10:32 PDT 2003 
Responsible-Changed-Why:  
Luke is the rc.subr guy. 
As this is a one line patch, I suspect he could fix it quickly. 
I'm not really clear enough on the rc.subr stuff to just do it myself. 
State-Changed-From-To: open->closed 
State-Changed-By: lukem 
State-Changed-When: Fri Jun 27 04:06:30 UTC 2003 
State-Changed-Why:  
Fix applied (in a slightly simpler way). 
Thanks for letting us know about the problem and providing a solution. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.