From owner-freebsd-rc@FreeBSD.ORG Tue Jul 27 12:37:15 2004 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F91B16A4CE for ; Tue, 27 Jul 2004 12:37:15 +0000 (GMT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id C5C3743D45 for ; Tue, 27 Jul 2004 12:37:13 +0000 (GMT) (envelope-from roam@ringlet.net) Received: (qmail 24444 invoked from network); 27 Jul 2004 12:32:03 -0000 Received: from unknown (HELO straylight.m.ringlet.net) (217.75.134.254) by gandalf.online.bg with SMTP; 27 Jul 2004 12:32:03 -0000 Received: (qmail 45205 invoked by uid 1000); 27 Jul 2004 12:37:12 -0000 Date: Tue, 27 Jul 2004 15:37:12 +0300 From: Peter Pentchev To: Mike Makonnen Message-ID: <20040727123712.GA1196@straylight.m.ringlet.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="M38YqGLZlgb6RLPS" Content-Disposition: inline User-Agent: Mutt/1.5.6i cc: freebsd-rc@FreeBSD.org Subject: rc.subr exits prematurely X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to /etc/rc.d design and implementation. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2004 12:37:15 -0000 --M38YqGLZlgb6RLPS Content-Type: multipart/mixed; boundary="NU0Ex4SbNnrxsi6C" Content-Disposition: inline --NU0Ex4SbNnrxsi6C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, With the recent changes to rc.subr so that it executes port startup scripts in the same shell instead of in a subshell, another problem has come up. For the scripts which record a PID file, a check is made on startup and on shutdown for the PID file's existence, and if it fails, rc.subr exits, which prevents the rest of the scripts from being executed. Attached is a quick patch which works around this problem, but may introduce others - I'm not quite sure I understand all of rc.subr's internal workings :) G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 If I were you, who would be reading this sentence? --NU0Ex4SbNnrxsi6C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rc-subr-noexit.patch" Content-Transfer-Encoding: quoted-printable Index: src/etc/rc.subr =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/etc/rc.subr,v retrieving revision 1.30 diff -u -r1.30 rc.subr --- src/etc/rc.subr 4 Jul 2004 07:21:18 -0000 1.30 +++ src/etc/rc.subr 26 Jul 2004 12:40:16 -0000 @@ -592,7 +592,7 @@ start) if [ -z "$rc_fast" -a -n "$rc_pid" ]; then echo "${name} already running? (pid=3D$rc_pid)." - exit 1 + return 1 fi =20 if [ ! -x ${_chroot}${command} ]; then @@ -675,14 +675,14 @@ =20 stop) if [ -z "$rc_pid" ]; then - [ -n "$rc_fast" ] && exit 0 + [ -n "$rc_fast" ] && return 0 if [ -n "$pidfile" ]; then echo \ "${name} not running? (check $pidfile)." else echo "${name} not running?" fi - exit 1 + return 1 fi =20 # if the precmd failed and force @@ -727,7 +727,7 @@ else echo "${name} not running?" fi - exit 1 + return 1 fi echo "Reloading ${name} config files." if [ -n "$_precmd" ]; then @@ -800,7 +800,7 @@ =20 echo 1>&2 "$0: unknown directive '$rc_arg'." rc_usage "$_keywords" - exit 1 + return 1 } =20 # --NU0Ex4SbNnrxsi6C-- --M38YqGLZlgb6RLPS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFBBkx37Ri2jRYZRVMRAm0OAJ45gVgqsg0ICtP2t9ekc7Xaya2pYwCgsium k3cmeYOWiHFaaCnSMn+chZ8= =C/sk -----END PGP SIGNATURE----- --M38YqGLZlgb6RLPS--