Subject: kern/12298: fairly impressive cross-compilation bogon in sys/lib/libsa/tftp.c
To: None <gnats-bugs@gnats.netbsd.org>
From: None <cgd@netbsd.org>
List: netbsd-bugs
Date: 02/27/2001 16:12:48
>Number:         12298
>Category:       kern
>Synopsis:       fairly impressive cross-compilation bogon in sys/lib/libsa/tftp.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 27 16:13:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Chris Demetriou
>Release:        NetBSD-current as of today (2001-02-27)
>Organization:
>Environment:
mostly irrelevant.  What caused me to find the problem was
a cross-compile from a solaris host.
>Description:
sys/lib/libsa/tftp.c does:

#ifdef _STANDALONE
#include "/usr/include/arpa/tftp.h" /* XXX */
#else
#include <arpa/tftp.h>
#endif

given that the code is typically compiled with _STANDALONE, that
pulls in the host's /usr/include/arpa/tftp.h.

Who knows if the host actually _has_ one, let alone whether or not
it's correct for tftp.c's purpose.  (NetBSD and linux hosts seem to
arpa/tftp.h headers which are OK, but Solaris's arpa/tftp.h is
missing some critical definitions.)
>How-To-Repeat:
Cross compile from a solaris host?  (That's pretty hard to do,
but if you spend enough time at it you can do it.)
>Fix:
unknown what the right solution is.  can't just include <arpa/tftp.h>,
even if the cross-compiler is built properly (i.e., with complete
NetBSD includes, etc.), because the code is typically compiled with
-nostdinc.

Probably the closest solution is to provide the necessary definitions
in libsa (i.e., duplicate the information).
>Release-Note:
>Audit-Trail:
>Unformatted: