zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: test for network libraries (for test only)/problems with name resolution
       [not found] <20000821092904.A32199@lorien.emufarm.org>
@ 2000-08-22 13:15 ` Andrej Borsenkow
  2000-08-22 13:43   ` Roland Jesse
  2000-08-22 17:02   ` Bart Schaefer
  0 siblings, 2 replies; 12+ messages in thread
From: Andrej Borsenkow @ 2000-08-22 13:15 UTC (permalink / raw)
  To: ZSH workers mailing list; +Cc: Roland Jesse, Danek Duvall

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

[ Moved to zsh-workers ]

This patch tries more intellegent test for needed network libraries. In my
case it correctly finds -lresolv and related functions. I'm a bit confused
about Solaris. Up to Solaris 7 there is no gethostbyname2; Solaris 7 has it as
LOCAL in -lresolv and Solaris 8 has it in -lnsl (actually Solaris 8 has
everything there, this is the reason why it builds smoothly). Roland, what
version was it that had problem? If it is Solaris 7, either it has some magic
or broken headers.

The patch is against current CVS; it should apply to 3.1.9 with some fuzz, if
not, I can send generated configure.

I do not commit it for two reasons:

 - I'd like to know, that it does not break some other system
 - I'm trapped on my own system. The problem is, now, when gethostbyname2 is
correctly found, name resolution goes via resolver library. But this is using
/etc/hosts only as fallback "if nameserver is not running" (at least in
original bind implemetation as found here). Due to our infrastructure, it is
unacceptable to me.

If I understand it correctly, gethostbyname2 and getipnodebyname are needed to
support IPv6. Which means, that as long as it is NOT supported, they are not
needed and we may fallback to good old gethostbyname. I can just hope that if
IPv6 will ever be suppored here, there will be some reasonable name-to-address
translation support as well.

Any ideas?

-andrej

[-- Attachment #2: zsh-netlibs.diff --]
[-- Type: application/octet-stream, Size: 4561 bytes --]

? .configure.in.swp
Index: aczsh.m4
===================================================================
RCS file: /cvsroot/zsh/zsh/aczsh.m4,v
retrieving revision 1.3
diff -u -r1.3 aczsh.m4
--- aczsh.m4	2000/08/14 04:46:29	1.3
+++ aczsh.m4	2000/08/22 12:58:35
@@ -646,3 +646,33 @@
 	then LIBS="$4"
 	else LIBS="$enable_libs"
 	fi)])
+
+# zsh_SEARCH_LIBS(FUNCTION, SEARCH-LIBS,
+#                [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# This is derived from autoconf 2.49a AC_SEARCH_LIBS
+# with the following differences:
+#  - no extra libs argument
+#  - SEARCH-LIBS are taken literally - use -lfoo not foo. That
+#    makes it possible to pass several libs, e.g. "-lsocket -lnsl"
+# --------------------------------------------------------
+# Search for a library defining FUNC, if it's not already available.
+AC_DEFUN([zsh_SEARCH_LIBS],
+[AC_CACHE_CHECK([for library containing $1], [zsh_cv_search_$1],
+[zsh_func_search_save_LIBS="$LIBS"
+zsh_cv_search_$1=no
+AC_TRY_LINK_FUNC([$1], [zsh_cv_search_$1="none required"])
+test "$zsh_cv_search_$1" = no && for zsh_lib in $2; do
+LIBS="$zsh_lib $zsh_func_search_save_LIBS"
+AC_TRY_LINK_FUNC([$1],
+[zsh_cv_search_$1="$zsh_lib"
+break])
+done
+LIBS="$zsh_func_search_save_LIBS"])
+if test "$zsh_cv_search_$1" = no; then
+  ifelse([$4], , :, [$4])
+else
+  test "$zsh_cv_search_$1" = "none required" || LIBS="$zsh_cv_search_$1 $LIBS"
+  ifelse([$3], , , [$3])
+fi
+])
+
Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.26
diff -u -r1.26 configure.in
--- configure.in	2000/08/16 13:23:37	1.26
+++ configure.in	2000/08/22 12:58:37
@@ -512,7 +512,9 @@
 dnl On some systems, modules need to be linked against libc explicitly,
 dnl in case they require objects that exist only in the static version
 dnl and might not be compiled into the zsh executable.
-AC_CHECK_LIB(c, printf)
+dnl Also, on SINIX -lc MUST BE after -lsocket, so this test
+dnl adds -lc as the last library
+AC_CHECK_LIB(c, printf, [LIBS="$LIBS -lc"])
 
 AC_CHECK_LIB(m, pow)
 
@@ -528,12 +530,43 @@
   AC_CHECK_LIB(${lib}, tgetent, [LIBS="-l$lib $LIBS"; break])
 done
 
-dnl Some systems (Solaris 2.x, Linux Redhat 5.x) require
-dnl libnsl (Network Services Library) to find yp_all
-AC_CHECK_FUNCS(yp_all)
-if test $ac_cv_func_yp_all = no; then
-  AC_CHECK_LIB(nsl, yp_all)
-fi
+dnl Check for network libraries.
+dnl This is really sad and messy story
+dnl Zsh needs three groups of functions:
+dnl   NIS (a.k.a. Yellow Pages)
+dnl   socket
+dnl   resolver
+dnl Depending on particlular OS (or even on particular OS version)
+dnl these function may be found in -lc, -lnsl, -lresolv, -lsocket.
+dnl Sometimes libraries depend on other (notorious -lnsl that is needed
+dnl on SVR4-derived systems to get any network functionality at all)
+dnl or must follow particular order (SINIX, that has two incompatible
+dnl versions of gethostbyname() in -lsocket and -lresolv).
+dnl So, this test tries to find minimal set of needed libraries;
+dnl it tries to preserve user settings (if needed libs were explcitly
+dnl specified) and -lresolv after -lsocket order.
+
+#
+# First check for -lnsl. Good chances, that if it exists, it
+# will be neeeded anyway.
+#
+zsh_SEARCH_LIBS(yp_all, -lnsl)
+
+#
+# Check for resolver functions to make sure, that 
+# -lresolv will be after -lsocket on SINIX
+#
+
+zsh_SEARCH_LIBS(inet_aton, -lnsl -lresolv "-lresolv -lnsl")
+zsh_SEARCH_LIBS(inet_pton, -lnsl -lresolv "-lresolv -lnsl")
+zsh_SEARCH_LIBS(inet_ntop, -lnsl -lresolv "-lresolv -lnsl")
+zsh_SEARCH_LIBS(gethostbyname2, -lnsl -lresolv "-lresolv -lnsl")
+
+#
+# ... and check for socket support
+#
+
+zsh_SEARCH_LIBS(socket, -lnsl -lsocket "-lsocket -lnsl")
 
 dnl I am told that told that unicos reqire these for nis_list
 if test `echo $host_os | sed 's/^\(unicos\).*/\1/'` = unicos; then
@@ -546,8 +579,6 @@
 
 AC_CHECK_LIB(cap, cap_get_proc)
 
-AC_CHECK_LIB(socket, socket)
-
 dnl ---------------------
 dnl CHECK TERMCAP LIBRARY
 dnl ---------------------
@@ -857,7 +888,7 @@
 	       gethostname gethostbyname2 getipnodebyname \
 	       inet_aton inet_pton inet_ntop \
 	       getlogin getpwent getpwnam getpwuid getgrgid getgrnam \
-	       initgroups nis_list \
+	       initgroups yp_all nis_list \
 	       setuid seteuid setreuid setresuid setsid \
 	       memcpy memmove strstr strerror \
 	       cap_get_proc \

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-08-22 13:15 ` PATCH: test for network libraries (for test only)/problems with name resolution Andrej Borsenkow
@ 2000-08-22 13:43   ` Roland Jesse
  2000-08-22 17:02   ` Bart Schaefer
  1 sibling, 0 replies; 12+ messages in thread
