NetBSD Problem Report #9112

Received: (qmail 23948 invoked from network); 3 Jan 2000 21:02:06 -0000
Message-Id: <200001032102.NAA21580@nbwww.isc.org>
Date: Mon, 3 Jan 2000 13:02:06 -0800 (PST)
From: bjh21@cam.ac.uk
Reply-To: bjh21@cam.ac.uk
To: gnats-bugs@gnats.netbsd.org
Subject: config(8) problems on non-NetBSD systems
X-Send-Pr-Version: www-1.0

>Number:         9112
>Category:       bin
>Synopsis:       config(8) problems on non-NetBSD systems
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 03 13:03:00 +0000 2000
>Closed-Date:    Sun Oct 08 11:34:41 +0000 2000
>Last-Modified:  Sun Oct 08 11:34:41 +0000 2000
>Originator:     Ben Harris
>Release:        1.4.1
>Organization:
University of Cambridge Computing Service
>Environment:
Linux wraith 2.2.12 #6 Tue Dec 7 17:14:36 GMT 1999 i686 unknown


>Description:
The mechanism for building config(8) on non-NetBSD systems has aged somewhat
relative to config(8) itself.  Specifically:

Not all systems define yydebug.
Not all systems provide major(), minor(), makedev() and NODEV, and those
  that do may disagree with NetBSD.
Makefile.boot mentions y.tab.* instead of gram.*.
Makefile.boot gratuitously defines strtoul as strtol, which breaks if you
  _have_ got strtol.

>How-To-Repeat:
cd src/usr.sbin/config
make -f Makefile.boot

>Fix:

diff -ur config/Makefile.boot config.hacked/Makefile.boot
--- config/Makefile.boot        Thu Nov  7 22:59:39 1996
+++ config.hacked/Makefile.boot Sat Jan  1 16:06:03 2000
@@ -9,7 +9,7 @@
 CFLAGS= -I. -DMAKE_BOOTSTRAP

 # Uncomment this if your system does not have strtoul (i.e. SunOS)
-STRTOUL= -Dstrtoul=strtol
+#STRTOUL= -Dstrtoul=strtol

 # Note: The scanner here uses features specific to "flex" so
 # do not bother even trying to make lex build the scanner.
@@ -20,16 +20,18 @@
 YACC=yacc

 OBJS=  files.o hash.o main.o mkheaders.o mkioconf.o mkmakefile.o \
-       mkswap.o pack.o sem.o util.o y.tab.o lex.yy.o strerror.o
+       mkswap.o pack.o sem.o util.o gram.o lex.yy.o strerror.o

 config: ${OBJS}
        ${CC} -o $@ ${OBJS}

-y.tab.o : y.tab.c
-       ${CC} ${CFLAGS} -c y.tab.c
+gram.o : gram.c
+       ${CC} ${CFLAGS} -c gram.c

-y.tab.c y.tab.h : gram.y
+gram.c gram.h : gram.y
        ${YACC} -d gram.y
+       mv -f y.tab.c gram.c
+       mv -f y.tab.h gram.h

 lex.yy.o : lex.yy.c
        ${CC} ${CFLAGS} ${STRTOUL} -c lex.yy.c
@@ -39,12 +41,12 @@

 ${OBJS} : config.h

-y.tab.o mkmakefile.o mkswap.o sem.o : sem.h
-lex.yy.o : y.tab.h
+gram.o mkmakefile.o mkswap.o sem.o : sem.h
+lex.yy.o : gram.h

 .c.o:
        ${CC} ${CFLAGS} -c $<

 clean:
-       rm -f *.o config lex.yy.c y.tab.[ch]
+       rm -f *.o config lex.yy.c y.tab.[ch] gram.[ch]

diff -ur config/config.h config.hacked/config.h
--- config/config.h     Thu Jan 21 13:10:08 1999
+++ config.hacked/config.h      Sat Jan  1 16:09:36 2000
@@ -74,6 +74,21 @@
 #ifndef _PATH_DEVNULL
 #define _PATH_DEVNULL "/dev/null"
 #endif
+#ifndef NODEV
+#define NODEV 0
+#endif
+#ifndef major
+#define        major(x)        ((int32_t)((((x) & 0x000fff00) >>  8)))
+#endif
+#ifndef minor
+#define        minor(x)        ((int32_t)((((x) & 0xfff00000) >> 12) | \
+                                  (((x) & 0x000000ff) >>  0)))
+#endif
+#ifndef makedev
+#define        makedev(x,y)    ((dev_t)((((x) <<  8) & 0x000fff00) | \
+                                (((y) << 12) & 0xfff00000) | \
+                                (((y) <<  0) & 0x000000ff)))
+#endif


 #define ARRCHR '#'
diff -ur config/main.c config.hacked/main.c
--- config/main.c       Mon Feb  8 22:32:58 1999
+++ config.hacked/main.c        Sat Jan  1 16:11:16 2000
@@ -71,7 +71,9 @@

 extern char *optarg;
 extern int optind;
+#ifndef MAKE_BOOTSTRAP
 extern int yydebug;
+#endif

 static struct hashtab *mkopttab;
 static struct nvlist **nextopt;
@@ -108,9 +110,11 @@
        while ((ch = getopt(argc, argv, "Dgpvb:s:")) != -1) {
                switch (ch) {

+#ifndef MAKE_BOOTSTRAP
                case 'D':
                        yydebug = 1;
                        break;
+#endif

                case 'g':
                        /*

>Release-Note:
>Audit-Trail:

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: bjh21@cam.ac.uk
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: bin/9112: config(8) problems on non-NetBSD systems 
Date: Wed, 05 Jan 2000 18:01:52 +0100

 bjh21@cam.ac.uk said:
 > Not all systems provide major(), minor(), makedev() and NODEV, and
 > those
 >   that do may disagree with NetBSD. 

 There is the problem that dev_t can be different on the host.
 It is defined in <sys/types.h> which we can hardly avoid to include.

 We'd probably have to avoid dev_t completely and use something
 like "netbsd_dev_t" within "config" to support cross-building.

 NODEV is -1 btw.

 best regards
 Matthias


State-Changed-From-To: open->closed 
State-Changed-By: bjh21 
State-Changed-When: Sun Oct 8 04:33:56 PDT 2000 
State-Changed-Why:  
Fix committed -- main.c rev 1.50. 
I'm the submitter, so no need for a feedback state. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.