Subject: Re: toolchain/30903: config(8) fails with nested includes
To: None <cube@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Quentin Garnier <cube@cubidou.net>
List: netbsd-bugs
Date: 08/18/2005 21:26:02
The following reply was made to PR toolchain/30903; it has been noted by GNATS.
From: Quentin Garnier <cube@cubidou.net>
To: gnats-bugs@netbsd.org
Cc: apb@cequrux.com
Subject: Re: toolchain/30903: config(8) fails with nested includes
Date: Thu, 18 Aug 2005 23:22:20 +0200
--9crTWz/Z+Zyzu20v
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, Aug 03, 2005 at 12:58:00PM +0000, apb@cequrux.com wrote:
> >Number: 30903
> >Category: toolchain
> >Synopsis: config(8) fails with nested includes
> >Confidential: no
> >Severity: non-critical
> >Priority: medium
> >Responsible: toolchain-manager
> >State: open
> >Class: sw-bug
> >Submitter-Id: net
> >Arrival-Date: Wed Aug 03 12:58:00 +0000 2005
> >Originator: Alan Barrett
> >Release: NetBSD 3.99.7
> >Organization:
> Not much
> >Environment:
> System: NetBSD 3.99.7
> Architecture: i386
> Machine: i386
> >Description:
> Kernel configuration files with two levels of includes
> cause config(8) to fail.
>=20
> >How-To-Repeat:
> $ cd /usr/src/sys/arch/i386/conf
> $ echo 'include "arch/i386/conf/GENERIC"' >GENERIC-INC
> $ echo 'include "arch/i386/conf/GENERIC-INC"' >GENERIC-INC-INC
> $ config GENERIC # works
> Build directory is ../compile/GENERIC
> Don't forget to run "make depend"
> $ config GENERIC-INC # works
> Build directory is ../compile/GENERIC-INC
> Don't forget to run "make depend"
> $ config GENERIC-INC-INC # gives the following error
> ../../../../arch/i386/conf/GENERIC-INC:1: syntax error
> ../../../../arch/i386/conf/GENERIC-INC:1: cannot proceed without machine =
specifier
>=20
> >Fix:
Could you try that patch?
http://taryn.cubidou.net/~cube/netbsd/30903.diff
It survived my limited testing, but if you could find some weird fucked
up cases it would be great :)
Index: gram.y
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /rep/NetBSD-src/cvs/src/usr.bin/config/gram.y,v
retrieving revision 1.1
diff -u -r1.1 gram.y
--- gram.y 2005/06/05 18:19:53 1.1
+++ gram.y 2005/08/18 21:16:07
@@ -181,7 +181,7 @@
topthing:
SOURCE filename '\n' { if (!srcdir) srcdir =3D $2; } |
BUILD filename '\n' { if (!builddir) builddir =3D $2; } |
- include '\n' |
+ include |
'\n';
=20
machine_spec:
@@ -253,8 +253,8 @@
/* empty */ { $$ =3D NULL; };
=20
include:
- INCLUDE filename { (void) include($2, 0, 0, 1); } |
- CINCLUDE filename { (void) include($2, 0, 1, 1); };
+ INCLUDE filename '\n' { (void) include($2, 0, 0, 1); } |
+ CINCLUDE filename '\n' { (void) include($2, 0, 1, 1); };
=20
package:
PACKAGE filename { package($2); };
@@ -272,15 +272,18 @@
/* empty */;
=20
dev_def:
- one_def '\n' { adepth =3D 0; } |
+ inc_one_def { adepth =3D 0; } |
'\n' |
error '\n' { cleanup(); };
=20
+inc_one_def:
+ include |
+ one_def '\n';
+
one_def:
file |
object |
device_major { do_devsw =3D 1; } |
- include |
package |
prefix |
DEVCLASS WORD { (void)defattr($2, NULL, NULL, 1); } |
@@ -438,12 +441,16 @@
/* empty */;
=20
spec:
- config_spec '\n' { adepth =3D 0; } |
+ inc_config_spec { adepth =3D 0; } |
'\n' |
error '\n' { cleanup(); };
=20
+inc_config_spec:
+ one_def '\n' |
+ include |
+ config_spec '\n';
+
config_spec:
- one_def |
NO FILE_SYSTEM no_fs_list |
FILE_SYSTEM fs_list |
NO MAKEOPTIONS no_mkopt_list |
--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.
--9crTWz/Z+Zyzu20v
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)
iQEVAwUBQwT8DNgoQloHrPnoAQKZcwf+ILSZoNWhCUvwzbpjJx5kfe9KRbWg+hq+
lrr7/cUi9DcOwolKzrK96157a1+o0x/2qLI7vIjjherOBRNIgdxME5H3utI5so6l
A6fo4+XJBgKgPUbJaYhzrCgR/lg6zOppOftUtE/5yYdMUAZaWUBQhQxjowxN8i3v
CadPfBhT+zTU+DRbnu2sW3hkdvoCKeNqVMnTs0PIqaabjbamtT+31U7qbfxoEazG
Dak4BtHB9/VnwWrGWLx53dtJC9GnQuEWXO/ALX0TJqRYGLpsTUqckeOboAa5JwL1
KXOzPOkC2AXunS4eMJ53DSD87uSzKz/6XLP0ciLlwo8rwmlg/5ViVg==
=goCQ
-----END PGP SIGNATURE-----
--9crTWz/Z+Zyzu20v--