From: Roland Jesse @ 2000-08-22 13:43 UTC (permalink / raw)
  To: ZSH workers mailing list

Andrej Borsenkow wrote:

> Up to Solaris 7 there is no gethostbyname2; Solaris 7 has it as
> LOCAL in -lresolv and Solaris 8 has it in -lnsl (actually Solaris 8 has
> everything there, this is the reason why it builds smoothly). Roland, what
> version was it that had problem? If it is Solaris 7, either it has some magic
> or broken headers.

Yes, it is Solaris 7. 

For now I am using gnu's cc to build the shell on that specific machine.
Even though that's not nice, it does the job.

	Roland


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-08-22 13:15 ` PATCH: test for network libraries (for test only)/problems with name resolution Andrej Borsenkow
  2000-08-22 13:43   ` Roland Jesse
@ 2000-08-22 17:02   ` Bart Schaefer
  2000-08-23  6:55     ` Andrej Borsenkow
  2000-09-04 13:39     ` Andrej Borsenkow
  1 sibling, 2 replies; 12+ messages in thread
From: Bart Schaefer @ 2000-08-22 17:02 UTC (permalink / raw)
  To: ZSH workers mailing list

On Aug 22,  5:15pm, Andrej Borsenkow wrote:
} Subject: PATCH: test for network libraries (for test only)/problems with n
}
} I do not commit it for two reasons:
} 
}  - I'd like to know, that it does not break some other system

On RH5.2, I get:

[...]
checking for library containing yp_all... -lnsl
checking for library containing inet_aton... none required
checking for library containing inet_pton... none required
checking for library containing inet_ntop... none required
checking for library containing gethostbyname2... none required
checking for library containing socket... none required
[...]
checking for gethostname... yes
checking for gethostbyname2... yes
checking for getipnodebyname... no
checking for inet_aton... yes
checking for inet_pton... yes
checking for inet_ntop... yes
[...]

The build then proceeds just fine.

}  - I'm trapped on my own system. The problem is, now, when
} gethostbyname2 is correctly found, name resolution goes via resolver
} library. But this is using /etc/hosts only as fallback "if nameserver
} is not running" (at least in original bind implemetation as found
} here). Due to our infrastructure, it is unacceptable to me.

I'm not sure I understand ... do you mean that your nameserver *is*
running, but is not able to properly resolve all the names you need?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-08-22 17:02   ` Bart Schaefer
@ 2000-08-23  6:55     ` Andrej Borsenkow
  2000-09-04 13:39     ` Andrej Borsenkow
  1 sibling, 0 replies; 12+ messages in thread
