Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2000 06:04:24 -0500
From:      Richard Wackerbarth <rkw@dataplex.net>
To:        Doug@gorean.org
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Safe sourcing of rc files
Message-ID:  <00041006042400.09923@nomad.dataplex.net>
In-Reply-To: <38F17E7A.5892318A@gorean.org>
References:  <38F17E7A.5892318A@gorean.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00041006042400.09923>