Subject: Re: tried to compile -current...
To: None <blymn@baesystems.com.au>
From: Havard Eidnes <he@netbsd.org>
List: current-users
Date: 04/21/2005 13:13:44
----Next_Part(Thu_Apr_21_13_13_44_2005_842)--
Content-Type: Text/Plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

> > *** Failed target:  veriexecctl_conf.d
> > *** Failed command: =

> > CC=3D/usr/src/obj.i386/tooldir.NetBSD-3.99.3-i386/bin/i386--netbsde=
lf-gcc =

> > /usr/src/obj.i386/tooldir.NetBSD-3.99.3-i386/bin/nbmkdep -f =

> > veriexecctl_conf.d -- -I. -nostdinc -isystem =

> > /usr/src/obj.i386/destdir.i386/usr/include veriexecctl_conf.c
> > *** Error code 1
>
> Hmmm that does not make much sense.  Can you try to cd into
> /usr/src/sbin/veriexecctl and do a "make cleandir; make" and see what=

> you get?

This is because you have -I. and not -I${.CURDIR} in Makefile,
and with obj dirs this is the problem you hit.

After fixing that, I stumble on a surprisingly large number of compile
errors (when building for evbsh5, which was were I was in my cycle of
rebuilds).  Warnings about ctype function arguments or array indices
being signed char (possibly two aspects of the same thing), a warning
about printing a size_t with %u (should be %zu), and several
"declaration shadows global declaration" errors.  Attached below is
the patch I cooked up to make it build again.

Regards,

- H=E5vard

----Next_Part(Thu_Apr_21_13_13_44_2005_842)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename=diff

Index: Makefile
===================================================================
RCS file: /usr/users/he/nbcvs/netbsd/src/sbin/veriexecctl/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile	20 Apr 2005 13:44:45 -0000	1.5
+++ Makefile	21 Apr 2005 10:53:52 -0000
@@ -5,7 +5,7 @@
 SRCS=	veriexecctl_parse.y veriexecctl_conf.l veriexecctl.c
 
 YHEADER=	1
-CPPFLAGS+=	-I.
+CPPFLAGS+=	-I${.CURDIR}
 DPADD+=		${LIBL}
 LDADD+=		-ll
 
Index: veriexecctl.c
===================================================================
RCS file: /usr/users/he/nbcvs/netbsd/src/sbin/veriexecctl/veriexecctl.c,v
retrieving revision 1.6
diff -u -r1.6 veriexecctl.c
--- veriexecctl.c	20 Apr 2005 13:44:45 -0000	1.6
+++ veriexecctl.c	21 Apr 2005 11:05:12 -0000
@@ -53,25 +53,25 @@
 
 extern struct veriexec_params params; /* in veriexecctl_parse.y */
 extern char *filename; /* in veriexecctl_conf.l */
-int fd, verbose = 0, no_mem = 0, phase;
+int gfd, verbose = 0, no_mem = 0, phase;
 unsigned line;
 
 /*
  * Prototypes
  */
-int
-fingerprint_load(char *infile);
+int fingerprint_load(char*);
+
 
 FILE *
 openlock(const char *path)
 {
-	int fd;
+	int lfd;
 
-	fd = open(path, O_RDONLY|O_EXLOCK, 0);
-	if (fd < 0)
+	lfd = open(path, O_RDONLY|O_EXLOCK, 0);
+	if (lfd < 0)
 		return (NULL);
 
-	return (fdopen(fd, "r"));
+	return (fdopen(lfd, "r"));
 }
 
 struct vexec_up *
@@ -116,7 +116,7 @@
 
 		vup = CIRCLEQ_FIRST(&params_list);
 