From: Andrej Borsenkow @ 2000-08-23  6:55 UTC (permalink / raw)
  To: Bart Schaefer, ZSH workers mailing list


>
> }  - I'm trapped on my own system. The problem is, now, when
> } gethostbyname2 is correctly found, name resolution goes via resolver
> } library. But this is using /etc/hosts only as fallback "if nameserver
> } is not running" (at least in original bind implemetation as found
> } here). Due to our infrastructure, it is unacceptable to me.
>
> I'm not sure I understand ... do you mean that your nameserver *is*
> running, but is not able to properly resolve all the names you need?
>

The gethostbyname() from -lnsl on SVR4-derived systems supports service switch
via /etc/netconfig file; here you can define the order of name resolution much
like in Solaris /etc/nsswitch.conf. I normally define it to use both DNS and
/etc/hosts.

The gethostbyname2() from -lresolv does not use service switch and behaves as
described above. It means, that if host is not defined in DNS but in
/etc/hosts, it is not found (assuming, that DNS is properly setup and
functional).

In our case, not everything is defined in DNS, hence the problem.

Yes, it is broken system, but there is no (real) chance to ever get it fixed,
now, that development is about to officially stop. So, I have to devise some
workaround.

-andrej


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-08-22 17:02   ` Bart Schaefer
  2000-08-23  6:55     ` Andrej Borsenkow
@ 2000-09-04 13:39     ` Andrej Borsenkow
  2000-09-06 15:52       ` Removed " Andrej Borsenkow
  2000-09-07 22:16       ` Will Day
  1 sibling, 2 replies; 12+ messages in thread
From: Andrej Borsenkow @ 2000-09-04 13:39 UTC (permalink / raw)
  To: ZSH workers mailing list


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.

-andrej


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Removed RE: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-09-04 13:39     ` Andrej Borsenkow
@ 2000-09-06 15:52       ` Andrej Borsenkow
  2000-09-07 22:16       ` Will Day
  1 sibling, 0 replies; 12+ messages in thread
From: Andrej Borsenkow @ 2000-09-06 15:52 UTC (permalink / raw)
  To: ZSH workers mailing list

>
>
> 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.
>

Peter wrote, it was unintentional commit, so I removed it.

-andrej


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-09-04 13:39     ` Andrej Borsenkow
  2000-09-06 15:52       ` Removed " Andrej Borsenkow
@ 2000-09-07 22:16       ` Will Day
  2000-09-08  4:14         ` Bart Schaefer
  1 sibling, 1 reply; 12+ messages in thread
From: Will Day @ 2000-09-07 22:16 UTC (permalink / raw)
  To: ZSH workers mailing list

