Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Sep 1999 21:29:52 +0200
From:      Sheldon Hearn <sheldonh@uunet.co.za>
To:        John Reynolds~ <jreynold@sedona.ch.intel.com>
Cc:        Lev Serebryakov <lev@imc.macro.ru>, stable@FreeBSD.ORG
Subject:   Re: New 3.3-STABLE: out of file descriptors 
Message-ID:  <1739.938028592@axl.noc.iafrica.com>
In-Reply-To: Your message of "Wed, 22 Sep 1999 12:14:30 MST." <14313.10902.471184.356967@hip186.ch.intel.com> 

next in thread | previous in thread | raw e-mail | index | archive | help


On Wed, 22 Sep 1999 12:14:30 MST, John Reynolds~ wrote:

> didn't I see something a few weeks (months?) ago on this list
> regarding about the same thing--and the cause was a recursive include
> of /etc/rc.conf ?

Yes. While it _is_ pilot error, we could do a little more to protect
folks against this common mistake.

I'd love feedback on whether the following works "out in the field". I
haven't tested it too thoroughly.

Ciao,
Sheldon.

Index: rc.conf
===================================================================
RCS file: /home/ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.37
diff -u -d -2 -r1.37 rc.conf
--- rc.conf	1999/09/22 06:31:32	1.37
+++ rc.conf	1999/09/22 09:59:45
@@ -8,4 +8,9 @@
 # spamming your local configuration information.
 #
+# A common mistake is to copy the contents of this file into one of the
+# ${rc_conf_files} files (e.g. /etc/rc.conf). That does not work, because
+# this file ends up recursing on itself. The ${rc_conf_files} files should
+# only contain values which override values set in this file.
+#
 # All arguments must be in double or single quotes.
 #
@@ -233,8 +238,17 @@
 #
 
+rc_conf_files_done=${rc_conf_files_done:-:}
 for i in ${rc_conf_files}; do
-	if [ -f $i ]; then
-        	. $i
-	fi
+	case ${rc_conf_files_done} in
+	*:${i}:*)
+		echo WARNING: ${i} recurses on itself.
+		echo Read the comments at the top of the /etc/defaults/rc.conf file.
+		;;
+	*)
+		rc_conf_files_done="${rc_conf_files_done}${i}:"
+		if [ -r "${i}" ]; then
+			. ${i}
+		fi
+		;;
+	esac
 done
-


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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