-		if (ioctl(fd, VERIEXEC_TABLESIZE, &(vup->vu_param)) < 0) {
+		if (ioctl(gfd, VERIEXEC_TABLESIZE, &(vup->vu_param)) < 0) {
 			(void) fprintf(stderr, "Error in phase 1: Can't "
 			    "set hash table size for device %d: %s.\n",
 			    vup->vu_param.dev, strerror(errno));
@@ -126,7 +126,7 @@
 
 		if (verbose) {
 			printf(" => Hash table sizing successful for device "
-			    "%d. (%u entries)\n", vup->vu_param.dev,
+			    "%d. (%zu entries)\n", vup->vu_param.dev,
 			    vup->vu_param.hash_size);
 		}
 
@@ -139,12 +139,12 @@
 
 /*
  * Load the fingerprint. Assumes that the fingerprint pseudo-device is
- * opened and the file handle is in fd.
+ * opened and the file handle is in gfd.
  */
 void
 phase2_load(void)
 {
-	if (ioctl(fd, VERIEXEC_LOAD, &params) < 0) {
+	if (ioctl(gfd, VERIEXEC_LOAD, &params) < 0) {
 		(void) fprintf(stderr, "%s: %s\n", params.file,
 			       strerror(errno));
 	}
@@ -155,12 +155,12 @@
  * Fingerprint load handling.
  */
 int
-fingerprint_load(char *infile)
+fingerprint_load(char *ifile)
 {
 	CIRCLEQ_INIT(&params_list);
 
-	if ((yyin = openlock(infile)) == NULL) {
-		err(1, "Failed to open %s", infile);
+	if ((yyin = openlock(ifile)) == NULL) {
+		err(1, "Failed to open %s", ifile);
 	}
 
 	/*
@@ -172,7 +172,7 @@
 
 	if (verbose) {
 		(void) fprintf(stderr, "Phase 1: Building hash table information:\n");
-		(void) fprintf(stderr, "=> Parsing \"%s\"\n", infile);
+		(void) fprintf(stderr, "=> Parsing \"%s\"\n", ifile);
 	}
 
 	yyparse();
@@ -191,7 +191,7 @@
 	if (verbose) {
 		(void) fprintf(stderr, "Phase 2: Loading per-file "
 			       "fingerprints.\n");
-		(void) fprintf(stderr, "=> Parsing \"%s\"\n", infile);
+		(void) fprintf(stderr, "=> Parsing \"%s\"\n", ifile);
 	}
 
 	yyparse();
@@ -227,8 +227,8 @@
 	argc -= optind;
 	argv += optind;
 
-	fd = open(VERIEXEC_DEVICE, O_RDWR, 0);
-	if (fd == -1) {
+	gfd = open(VERIEXEC_DEVICE, O_RDWR, 0);
+	if (gfd == -1) {
 		err(1, "Failed to open pseudo-device");
 	}
 
@@ -246,7 +246,7 @@
 			exit(1);
 		}
 		
-		if (ioctl(fd, VERIEXEC_FINGERPRINTS, &report) == 0) {
+		if (ioctl(gfd, VERIEXEC_FINGERPRINTS, &report) == 0) {
 			if (size != report.size) {
 				if (verbose)
 					fprintf(stderr, "fingerprints: "
@@ -262,7 +262,7 @@
 						"realloc failed\n");
 					exit(1);
 				}
-				if (ioctl(fd, VERIEXEC_FINGERPRINTS,
+				if (ioctl(gfd, VERIEXEC_FINGERPRINTS,
 					  &report) < 0) {
 					fprintf(stderr,
 						"fingerprints ioctl: %s\n",
@@ -282,6 +282,6 @@
 		usage(1);
 	}
 
-	(void) close(fd);
+	(void) close(gfd);
 	return (0);
 }
Index: veriexecctl.h
===================================================================
RCS file: /usr/users/he/nbcvs/netbsd/src/sbin/veriexecctl/veriexecctl.h,v
retrieving revision 1.1
diff -u -r1.1 veriexecctl.h
--- veriexecctl.h	21 Apr 2005 00:27:35 -0000	1.1
+++ veriexecctl.h	21 Apr 2005 10:59:17 -0000
@@ -39,7 +39,7 @@
         CIRCLEQ_ENTRY(vexec_up) vu_list;
 };
 
-extern int fd, no_mem, phase, verbose;
+extern int gfd, no_mem, phase, verbose;
 extern unsigned line;
 extern char *infile;
 extern FILE *yyin;
@@ -53,6 +53,6 @@
 struct vexec_up *dev_add(dev_t);
 int phase1_preload(void);
 void phase2_load(void);
-int convert(char *, u_char *);
+int convert(u_char *, u_char *);
 
 #endif /* _VEXECCTL_H_ */
Index: veriexecctl_parse.y
===================================================================
RCS file: /usr/users/he/nbcvs/netbsd/src/sbin/veriexecctl/veriexecctl_parse.y,v
retrieving revision 1.5
diff -u -r1.5 veriexecctl_parse.y
--- veriexecctl_parse.y	20 Apr 2005 13:44:45 -0000	1.5
+++ veriexecctl_parse.y	21 Apr 2005 10:54:43 -0000
@@ -197,7 +197,7 @@
  * by "out".  Returns the number of bytes converted or -1 if the conversion
  * fails.
  */
-int convert(char *fp, u_char *out) {
+int convert(u_char *fp, u_char *out) {
         int i, value, error, count;
 
 	count = strlen(fp);

----Next_Part(Thu_Apr_21_13_13_44_2005_842)----