From owner-cvs-src@FreeBSD.ORG  Thu Oct 11 01:40:21 2007
Return-Path: <owner-cvs-src@FreeBSD.ORG>
Delivered-To: cvs-src@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9AAE916A419
	for <cvs-src@FreeBSD.org>; Thu, 11 Oct 2007 01:40:21 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with SMTP id 4F68013C459
	for <cvs-src@FreeBSD.org>; Thu, 11 Oct 2007 01:40:19 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: (qmail 2134 invoked by uid 399); 11 Oct 2007 01:13:38 -0000
Received: from localhost (HELO slave.dougb.net) (dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTP; 11 Oct 2007 01:13:38 -0000
X-Originating-IP: 127.0.0.1
Date: Wed, 10 Oct 2007 18:13:36 -0700 (PDT)
From: Doug Barton <dougb@FreeBSD.org>
To: David O'Brien <obrien@FreeBSD.ORG>, des@freebsd.org
In-Reply-To: <20071010183542.GA58383@hub.freebsd.org>
Message-ID: <alpine.BSF.0.9999.0710101744420.8687@qbhto.arg>
References: <200710090730.l997UEEF042804@repoman.freebsd.org>
	<20071010002930.GA91077@dragon.NUXI.org>
	<20071010183542.GA58383@hub.freebsd.org>
X-message-flag: Outlook -- Not just for spreading viruses anymore!
X-OpenPGP-Key-ID: 0xD5B2F0FB
Organization: http://www.FreeBSD.org/
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; boundary="0-107691120-1192064433=:8687"
Content-ID: <alpine.BSF.0.9999.0710101801350.8687@qbhto.arg>
Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject: Re: cvs commit: src/etc/rc.d early.sh
X-BeenThere: cvs-src@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: CVS commit messages for the src tree <cvs-src.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/cvs-src>,
	<mailto:cvs-src-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/cvs-src>
List-Post: <mailto:cvs-src@freebsd.org>
List-Help: <mailto:cvs-src-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/cvs-src>,
	<mailto:cvs-src-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 11 Oct 2007 01:40:21 -0000

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--0-107691120-1192064433=:8687
Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8BIT
Content-ID: <alpine.BSF.0.9999.0710101801351.8687@qbhto.arg>

On Wed, 10 Oct 2007, David O'Brien wrote:

> On Tue, Oct 09, 2007 at 05:29:30PM -0700, David O'Brien wrote:
>> On Tue, Oct 09, 2007 at 07:30:14AM +0000, Doug Barton wrote:
>>>   Modified files:
>>>     etc/rc.d             early.sh
>>>   Log:
>>>   Deprecate use of the early.sh script as advertised when the support for
>>>   local rc.d scripts in the overall boot order was added.
>>
>> ". /etc/rc.early" in /etc/rc will stay?  Correct?
>
> To be clear - I don't care if its a ".sh" or proper RCng script.
> I'm just looking for a hook to do something before anything else in
> /etc/rc.d runs.  Commiting a /etc/rc.d/embryonic or /etc/rc.d/birth
> would be fine for my needs.

Can we get a better idea of what it is you're trying to do? As Mike 
pointed out, if it has to do with twiddling the environment a proper rc.d 
script won't help since it'll be executed in a subshell.

Also it's worth pointing out that currently early.sh is not the first 
thing run. The following is the order for the early stage (prior to 
inclusion of local scripts):
dumpon
initrandom
geli
gbde
encswap
ccd
swap1
mdconfig
ramdisk
early.sh
fsck
root
mountcritlocal
FILESYSTEMS

If you truly want to run something literally before everything else, we'd 
have to create something new, which perhaps is what you were getting at 
above. Before we add such a thing though, I'd like to get an idea of why 
it would be needed.

On Wed, 10 Oct 2007, Dag-Erling Smørgrav wrote:

> I must confess I don't really see the point of this change.

The commit message was pretty clear about the rationale. Running boot 
scripts without the benefit of a subshell is very dangerous, especially 
when the script we're talking about is one written by a user. The danger 
is compounded by the fact that these scripts are running early enough that 
any fatal errors will leave the system in a zombie state. This is not a 
theoretical issue, since in the past (when a lot of scripts from ports 
were .sh variety) we fielded a lot of support mail from users affected by 
bad scripts.

> If the problem is that rc.early is sourced by early.sh which is sourced
> by rc, simply rename early.sh to early so it runs in a subshell instead.

I'm not opposed to that idea (in fact I seriously considered it) but the 
reason I didn't do it is that I don't have a good sense of why we need it. 
Once again as Mike pointed out, the reason that it was there, and the 
reason it was .sh was specifically to do what we're now trying to avoid, 
since whatever benefits there may have been don't outweigh the risks.

I was unaware of the use of this script suggested in gmirror(8) until 
Dmitry pointed it out to me, and that usage should really be converted to 
a proper rc.d script. Other than that, while it's always possible that 
there are a whole lot of users out there quietly using this thing, I 
haven't seen any mention of it in a long time, and would rather eliminate 
a crufty hack than make it slightly less crufty.

My suggestion is to leave things as they are, and if there is pushback 
from the users based on the warnings printed when the script runs, we 
should revisit this. (I hope it's clear that things will still work the 
way that they work now, the only difference is that a warning will be 
printed if /etc/early.sh exists.)

Doug

-- 

     This .signature sanitized for your protection
--0-107691120-1192064433=:8687--