Date: Sat, 27 Sep 2003 14:49:53 -0400 From: Adam Migus <adam@migus.org> To: Stefan Farfeleder <stefan@fafoe.narf.at> Cc: arch@FreeBSD.org Subject: Re: sys/conf/DEFAULT[S] Message-ID: <3F75DBD1.70600@migus.org> In-Reply-To: <20030927105241.GG802@wombat.fafoe.narf.at> References: <XFMail.20030924170342.jhb@FreeBSD.org> <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>
next in thread | previous in thread | raw e-mail | index | archive | help
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#
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F75DBD1.70600>