pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/39804: net/mtftpd compilation problems (NetBSD 3.0) & weirdness (everywhere) (+FIX)

>Number:         39804
>Category:       pkg
>Synopsis:       net/mtftpd compilation problems (NetBSD 3.0) & weirdness 
>(everywhere) (+FIX)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 26 07:30:01 +0000 2008
>Originator:     Robert Elz
>Release:        NetBSD 4.0_STABLE  (pkgsrc current today)
        Prince of Songkla University
System: NetBSD 4.0_STABLE NetBSD 4.0_STABLE 
(JADE-1.696-20080517) #9: Fri May 23 18:55:13 ICT 2008 i386
Architecture: i386
Machine: i386
        net/mtftpd tries to be portable, but fails for old versions
        of NetBSd (ie: it assumes that all NetBSD's have proplib and
        the strl*() functions built in).   That's a trivial Makefile
        change to corrrect.

        Much weirder, net/mtftpd doesn't support IPv6 (pity, it should
        be easy, but that's neither the bug nor the weirdness), but
        requires a system with IPv6 installed and enabled (as in,
        USE_INET6=true or whatever is the current way) in order to
        compile, and what's more, even that works only on newer NetBSD
        (no idea about non-NetBSD systems).  That's the weirdness.

        The reason is that the code uses SOCK_DGRAM and PF_INET but
        nowhere directly includes <sys/socket.h>

        On newer NetBSD's (with IPv6 included) it all flukes to work,
        because net/mtftpd does include netinet/in.h and if IPv6
        is enabled, that includes netinet6/in6.h and on newer NetBSD's
        that one includes <sys/socket.h>

        On NetBSD 3 netinet6/in6.h doesn't include sys/socket.h
        so socket.h never gets included at all (that's the bug.)

        I use pkg_comp with NetBSD 3.0 release sets (and libkver)
        to simulate a NetBSD 3.0 enviroronment.

        Repeat that (or use genuine NetBSD 3 (anything up to a middling
        late 3.99 should suffice for this, not just 3.0) and expect
        to see (approximately) ...

PKG_COMP ==> Mounting sandboxed filesystems
PKG_COMP ==> Checking if pkg_install is up to date
PKG_COMP ==> Building and installing net/mtftpd
===> Binary install for mtftpd-20080229
=> Installing mtftpd-20080229 from /pkg_comp/packages/All
pkg_add: no pkg found for 'mtftpd-20080229', sorry.
pkg_add: 1 package addition failed
=> No binary package found for mtftpd-20080229; installing from source.
=> Bootstrap dependency digest>=20010302: found digest-20080510
=> Checksum SHA1 OK for mtftpd-20080229.tar.gz
=> Checksum RMD160 OK for mtftpd-20080229.tar.gz
===> Installing dependencies for mtftpd-20080229
=> Build dependency checkperms>=1.1: found checkperms-1.10
===> Overriding tools for mtftpd-20080229
===> Extracting for mtftpd-20080229
===> Patching for mtftpd-20080229
=> Applying pkgsrc patches for mtftpd-20080229
===> Creating toolchain wrappers for mtftpd-20080229
===> Configuring for mtftpd-20080229
=> Checking for portability problems in extracted files
===> Building for mtftpd-20080229
rm -f .gdbinit
touch .gdbinit
#   compile  mtftpd/mtftpd.o
cc -O2 -DPKG_SYSCONFDIR=\"/etc/conf\"   -Werror      -c    mtftpd.c
In file included from mtftpd.c:60:
conf.h:41:26: prop/proplib.h: No such file or directory
mtftpd.c: In function `mtftpd_listen':
mtftpd.c:158: error: `PF_INET' undeclared (first use in this function)
mtftpd.c:158: error: (Each undeclared identifier is reported only once
mtftpd.c:158: error: for each function it appears in.)
mtftpd.c:158: error: `SOCK_DGRAM' undeclared (first use in this function)
mtftpd.c:165: error: `AF_INET' undeclared (first use in this function)
*** Error code 1

make: stopped in /pkg_comp/obj/pkgsrc/net/mtftpd/default/mtftpd
*** Error code 1

make: stopped in /usr/pkgsrc/net/mtftpd
*** Error code 1

        Unpack the appended shar file in net/mtftpd
        It will create patches/patch-ab and patches/patch-ac

        "make distinfo" (after cvs add etc so the $NetBSD$ lines on the
        patches get expanded) and for me it all works (ie: compiles) on
        both NetBSD 3 and NetBSd 4 systems.

        patch-ab is the Makefile correction (and note: uses /etc/release
        to work out the NetBSD  version present, not uname -r, as the former
        tells what userland is installed, uname -r tells which kernel,
        and proplib etc depend upon userland, they don't magically appear
        because someone is running a new kernel).

        patch-ac is a crock ... that one adds an include of sys/socket.h
        to porting.h.   That's not really the right way (it works though.)
        Better would be to simply include sys/socket.h in the source files
        of the distributiobn (the ones that need it) and discard patch-ac
        (There's nothing non-portable about includiung sys/socket.h)
        Given the author/maintainer of this software, I suspect that's
        reasonable to expect to happen "upstream"...

        But I'm a lazy bastard, so I did it the easy way...

        ps: I'm not sure that a Makefile that ends .include ""
        counts as "portable software", but that's not my problem...

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
# This archive contains:
#       patches/patch-ab
#       patches/patch-ac
echo x - patches/patch-ab
sed 's/^X//' >patches/patch-ab << 'END-of-patches/patch-ab'
X--- Makefile.ORIG      2008-03-01 01:25:59.000000000 +0700
X+++ Makefile   2008-10-26 13:26:28.000000000 +0700
X@@ -8,6 +8,12 @@
X OPSYS!= uname -s
X .if ${OPSYS} == "NetBSD"
X+OPREL!= test -f /etc/release && sed -e 's/ /_/' -e 1q /etc/release || echo 
X+OPREL= who_cares
X+.if ${OPSYS} == "NetBSD" && ${OPREL:MNetBSD_[0123]*} == ""
X LDADD+=       -lprop
X .else
X CFLAGS+= -Idist/include
echo x - patches/patch-ac
sed 's/^X//' >patches/patch-ac << 'END-of-patches/patch-ac'
X--- porting.h_ORIG     2008-03-01 01:25:59.000000000 +0700
X+++ porting.h  2008-10-26 13:19:14.000000000 +0700
X@@ -36,6 +36,7 @@
X #include <sys/cdefs.h>
X+#include <sys/socket.h>
X #ifndef __RCSID
X #define __RCSID(__s)  static const char *__rcsid = (__s)

Home | Main Index | Thread Index | Old Index