On Tue, 24 Feb 2015, Tom G. Christensen wrote:> I've switched to HEAD in the git repo and it now builds on Solaris > 2.6, 7, 8 and 9 but the testsuite still cannot be built due to the > missing <err.h>. > > I noticed one of the changes was about HOST_NAME_MAX but I don't > think that change addresses the real issue on at least these old > Solaris systems. It looks to me like the fall back in defines.h > was not activated because Solaris has MAXHOSTNAMELEN in <netdb.h> > which has not been included when defines.h tries to find a fall back > HOST_NAME_MAX. > > Looking at sshd.c with gcc -dD -E confirms it as defines.h now set > HOST_NAME_MAX to 255 and later <netdb.h> is included which then > defines MAXHOSTNAMELEN to 256. > > I don't know if it would be reasonable to include <netdb.h> > from includes.h but that would make HOST_NAME_MAX fall back to > MAXHOSTNAMELEN on at least Solaris < 10.I guess we could do this: diff --git includes.h includes.h index c3034e3..ec74998 100644 --- includes.h +++ includes.h @@ -171,6 +171,8 @@ #include <openssl/opensslv.h> /* For OPENSSL_VERSION_NUMBER */ #endif +#include <netdb.h> /* For MAXHOSTNAMELEN */ + #include "defines.h" #include "platform.h"
On 24/02/15 20:20, Damien Miller wrote:> On Tue, 24 Feb 2015, Tom G. Christensen wrote: >> I don't know if it would be reasonable to include <netdb.h> >> from includes.h but that would make HOST_NAME_MAX fall back to >> MAXHOSTNAMELEN on at least Solaris < 10. > > I guess we could do this: > > diff --git includes.h includes.h > index c3034e3..ec74998 100644 > --- includes.h > +++ includes.h > @@ -171,6 +171,8 @@ > #include <openssl/opensslv.h> /* For OPENSSL_VERSION_NUMBER */ > #endif > > +#include <netdb.h> /* For MAXHOSTNAMELEN */ > + > #include "defines.h" > > #include "platform.h" >Exactly. I tested such a change on Solaris 2.6 and it builds and HOST_NAME_MAX falls back to MAXHOSTNAMELEN. I also had a quick look at a Solaris 10 host and it has _POSIX_HOST_NAME_MAX in <limits.h> which is already included. -tgc
On Wed, 25 Feb 2015, Damien Miller wrote: | On Tue, 24 Feb 2015, Tom G. Christensen wrote: | | > I've switched to HEAD in the git repo and it now builds on Solaris | > 2.6, 7, 8 and 9 but the testsuite still cannot be built due to the | > missing <err.h>. The err.h issue is fixes but there still msghdr structure differences to deal with. [more below] | > I noticed one of the changes was about HOST_NAME_MAX but I don't | > think that change addresses the real issue on at least these old | > Solaris systems. It looks to me like the fall back in defines.h | > was not activated because Solaris has MAXHOSTNAMELEN in <netdb.h> | > which has not been included when defines.h tries to find a fall back | > HOST_NAME_MAX. | > | > Looking at sshd.c with gcc -dD -E confirms it as defines.h now set | > HOST_NAME_MAX to 255 and later <netdb.h> is included which then | > defines MAXHOSTNAMELEN to 256. | > | > I don't know if it would be reasonable to include <netdb.h> | > from includes.h but that would make HOST_NAME_MAX fall back to | > MAXHOSTNAMELEN on at least Solaris < 10. | | I guess we could do this: | | diff --git includes.h includes.h | index c3034e3..ec74998 100644 | --- includes.h | +++ includes.h | @@ -171,6 +171,8 @@ | #include <openssl/opensslv.h> /* For OPENSSL_VERSION_NUMBER */ | #endif | | +#include <netdb.h> /* For MAXHOSTNAMELEN */ | + | #include "defines.h" | | #include "platform.h" | _______________________________________________ I should have spotted that netdb.h was not included yet Perhaps ..... --- defines.h.old 2015-02-23 21:35:19.098756406 -0800 +++ defines.h 2015-02-24 12:22:24.916077846 -0800 @@ -108,10 +108,9 @@ #ifndef HOST_NAME_MAX # if defined(_POSIX_HOST_NAME_MAX) # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX -# elif defined(MAXHOSTNAMELEN) +# elif defined(HAVE_NETDB_H) +# include <netdb.h> # define HOST_NAME_MAX MAXHOSTNAMELEN -# else -# define HOST_NAME_MAX 255 # endif #endif /* HOST_NAME_MAX */ ..... -- Tim Rice Multitalents (707) 456-1146 tim at multitalents.net
On Tue, 24 Feb 2015, Tim Rice wrote:> I should have spotted that netdb.h was not included yet > Perhaps > ..... > --- defines.h.old 2015-02-23 21:35:19.098756406 -0800 > +++ defines.h 2015-02-24 12:22:24.916077846 -0800 > @@ -108,10 +108,9 @@ > #ifndef HOST_NAME_MAX > # if defined(_POSIX_HOST_NAME_MAX) > # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX > -# elif defined(MAXHOSTNAMELEN) > +# elif defined(HAVE_NETDB_H) > +# include <netdb.h>I don't think there is any need for "elif defined(HAVE_NETDB_H)" since we unconditionally include netdb.h in a few places already. diff --git defines.h defines.h index d99ef68..b7dd1d9 100644 --- defines.h +++ defines.h @@ -106,6 +106,7 @@ enum #endif /* MAXPATHLEN */ #ifndef HOST_NAME_MAX +# include "netdb.h" /* for MAXHOSTNAMELEN */ # if defined(_POSIX_HOST_NAME_MAX) # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX # elif defined(MAXHOSTNAMELEN) diff --git includes.h includes.h index c3034e3..2893a54 100644 --- includes.h +++ includes.h @@ -27,7 +27,7 @@ #include <sys/socket.h> /* For CMSG_* */ #ifdef HAVE_LIMITS_H -# include <limits.h> /* For PATH_MAX */ +# include <limits.h> /* For PATH_MAX, _POSIX_HOST_NAME_MAX */ #endif #ifdef HAVE_BSTRING_H # include <bstring.h>
On 24/02/15 21:56, Tim Rice wrote:> On Wed, 25 Feb 2015, Damien Miller wrote: > > | On Tue, 24 Feb 2015, Tom G. Christensen wrote: > | > | > I've switched to HEAD in the git repo and it now builds on Solaris > | > 2.6, 7, 8 and 9 but the testsuite still cannot be built due to the > | > missing <err.h>. > > The err.h issue is fixes but there still msghdr structure differences > to deal with. >Yes I saw that later. The testsuite build fails on Solaris 2.6 thusly: regress/netcat.c: In function 'timeout_connect': regress/netcat.c:703: warning: passing argument 2 of 'connect' discards qualifiers from pointer target type regress/netcat.c:709: warning: passing argument 4 of 'getsockopt' from incompatible pointer type regress/netcat.c: In function 'local_listen': regress/netcat.c:735: warning: unused variable 'x' regress/netcat.c:735: warning: unused variable 'ret' regress/netcat.c: In function 'fdpass': regress/netcat.c:1037: error: 'struct msghdr' has no member named 'msg_control' regress/netcat.c:1038: error: 'struct msghdr' has no member named 'msg_controllen' regress/netcat.c:1039: error: 'struct msghdr' has no member named 'msg_controllen' regress/netcat.c:1039: error: 'struct msghdr' has no member named 'msg_control' regress/netcat.c: In function 'set_common_sockopts': regress/netcat.c:1196: warning: passing argument 4 of 'setsockopt' from incompatible pointer type regress/netcat.c:1201: warning: passing argument 4 of 'setsockopt' from incompatible pointer type regress/netcat.c:1206: warning: passing argument 4 of 'setsockopt' from incompatible pointer type regress/netcat.c:1211: warning: passing argument 4 of 'setsockopt' from incompatible pointer type regress/netcat.c: In function 'decode_addrport': regress/netcat.c:1419: warning: comparison between signed and unsigned make: *** [regress/netcat] Error 1 I guess that is what you meant about structure differences. It looks like on Solaris I can choose between msg_accrights* or msg_control*/msg_flags in struct msghdr. The latter requires _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED which will also require __EXTENSIONS__ or other useful things suddenly go away. Building openssh with CC="gcc -D__EXTENSIONS__ -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED" is possible (tested only on Solaris 9 so far). Unfortunately now that I can finally run the testsuite I see ssh-keygen dumps core in keygen-change.sh but all tests before that passes. $ gdb ssh-keygen GNU gdb (GDB) 7.8 ... Reading symbols from ssh-keygen...done. (gdb) core regress/core [New LWP 1] Core was generated by `/export/home/tgc/buildpkg/openssh/src/openssh-git/ssh-keygen -p -P secret1 -N 2'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0xfedb4b14 in strlen () from /usr/lib/libc.so.1 (gdb) bt #0 0xfedb4b14 in strlen () from /usr/lib/libc.so.1 #1 0xfee07a20 in _doprnt () from /usr/lib/libc.so.1 #2 0xfee095e0 in printf () from /usr/lib/libc.so.1 #3 0x000546b0 in do_change_passphrase (pw=pw at entry=0x92954) at ssh-keygen.c:1279 #4 0x00059420 in main (argc=0, argv=0xffbfe664) at ssh-keygen.c:2530 (gdb) fram 3 #3 0x000546b0 in do_change_passphrase (pw=pw at entry=0x92954) at ssh-keygen.c:1279 1279 printf("Key has comment '%s'\n", comment); (gdb) print comment $1 = 0x0 (gdb) I've not had time to look into this further and also I've not verified if this happens without setting CC. -tgc