[-- Attachment #1: Type: text/plain, Size: 2929 bytes --]

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@rom.oit.gatech.edu            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 #2: Type: application/pgp-signature, Size: 360 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-09-07 22:16       ` Will Day
@ 2000-09-08  4:14         ` Bart Schaefer
  2000-09-08  6:05           ` Andrej Borsenkow
  0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 2000-09-08  4:14 UTC (permalink / raw)
  To: Will Day, ZSH workers mailing list

On Sep 7,  6:16pm, Will Day wrote:
} Subject: Re: PATCH: test for network libraries (for test only)/problems wi
}
} 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.

It'll just mean you can't look up names for IPv6 hosts, I think.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-09-08  4:14         ` Bart Schaefer
@ 2000-09-08  6:05           ` Andrej Borsenkow
  2000-09-08  6:39             ` Will Day
                               ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Andrej Borsenkow @ 2000-09-08  6:05 UTC (permalink / raw)
  To: Bart Schaefer, Will Day, ZSH workers mailing list


Yes, I was almost sure gethostbyname2 would be a problem. As I wrote before it
means, Solaris 7 headers or libraries are broken. O.K. it means, patch had not
fixed the bug anyway, so I was right to remove it.

>
>
> On Sep 7,  6:16pm, Will Day wrote:
> } Subject: Re: PATCH: test for network libraries (for test only)/problems wi
> }
> } 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.
>
> It'll just mean you can't look up names for IPv6 hosts, I think.
>

IPv6 is the keyword. We need the gethostbyname2/getipnodebyname, inet_pton etc
*only* if we want to do IPv6. Conversely, we cannot do IPv6 without these
functions (well, actually, RFC for gethostbyname2 - forgot the number -
states, that implementation of gethostbyname may return IPv6 addresses, but it
looks too obscure. And it is is obsolete by getipnodebyname anyway). That was
what I  was about to do - remove all local (re-)definitions of resolver
functions and make better guess about SUPORT_IPV6, i.e. do not use IPv6
functions unless we are doing IPv6 and do not do IPv6 unless we have all
prerequisites. That should also solve my problem (with incorrect use of
gethostbyname2). Unfortunately, I do not have any IPv6 implementation here to
test it. Is there some system that supports IPv6 without proper resolver
support?Zefram, you added IPv6 support IIRC?

Does Solaris 7 support IPv6?

-andrej


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-09-08  6:05           ` Andrej Borsenkow
@ 2000-09-08  6:39             ` Will Day
  2000-09-08  7:28             ` OT: " Andrej Borsenkow
  2000-09-08 20:31             ` Zefram
  2 siblings, 0 replies; 12+ messages in thread
From: Will Day @ 2000-09-08  6:39 UTC (permalink / raw)
  To: ZSH workers mailing list

[-- Attachment #1: Type: text/plain, Size: 3104 bytes --]

A short time ago, at a computer terminal far, far away, Andrej Borsenkow wrote:
>> } 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.
>>
>> It'll just mean you can't look up names for IPv6 hosts, I think.

It looked to me that, if I removed the 'static' prefix from zftp.pro and
zftp.c, the compiler would then accept the code, as it wouldn't be
conflicting with <netdb.h>.  It would then have an implementation of
gethostbyname2() - however, now being non-static, it could conceiveably be
called from outside the zftp code; that was what I was wondering might
introduce problems.

>IPv6 is the keyword. We need the gethostbyname2/getipnodebyname, inet_pton etc
>*only* if we want to do IPv6. Conversely, we cannot do IPv6 without these
>functions (well, actually, RFC for gethostbyname2 - forgot the number -
>states, that implementation of gethostbyname may return IPv6 addresses, but it
>looks too obscure. And it is is obsolete by getipnodebyname anyway). That was
>what I  was about to do - remove all local (re-)definitions of resolver
>functions and make better guess about SUPORT_IPV6, i.e. do not use IPv6
>functions unless we are doing IPv6 and do not do IPv6 unless we have all
>prerequisites. That should also solve my problem (with incorrect use of
>gethostbyname2). Unfortunately, I do not have any IPv6 implementation here to
>test it. Is there some system that supports IPv6 without proper resolver
>support?Zefram, you added IPv6 support IIRC?
>
>Does Solaris 7 support IPv6?

No, 2.7 doesn't appear to support IPv6 natively, although I think there's
an unbundled, unsupported, experimental-quality pkg from Sun to add IPv6 to
2.7.  I haven't tried it. :)  Solaris 2.8 does support IPv6 natively, of
course.

I was beginning to wonder why it compiles properly under 2.8, as
gethostbyname2() still isn't available (being named res_getbyhostname2
instead).  However, looking back over the code, I see that it works
because, although HAVE_GETHOSTBYNAME2 is still undefined, it doesn't
actually try to define gethostbyname2() in zftp.c because that's only done
if it didn't find getipnodebyname().  Looks like gethostbyname2() is only
needed to implement getipnodebyname(), and 2.8 does have that, in libnsl.
Okay, that makes more sense now. :)

I guess my question, then, is why is zftp even messing with IPv6 stuff
under 2.7 if 2.7 doesn't support IPv6?  Oh never mind - I just re-read your
paragraph above, and understand now.

Sorry, this doesn't really add much to the discussion, but it at least
seemed to help me work it all out in my head.

-- 
Will Day     <PGP mail preferred>     OIT / O&E / Technical Support
willday@rom.oit.gatech.edu            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 #2: Type: application/pgp-signature, Size: 360 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* OT: RE: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-09-08  6:05           ` Andrej Borsenkow
  2000-09-08  6:39             ` Will Day
@ 2000-09-08  7:28             ` Andrej Borsenkow
  2000-09-08 20:31             ` Zefram
  2 siblings, 0 replies; 12+ messages in thread
From: Andrej Borsenkow @ 2000-09-08  7:28 UTC (permalink / raw)
  To: ZSH workers mailing list


>
> Yes, I was almost sure gethostbyname2 would be a problem. As I
> wrote before it
> means, Solaris 7 headers or libraries are broken.

On the second thought, they are not. The presence of declaration in headers
does not mean declared object is actually present (it may be declared "for
internal use only"); conversely, there are (normally) many undeclared
functions in system libraries. Any package that wants to be on safe side must
check both for object *and* its declaration. Downside is, of course, without
object declaration you never know if your usage of it is correct :-)

-andrej


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: PATCH: test for network libraries (for test only)/problems with name resolution
  2000-09-08  6:05           ` Andrej Borsenkow
  2000-09-08  6:39             ` Will Day
  2000-09-08  7:28             ` OT: " Andrej Borsenkow
