Date: Sat, 25 Mar 2000 03:40:08 -0800 (PST) From: Doug Barton <Doug@gorean.org> To: freebsd-bugs@FreeBSD.org Subject: Re: conf/17595: Preventing cp /etc/defaults/rc.conf /etc/rc.conf from looping Message-ID: <200003251140.DAA67735@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/17595; it has been noted by GNATS.
From: Doug Barton <Doug@gorean.org>
To: adrian@creative.net.au
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: conf/17595: Preventing cp /etc/defaults/rc.conf /etc/rc.conf from
looping
Date: Sat, 25 Mar 2000 03:30:14 -0800
adrian@creative.net.au wrote:
> --- /usr/src/etc/defaults/rc.conf Thu Mar 16 10:15:20 2000
> +++ rc.conf Sat Mar 25 10:33:06 2000
> @@ -291,9 +291,13 @@
> #
> #
>
> -for i in ${rc_conf_files}; do
> - if [ -f $i ]; then
> - . $i
> - fi
> -done
> +# Anti-loop detection
> +if [ "x$self_rcconf" != "xyes" ]; then
> + self_rcconf="yes"
> + for i in ${rc_conf_files}; do
> + if [ -f $i ]; then
> + . $i
> + fi
> + done
> +fi
Here's the problem with this approach. More than one script in /etc/rc*
sources the rc.conf files in the process of booting. Using this approach
those scripts (like rc.firewall, rc.network*, etc.) only source
/etc/defaults/rc.conf when they are started, and never source the user's
customizations.
I have been giving this a lot of thought, and I think the correct
approach would be to put a function that knows how to source the various
combos of rc.conf* files (similar to the current code, or maybe exactly
like it, I haven't tested it yet) at the end of /etc/defaults/rc.conf
and then make each script that sources the conf files responsible for
running the recursive source itself. This is a slightly less elegant
solution, but it will solve this problem once and for all.
I'll try to work up some patches tomorrow...
Doug
--
"So, the cows were part of a dream that dreamed itself into
existence? Is that possible?" asked the student incredulously.
The master simply replied, "Mu."
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003251140.DAA67735>
