From owner-freebsd-hackers Mon Apr 10 4: 4:34 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.ddg.com (eunuch.ddg.com [216.30.58.66]) by hub.freebsd.org (Postfix) with ESMTP id 8DFD237B8BE for ; Mon, 10 Apr 2000 04:04:31 -0700 (PDT) (envelope-from rkw@dataplex.net) Received: from nomad.dataplex.net (24.28.73.209) by mail.ddg.com with SMTP (Eudora Internet Mail Server 2.1); Mon, 10 Apr 2000 06:04:26 -0500 From: Richard Wackerbarth To: Doug@gorean.org Subject: Re: Safe sourcing of rc files Date: Mon, 10 Apr 2000 06:04:24 -0500 X-Mailer: KMail [version 1.1.38] Content-Type: text/plain References: <38F17E7A.5892318A@gorean.org> In-Reply-To: <38F17E7A.5892318A@gorean.org> Cc: freebsd-hackers@FreeBSD.ORG MIME-Version: 1.0 Message-Id: <00041006042400.09923@nomad.dataplex.net> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, 10 Apr 2000, Doug Barton wrote: > > Since the move to /etc/defaults/rc.conf, one of the consistent examples > of foot-shooting is the user blindly copying that file to /etc/rc.conf > without reading the warning at the end not to do this, or at least to > delete the bit at the end that does the recursive sourcing of > /etc/rc.conf and /etc/rc.conf.local. > After careful experimentation, and a few abortive attempts, I have > developed the following technique. [snip] Excellent way to help the situation. However, I think that it is the wrong approach. Rather that having all that code to test for, and correct , the recursive file inclusions, I think we should go the other direction and simply eliminate the recursions in the first place. Remove ALL "code" from the rc.conf files and make them strictly definitions of variables. Put the logic that supports multiple rc.conf files in a different support file which you source at the top of each of the rc files. This has the following advantages: 1) It simplifies the individual rc files by hiding the implementation logic. 2) There is a clean separation of logic and parameter definitions 3) The resulting rc.conf files can be easily parsed/generated by a configuration utility. 4) As with your solution, there is no problem with recursion. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message