@ 2000-09-08 20:31             ` Zefram
  2 siblings, 0 replies; 12+ messages in thread
From: Zefram @ 2000-09-08 20:31 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Bart Schaefer, Will Day, ZSH workers mailing list

Andrej Borsenkow wrote:
>what I  was about to do - remove all local (re-)definitions of resolver
>functions and make better guess about SUPORT_IPV6, i.e. do not use IPv6
>functions unless we are doing IPv6 and do not do IPv6 unless we have all
>prerequisites.

The point of having the code define getipnodebyname() etc. is so that the
main code (that's actually doing networky stuff) only needs to know about
getipnodebyname().  If the local library provides a real getipnodebyname()
then we use that, getting proper IPv6 support is the OS supports it;
otherwise we use the fallback definition in zftp.c that only provides
support for IPv4 (which must be all the local library supports).  Actually
it's one stop more complicated than that, because of the intermediate
fallback of the older gethostbyname2() interface, which also supports IPv6
and may or may not exist on each system.  The main code doesn't need to
know which subset of the three name lookup interfaces (getipnodebyname(),
gethostbyname2(), gethostbyname()) is actually supported -- it just uses
the most capable one, getipnodebyname(), and we make sure that that does
exist one way or another.  The same goes for inet_ntop() etc.

There does seem to be a problem with the internal gethostbyname2()
clashing with an external declaration.  The right solution for this is
to declare and define a my_gethostbyname2() for the fallback definition,
and add a "#define gethostbyname2 my_gethostbyname2" inside the #ifndef
section that defines it.

-zefram


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2000-09-08 20:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20000821092904.A32199@lorien.emufarm.org>
2000-08-22 13:15 ` PATCH: test for network libraries (for test only)/problems with name resolution Andrej Borsenkow
2000-08-22 13:43   ` Roland Jesse
2000-08-22 17:02   ` Bart Schaefer
2000-08-23  6:55     ` Andrej Borsenkow
2000-09-04 13:39     ` Andrej Borsenkow
2000-09-06 15:52       ` Removed " Andrej Borsenkow
2000-09-07 22:16       ` Will Day
2000-09-08  4:14         ` Bart Schaefer
2000-09-08  6:05           ` Andrej Borsenkow
2000-09-08  6:39             ` Will Day
2000-09-08  7:28             ` OT: " Andrej Borsenkow
2000-09-08 20:31             ` Zefram

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).