Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: test for network libraries (for test only)/problems with name resolution



A short time ago, at a computer terminal far, far away, Andrej Borsenkow wrote:
>As I got no reply, if it really fixed the bug it was supposed to, I was about
>to renounce this one. But somebody (Peter?) silently committed it (without
>ChangeLog) :-)
>
>I would really prefer to leave it out for a while. So far there was a single
>complaint and no responce if it works now, but this patch broke too much here.
>
>If anybody else complaints we can return to it.

Sorry I wasn't around sooner; I just yesterday got around to updating my
3.1.6 with 3.1.9. :)

I tried the patch, and it works okay for inet_aton and inet_pton, but still
complains about gethostbyname2, configure having not found it (#undef
HAVE_GETHOSTBYNAME2 in config.h).  This is under Solaris 2.7, with C5.0.

Looking at libresolv (on 2.7 as well as 2.8), it looks to me like the
problem is that it's defined in the headers (netdb.h), but isn't actually
available in the libraries.

On 2.7, libresolv includes:
   [141]   |     55276|     400|FUNC |LOCL |0    |12     |gethostbyname2

but this is local, so we can't call it (is my understanding).

On 2.8, libresolv includes:
   [1093]  |     51916|     404|FUNC |GLOB |0    |9      |res_gethostbyname2

but this is "res_gethostbyname2" not "gethostbyname2".

Yet both define it in /usr/include/netdb.h:
   struct hostent  *gethostbyname2(const char *, int);

So, configure will never be able to find "gethostbyname2", as the link will
never succeed, yet zsh can't use its own definition, as the "static"
keyword in zsh's declaration:
   static struct hostent*gethostbyname2 _((char const*name,int af));

causes the compiler to reject it as a conflict:

   "./zftp.pro", line 11: identifier redeclared: gethostbyname2
       current : static function(pointer to const char, int) returning pointer to struct hostent {pointer to char h_name, pointer to pointer ...
       previous: function(pointer to const char, int) returning pointer to struct hostent {pointer to char h_name, pointer to pointer to char... : "/usr/include/netdb.h", line 225
   "zftp.c", line 1189: cannot recover from previous errors

Personally, this seems to me like a bug in solaris (declared in the headers
but not available in the libraries), and I've submitted a bug report with
sunsolve; we'll see if that goes anywhere. :P

In the meantime, I dunno.  If I remove the "static" from the zftp.c
declaration, it should work fine, but I'm not sure what problems that might
introduce.

-- 
Will Day     <PGP mail preferred>     OIT / O&E / Technical Support
willday@xxxxxxxxxxxxxxxxxx            Georgia Tech, Atlanta 30332-0715
  -> Opinions expressed are mine alone and do not reflect OIT policy <-
Those who would give up essential Liberty, to purchase a little temporary
Safety, deserve neither Liberty nor Safety.
    Benjamin Franklin, Pennsylvania Assembly, Nov. 11, 1755

Attachment: pgpxT4FND2dX3.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author