From owner-freebsd-rc@FreeBSD.ORG Wed Jul 28 12:15:46 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 7A32016A4CE for ; Wed, 28 Jul 2004 12:15:46 +0000 (GMT) Received: from fillmore.dyndns.org (port-212-202-50-15.dynamic.qsc.de [212.202.50.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 36AE343D5C for ; Wed, 28 Jul 2004 12:15:46 +0000 (GMT) (envelope-from eikemeier@fillmore-labs.com) Received: from dhcp-11.local ([172.16.0.11] helo=dhcp-7.local) by fillmore.dyndns.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.41 (FreeBSD)) id 1BpnLP-0004fC-Jz; Wed, 28 Jul 2004 14:15:44 +0200 Date: Wed, 28 Jul 2004 14:16:50 +0200 Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v482) To: Peter Pentchev From: Oliver Eikemeier In-Reply-To: <20040728120228.GA1390@straylight.m.ringlet.net> Message-Id: <012A63D3-E090-11D8-BD92-00039312D914@fillmore-labs.com> Content-Transfer-Encoding: 7bit User-Agent: KMail/1.5.9 cc: freebsd-rc@freebsd.org Subject: Re: 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: Wed, 28 Jul 2004 12:15:46 -0000 Peter Pentchev wrote: > On Tue, Jul 27, 2004 at 07:34:26PM +0300, Mike Makonnen wrote: >> On Tue, Jul 27, 2004 at 03:37:12PM +0300, Peter Pentchev wrote: >>> 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 :) Thanks for bringing this up. >> The brokeness is in the port startup script. One of the things ports >> scripts need to do is install the script without a .sh suffix, so that >> it does not get executed in the parent shell, and instead in a >> subshell. >> >> The only things that should get executed in the same shell are scripts >> like rc.d/rcconf.sh, which is there to load the contents of rc.conf. > > Okay, so rc scripts that expect to be called in a subshell should be > named without the '.sh' suffix. What does this mean for 4.x though, > where only scripts *with* the '.sh' suffix are ever executed? Should > the ports provide differently-named scripts for 4.x and 5.x (or rather, > for OSVERSION's before and after the rc.subr overhaul)? I have a patch to bsd.port.mk which does this. We have to think about whether we are happy with it (since -CURRENTs before the change won't be able to use packages build on machines after the change), but I guess this would be the proper way to handle things. Packages installing `.sh' startup script should be treated as being not rcNG aware, wether they use some part of the rc.subr structure or not. This will ease upgrading, and I believe sourcing ports startup scripts instead of executing them in a subshell is not a vastly useful feature and shouldn't be possible. -Oliver