Subject: bin/18523: /etc/rc.subr failure with some chroot'd programs
To: None <gnats-bugs@gnats.netbsd.org>
From: None <eravin@panix.com>
List: netbsd-bugs
Date: 10/03/2002 14:01:45
>Number: 18523
>Category: bin
>Synopsis: /etc/rc.subr failure with some chroot'd programs
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 03 11:04:00 PDT 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted: