Subject: pkg/18237: lsof compile failure on 1.6-current
To: None <gnats-bugs@gnats.netbsd.org>
From: None <roskens@elfin.net>
List: netbsd-bugs
Date: 09/08/2002 21:06:29
>Number:         18237
>Category:       pkg
>Synopsis:       lsof compile failure on 1.6-current
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 08 19:07:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        NetBSD 1.6G 2002/09/07 & pkgsrc-2002/09/07
>Organization:
>Environment:
System: NetBSD apt 1.6G NetBSD 1.6G (GENERIC-$Revision: 1.500 $) #6: Thu Sep  5 20:04:48 CDT 2002     root@apt:/usr/src/sys/arch/i386/compile/APT i386
Architecture: i386
Machine: i386
>Description:

Compile error for sysutils/lsof when compiling under 1.6-current.

===> Building for lsof-4.64
(cd lib; make DEBUG="-O" CFGF="-DNETBSDV=1060 -DHASGETBOOTFILE -DHASNFSPROTO -DHASIPv6 -DHASFDESCFS=1 -DHASFDLINK -DHASNULLFS -DHASPROCFS -DHAS9660FS -DHASMSDOSFS -DHASKERNFS -DHASNCVPID -DHASI_FFS -DHASEXT2FS -DHASI_E2FS -DHASNFSVATTRP -DUVM -I/usr/pkgsrc/sysutils/lsof/work/lsof_4.64/lsof_4.64_src/dialects/n+obsd/include -DHAS_UVM_INCL -DHAS_ADVLOCK_ARGS -DHASCWDINFO -DHAS_SYS_PIPEH -DLSOF_VSTR=\"1.6G\"")
cc -O2  -DNETBSDV=1060 -DHASGETBOOTFILE -DHASNFSPROTO -DHASIPv6 -DHASFDESCFS=1 -DHASFDLINK -DHASNULLFS -DHASPROCFS -DHAS9660FS -DHASMSDOSFS -DHASKERNFS -DHASNCVPID -DHASI_FFS -DHASEXT2FS -DHASI_E2FS -DHASNFSVATTRP -DUVM -I/usr/pkgsrc/sysutils/lsof/work/lsof_4.64/lsof_4.64_src/dialects/n+obsd/include -DHAS_UVM_INCL -DHAS_ADVLOCK_ARGS -DHASCWDINFO -DHAS_SYS_PIPEH -DLSOF_VSTR="1.6G" -I/usr/include -I/sys -O  -DLSOF_MORE_SECURE=0  -c ckkv.c
cc -O2  -DNETBSDV=1060 -DHASGETBOOTFILE -DHASNFSPROTO -DHASIPv6 -DHASFDESCFS=1 -DHASFDLINK -DHASNULLFS -DHASPROCFS -DHAS9660FS -DHASMSDOSFS -DHASKERNFS -DHASNCVPID -DHASI_FFS -DHASEXT2FS -DHASI_E2FS -DHASNFSVATTRP -DUVM -I/usr/pkgsrc/sysutils/lsof/work/lsof_4.64/lsof_4.64_src/dialects/n+obsd/include -DHAS_UVM_INCL -DHAS_ADVLOCK_ARGS -DHASCWDINFO -DHAS_SYS_PIPEH -DLSOF_VSTR="1.6G" -I/usr/include -I/sys -O  -DLSOF_MORE_SECURE=0  -c cvfs.c
cc -O2  -DNETBSDV=1060 -DHASGETBOOTFILE -DHASNFSPROTO -DHASIPv6 -DHASFDESCFS=1 -DHASFDLINK -DHASNULLFS -DHASPROCFS -DHAS9660FS -DHASMSDOSFS -DHASKERNFS -DHASNCVPID -DHASI_FFS -DHASEXT2FS -DHASI_E2FS -DHASNFSVATTRP -DUVM -I/usr/pkgsrc/sysutils/lsof/work/lsof_4.64/lsof_4.64_src/dialects/n+obsd/include -DHAS_UVM_INCL -DHAS_ADVLOCK_ARGS -DHASCWDINFO -DHAS_SYS_PIPEH -DLSOF_VSTR="1.6G" -I/usr/include -I/sys -O  -DLSOF_MORE_SECURE=0  -c dvch.c
In file included from ../dlsof.h:182,
                 from ../lsof.h:172,
                 from dvch.c:43:
/usr/include/ufs/mfs/mfsnode.h:47: field `mfs_buflist' has incomplete type
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/sysutils/lsof/work/lsof_4.64/lsof_4.64_src/lib
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/sysutils/lsof/work/lsof_4.64/lsof_4.64_src
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/sysutils/lsof
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/sysutils/lsof

>How-To-Repeat:
	# cd pkgsrc/sysutils/lsof
	# make
>Fix:
After the 1.6 branch, a change was made to -current ufs/mfs/mfsnode.h where mfs_buflist was changed to a struct bufq_state.
struct bufq_state is only defined in sys/buf.h when _KERNEL is defined. The 1.6 release does not need _KERNEL defined.

Since using NETBSDV is based on the release version, we need to use __NetBSD_Version__ to test for the 1.6-current branch.
The change to mfsnode.h was made on 2002/07/19, which was between 1.6E and 1.6F, I chose to use 1.6F as the base for the
test against __NetBSD_Version__.

For 1.6-current, this means modifying sysutils/lsof/patches/patch-ab:

==== BEGIN ====
--- dialects/n+obsd/dlsof.h.orig        Mon Jun 17 01:44:15 2002
+++ dialects/n+obsd/dlsof.h     Sun Sep  8 20:06:45 2002
@@ -54,7 +54,14 @@
 #include <sys/mbuf.h>
 
 # if   defined(NETBSDV)
+#  if  __NetBSD_Version__>=106060000
+#define        _KERNEL
+struct buf;    /* to satisfy a function prototype in buf.h */
+#  endif
 #include <sys/buf.h>
+#  if  __NetBSD_Version__>=106060000
+#undef _KERNEL
+#  endif
 # endif        /* defined(NETBSDV) */
 
 #define        NFS
@@ -209,9 +216,9 @@
 
 # if   defined(HASNULLFS)
 #define        _KERNEL
-#  if  defined(NETBSDV) && NETBSDV>=1060
+#  if  defined(NETBSDV) && NETBSDV>=1050
 #include "netexport.h"
-#  endif       /* defined(NETBSDV) && NETBSDV>=1060 */
+#  endif       /* defined(NETBSDV) && NETBSDV>=1050 */
 #include <miscfs/nullfs/null.h>
 #undef _KERNEL
 # endif        /* defined(HASNULLFS) */
==== END ====
>Release-Note:
>Audit-Trail:
>Unformatted: