From owner-freebsd-current@FreeBSD.ORG Mon Nov 14 16:42:36 2011 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34937106566C; Mon, 14 Nov 2011 16:42:36 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from goliath.siemens.de (goliath.siemens.de [192.35.17.28]) by mx1.freebsd.org (Postfix) with ESMTP id B2E2A8FC1A; Mon, 14 Nov 2011 16:42:35 +0000 (UTC) Received: from mail3.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.13.6/8.13.6) with ESMTP id pAEGLbnY014108; Mon, 14 Nov 2011 17:21:37 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail3.siemens.de (8.13.6/8.13.6) with ESMTP id pAEGLbGL002561; Mon, 14 Nov 2011 17:21:37 +0100 Received: (from localhost) by curry.mchp.siemens.de (8.14.5/8.14.4) id pAEGLbcw022881; Date: Mon, 14 Nov 2011 17:21:37 +0100 From: Andre Albsmeier To: Doug Barton Message-ID: <20111114162137.GA61487@curry.mchp.siemens.de> References: <200512022006.jB2K67AK078509@repoman.freebsd.org> <20051203004057.GA20872@nagual.pp.ru> <4390EFB6.3090307@FreeBSD.org> <20051203012324.GA34147@nagual.pp.ru> <4390F9A2.208@FreeBSD.org> <20051203020831.GA34619@nagual.pp.ru> <43910010.2050702@FreeBSD.org> <20051203023304.GA34859@nagual.pp.ru> <4391061D.3050105@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4391061D.3050105@FreeBSD.org> X-Echelon: X-Advice: Drop that crappy M$-Outlook, I'm tired of your viruses! User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Mon, 14 Nov 2011 16:53:32 +0000 Cc: freebsd-current@FreeBSD.org, Andrey Chernov , Andre.Albsmeier@siemens.com Subject: Re: cvs commit: src/etc rc rc.shutdown rc.subr src/etc/rc.d localpkg src/sys/sys param.h X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Nov 2011 16:42:36 -0000 Yes, this is an old mail I am replying to ;-) On Fri, 02-Dec-2005 at 18:42:37 -0800, Doug Barton wrote: > Andrey Chernov wrote: > > On Fri, Dec 02, 2005 at 06:16:48PM -0800, Doug Barton wrote: > >>> Do you mean that scripts without .sh runs in > >>> the subshell and not damage main shell? > >> Yes, that's what I mean. Once again, sorry I wasn't clear. I've been staring > >> at this for too long now. :) > > > > Just to clarify it finally. You state that there is a big difference > > between system /etc/rc.d scripts (without .sh) which all runs in the > > single shell > > No. The way things stand now, all scripts named foo.sh are sourced into the > main shell, and everything else (base scripts, local scripts, whatever) are Today I stumbled over the fact that this statement only applies to .sh scripts in /etc/rc.d but not to the ones in /usr/local/etc/rc.d. I need to source a script.sh and I put it into /usr/local/etc/rc.d -- only to recognise that it will be run in a subshell. This patch probably would fix this but maybe there is a reason not to do so: --- rc.subr.ORI 2011-11-14 17:18:39.000000000 +0100 +++ rc.subr 2011-11-14 17:19:15.000000000 +0100 @@ -938,7 +938,7 @@ eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd case "$_file" in - /etc/rc.d/*.sh) # run in current shell + /etc/rc.d/*.sh | /usr/local/etc/rc.d/*.sh) # run in current shell set $_arg; . $_file ;; *[~#]|*.OLD|*.bak|*.orig|*,v) # scratch file; skip Or even use *.sh) Thanks, -Andre > all run in subshells. You could answer this for yourself by looking in > /etc/rc.subr if it's still not clear. > > >> I should have mentioned in my last message that I did take a quick look at > >> the script itself, and didn't see anything that should be a problem, but as > > > > /usr/bin/limits is the problem there because it change limits for whole > > shell, not for command which just invoked. If all scripts runs in the same > > shell, all subsequential of them will be affected. > > Assuming you're right about that, then you should do something like what I > suggested in the patch I sent so that the script gets installed as apache > instead of apache.sh. > > hth, > > Doug > -- Failure is not an option -- it comes bundled with Windows.