From owner-freebsd-arch@FreeBSD.ORG Wed Oct 8 12:07:25 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3E61D16A4B3; Wed, 8 Oct 2003 12:07:25 -0700 (PDT) Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) by mx1.FreeBSD.org (Postfix) with ESMTP id C2D1343FBF; Wed, 8 Oct 2003 12:07:23 -0700 (PDT) (envelope-from adam@migus.org) Received: from garple.migus.org ([68.55.83.94]) by comcast.net (sccrmhc13) with ESMTP id <2003100819072201600b0nshe>; Wed, 8 Oct 2003 19:07:22 +0000 Received: by garple.migus.org (Postfix, from userid 80) id 1D7F48FC40; Wed, 8 Oct 2003 15:07:22 -0400 (EDT) Received: from 204.254.155.35 (SquirrelMail authenticated user adam) by mail.migus.org with HTTP; Wed, 8 Oct 2003 15:07:22 -0400 (EDT) Message-ID: <51574.204.254.155.35.1065640042.squirrel@mail.migus.org> In-Reply-To: <20031008212302.T4729@gamplex.bde.org> References: <20030925092319.H5418@gamplex.bde.org><49939.204.254.155.35.1064593320.squirrel@mail.migus.org> <20030927080420.N18558@gamplex.bde.org> <49955.192.168.4.2.1065074430.squirrel@mail.migus.org> <20031008212302.T4729@gamplex.bde.org> Date: Wed, 8 Oct 2003 15:07:22 -0400 (EDT) From: "Adam C. Migus" To: "Bruce Evans" User-Agent: SquirrelMail/1.4.1 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal cc: Stefan Farfeleder cc: arch@freebsd.org Subject: Re: sys/conf/DEFAULT[S] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2003 19:07:25 -0000 Bruce Evans said: > On Thu, 2 Oct 2003, Adam C. Migus wrote: > >> > On Fri, 26 Sep 2003, Adam C. Migus wrote: >> >> This patch works for me, please let me know if there's any >> problems >> with it or you'd like a PR. > > % ==== > //depot/user/amigus/freebsd-amigus/src/usr.sbin/config/config.y#1 - > /src/p4/user/amigus/perforce.freebsd.org/freebsd-amigus/usr.sbin/config/config.y > ==== > % @@ -118,6 +118,8 @@ > % | > % Config_spec SEMICOLON > % | > % + Include > % + | > % SEMICOLON > % | > % error SEMICOLON > % @@ -164,9 +166,7 @@ > % = { > % hints = $2; > % hintmode = 1; > % - } | > % - INCLUDE ID > % - = { include($2, 0); }; > % + }; > % > % System_spec: > % CONFIG System_id System_parameter_list > % @@ -265,6 +265,11 @@ > % rmdev($2); > % } ; > % > % +Include: > % + INCLUDE ID > % + = { include($2, 0); }; > % + > % + > % %% > % > % void > > I found 1 problem with this: it doesn't require SEMICOLON after > "INCLUDE ID", so parsing resumes after "ID" when the input stream > is switched back to the includer. You can say things like > > include FOO device foo > > and then the "device foo" directive actually works. This can be > considered a feature, but the following is not: > > include GENERIC.local > > at the end of GENERIC should be a syntax error, but it actually > matches ID = GENERIC and includes GENERIC recursively, which gives > a confusing error message. There would be a syntax error on > switching > back but config aborts before then. (Filenames other than single > identifiers must be quoted to avoid problems like this. This is not > very obvious since config was changed to not require quotes in most > contexts.) > > Stefan's version requires SEMICOLON: > > % Index: src/usr.sbin/config/config.y > % > =================================================================== > % RCS file: /usr/home/ncvs/src/usr.sbin/config/config.y,v > % retrieving revision 1.61 > % diff -u -r1.61 config.y > % --- src/usr.sbin/config/config.y 6 Jul 2003 02:00:52 -0000 1.61 > % +++ src/usr.sbin/config/config.y 27 Sep 2003 10:39:13 -0000 > % @@ -118,6 +118,9 @@ > % | > % Config_spec SEMICOLON > % | > % + INCLUDE ID SEMICOLON > % + = { include($2, 0); }; > % + | > % SEMICOLON > % | > % error SEMICOLON > % @@ -164,9 +167,7 @@ > % = { > % hints = $2; > % hintmode = 1; > % - } | > % - INCLUDE ID > % - = { include($2, 0); }; > % + } > % > % System_spec: > % CONFIG System_id System_parameter_list > > I lost your examples showing that this doesn't quite work. What is > the > problem with it? > > Another old bug is that using "include" defeats the point of the > INCLUDE_CONFIG_FILE option (since included files aren't expanded). > > Bruce > Bruce, Ah yes, my bad. It was a patching error. Specifically my error in not applying the patch but rather reading and carelessly assuming that Stefan had simply appended a SEMICOLON to the existing code, as his patch. :-) When I correctly apply Stefan's patch it fixes this problem however with Stefan's patch the code is essentially equivalent to mine, so, any caveats except those involving the absent SEMICOLON, still apply. For example the recursive include case you pointed out. Apologies for the misunderstanding. The offer to fix, or, perhaps in lieu of this thread, enhance /usr/sbin/config still stands if you'd like. It might be fun to take the suck out of /usr/sbin/config if people think it's warrented. :-) -- Adam - (http://people.migus.org/~amigus/) Migus Dot Org - (http://www.migus.org/)