From owner-freebsd-arch@FreeBSD.ORG Sat Sep 27 11:50:00 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 52A7A16A4B3 for ; Sat, 27 Sep 2003 11:50:00 -0700 (PDT) Received: from rwcrmhc11.comcast.net (rwcrmhc11.comcast.net [204.127.198.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id E888F4402B for ; Sat, 27 Sep 2003 11:49:57 -0700 (PDT) (envelope-from adam@migus.org) Received: from garple.migus.org ([68.55.83.94]) by comcast.net (rwcrmhc11) with ESMTP id <2003092718495601300acc3te>; Sat, 27 Sep 2003 18:49:57 +0000 Received: from localhost (localhost [127.0.0.1]) by localhost (Postfix) with ESMTP id 7F0638FC37; Sat, 27 Sep 2003 14:49:56 -0400 (EDT) Received: from garple.migus.org ([127.0.0.1]) by localhost (caster.migus.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 98954-04-2; Sat, 27 Sep 2003 14:49:56 -0400 (EDT) Received: from migus.org (ganyopa.migus.org [192.168.4.2]) by garple.migus.org (Postfix) with ESMTP id 2A5E48FC30; Sat, 27 Sep 2003 14:49:56 -0400 (EDT) Message-ID: <3F75DBD1.70600@migus.org> Date: Sat, 27 Sep 2003 14:49:53 -0400 From: Adam Migus Organization: Migus Dot Org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stefan Farfeleder References: <20030925092319.H5418@gamplex.bde.org> <49939.204.254.155.35.1064593320.squirrel@mail.migus.org> <20030927080420.N18558@gamplex.bde.org> <20030927105241.GG802@wombat.fafoe.narf.at> In-Reply-To: <20030927105241.GG802@wombat.fafoe.narf.at> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Sat, 27 Sep 2003 18:50:00 -0000 Stefan Farfeleder wrote: >On Sat, Sep 27, 2003 at 08:14:30AM +1000, Bruce Evans wrote: > > > >>Similarly with FOOBAR's contents identical with SMP's contents except >>for including FOO instead of GENERIC. So the bug must be related to >>the file being included ... adding an empty or comment line to the >>beginning of FOO works around it. I guess there is an off-by-1 byte >>or line error switching the input stream. >> >> > >The problem is simply that the input stream is switched immediately to >the included file after reading the file name and the parser is still >waiting for its newline or semicolon from the production > >Spec -> Config_spec SEMICOLON. > >Thus the terminal 'machine' on the first line is a syntax error. > >Stefan > > >------------------------------------------------------------------------ > >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 > > >------------------------------------------------------------------------ > Actually, while the error is not simply an "off-by-one" error, this patch is not sufficient to fix the nested case: Below is the output of running config (with or without this patch) on my set of kernels, one of which includes twice on the first line. This language specification, in fact, fails to handle an include, immediately followed by anything other than a blank line or comment. Thus the fix is a little more complicated. root@caster:ttyp1:conf# for _i in D* F* MAC* SMP*; do echo -n "${_i}:"; grep -n ^include "${_i}"; [ `grep -c ^include "${_i}"` -lt 1 ] && echo; /tmp/config "${_i}" >/dev/null 2>&1; [ $? -ne 0 ] && echo "error"; done DISKLESS:1:include GENERIC DISKLESS_FAST:1:include FAST DISKLESS_FAST_ULE:1:include FAST_ULE DISKLESS_MAC:2:include MAC DISKLESS_MAC_ULE:2:include MAC_ULE DISKLESS_SMP:3:include SMP DISKLESS_SMP_FAST:3:include SMP_FAST DISKLESS_SMP_FAST_ULE:3:include SMP_FAST_ULE DISKLESS_SMP_MAC:1:include SMP_MAC error DISKLESS_SMP_MAC_ULE:3:include SMP_MAC_ULE FAST: FAST_ULE: MAC: MAC_ULE: SMP:6:include GENERIC SMP_FAST:6:include FAST SMP_FAST_ULE:6:include FAST_ULE SMP_MAC:1:include MAC SMP_MAC_ULE:2:include MAC_ULE root@caster:ttyp1:conf#