Subject: bin/26030: sbin/pfctl's pfctl_parser.o won't compile
To: None <gnats-bugs@gnats.NetBSD.org>
From: Chris Ross <cross+netbsd@distal.com>
List: netbsd-bugs
Date: 06/23/2004 16:26:11
>Number:         26030
>Category:       bin
>Synopsis:       sbin/pfctl's pfctl_parser won't compile: printf() type/arg mismatch
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 23 20:28:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Chris Ross
>Release:        NetBSD 2.0F  (current)
>Organization:
>Environment:
System: NetBSD xxxxxx 2.0F NetBSD 2.0F (GENERIC.MP) #1: Wed Jun 16 00:56:21 EDT 2004 cross@xxxxxx:/data/NetBSD/src/sys/arch/i386/compile/GENERIC.MP i386
Architecture: i386
Machine: i386
>Description:
	I get a warning when compiling pfctl_parser.o:

--- pfctl_parser.o ---
#   compile  pfctl/pfctl_parser.o
/data/obj.sparc64/data/NetBSD/src/tooldir.NetBSD-2.0F-i386/bin/sparc64--netbsd-gcc -O2  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-traditional -Wno-uninitialized  -Werror   -I/data/NetBSD/src/dist/pf/sbin/pfctl  -nostdinc -isystem /data/obj.sparc64/data/NetBSD/src/destdir.sparc64/usr/include  -c    /data/NetBSD/src/dist/pf/sbin/pfctl/pfctl_parser.c
/data/NetBSD/src/dist/pf/sbin/pfctl/pfctl_parser.c: In function `print_status':
/data/NetBSD/src/dist/pf/sbin/pfctl/pfctl_parser.c:596: warning: long long int format, long unsigned int arg (arg 3)
*** [pfctl_parser.o] Error code 1
1 error


  I'm not sure why this is fatal, but it kills the build.  Looking at
line 596, there is not a cast as there are on the similar lines 583
and 607.

>How-To-Repeat:
	Try to build the tree, including sbin/pfctl.
>Fix:
	Apply the following patch:

Index: dist/pf/sbin/pfctl/pfctl_parser.c
===================================================================
RCS file: /cvsroot/src/dist/pf/sbin/pfctl/pfctl_parser.c,v
retrieving revision 1.2
diff -u -r1.2 pfctl_parser.c
--- dist/pf/sbin/pfctl/pfctl_parser.c	22 Jun 2004 15:16:30 -0000	1.2
+++ dist/pf/sbin/pfctl/pfctl_parser.c	23 Jun 2004 20:25:50 -0000
@@ -592,8 +592,8 @@
 		printf("  %-25s %14u %14s\n", "current entries",
 		    s->src_nodes, "");
 		for (i = 0; i < SCNT_MAX; i++) {
-			printf("  %-25s %14lld ", pf_scounters[i],
-				    s->scounters[i]);
+			printf("  %-25s %14llu ", pf_scounters[i],
+			    (unsigned long long)s->scounters[i]);
 			if (runtime > 0)
 				printf("%14.1f/s\n",
 				    (double)s->scounters[i] / (double)runtime);
>Release-Note:
>Audit-Trail:
>Unformatted: