From owner-freebsd-current Mon Mar 27 3:34:48 2000 Delivered-To: freebsd-current@freebsd.org Received: from ewok.creative.net.au (ewok.creative.net.au [203.30.44.41]) by hub.freebsd.org (Postfix) with SMTP id 4672437BB62 for ; Mon, 27 Mar 2000 03:34:43 -0800 (PST) (envelope-from adrian@creative.net.au) Received: (qmail 8901 invoked by uid 1001); 27 Mar 2000 11:34:38 -0000 Date: Mon, 27 Mar 2000 19:34:38 +0800 From: Adrian Chadd To: Doug Barton Cc: Adrian Chadd , FreeBSD-current@freebsd.org Subject: Re: conf/17595: Preventing cp /etc/defaults/rc.conf /etc/rc.conf from looping Message-ID: <20000327193437.A8861@ewok.creative.net.au> References: <20000325103755.10128.qmail@ewok.creative.net.au> <38DCA346.58CFC148@gorean.org> <20000327083736.A4402@ewok.creative.net.au> <38DF36D8.EE1E8706@gorean.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: <38DF36D8.EE1E8706@gorean.org>; from Doug Barton on Mon, Mar 27, 2000 at 02:24:24AM -0800 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Mar 27, 2000, Doug Barton wrote: > One solution that was experimented with a while back, and referenced > again in PR 17595 was to put a checkpoint variable in > /etc/defaults/rc.conf which would prevent it from being recursively > sourced. There are two problems with this strategy. The first is that > users who define both an /etc/rc.conf and an /etc/rc.conf.local will not > have the second file sourced on rc's first run through the rc.conf's. > More serious is the fact that there are other scripts in /etc/rc* (like > rc.firewall, rc.network, etc.) that source the rc.conf's themselves. > Using this checkpoint variable method those scripts first source > /etc/defaults/rc.conf, then don't go on to source the files in /etc. > This prevents them from reading in user defined overrides to the > defaults. This is disastrous in cases like rc.firewall, where for > example the firewall type would never get defined as "open", so the > machine is cut off from the network on reboot if ipfw is compiled into > the kernel. Ok, I tried something a little different. I wrote a script called 'getconfig', whose sole existence is to read /etc/defaults/rc.conf, /etc/rc.conf, and then any other scripts that are in rc_conf_files (well, it didn't have to read /etc/rc.conf, but I forced it anyway ..) Then each startup script which loaded /etc/defaults/rc.conf and tried to load /etc/rc.conf was modified to load /etc/getconfig instead. Since no code exists in the conf files, if the user copies them around willy nilly, they don't cause a loop. It also means that you could possibly put sanity checking code in getconfig to make sure the user hasn't done anything blatantly stupid (I can't think of anything, but then, I don't cp /etc/defaults/rc.conf /etc/rc.conf that frequently either .. ) So, the question is: What have I missed this time ? Adrian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message