Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jul 2004 15:37:12 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        Mike Makonnen <mtm@FreeBSD.org>
Cc:        freebsd-rc@FreeBSD.org
Subject:   rc.subr exits prematurely
Message-ID:  <20040727123712.GA1196@straylight.m.ringlet.net>

next in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040727123712.GA1196>