Subject: | [PATCH] getnameinfo and getaddrinfo test tweaks for VMS |
Date: | Thu, 24 Oct 2013 21:46:11 -0500 |
To: | bugs-Socket [...] rt.cpan.org |
From: | "Craig A. Berry" <craigberry [...] mac.com> |
VMS has had getnameinfo and getaddrinfo since ages, but we haven't been enabling them in the core configuration process. When I do so, a couple of test failures show up in Socket which I've fixed in the attached patch.
getaddrinfo.t test 18. This test expects a single result for the lookup of service=80/family=AF_INET/socktype=STREAM, but we were getting two results, one for IPPROTO_TCP and another for IPPROTO_SCTP. Specifying a protocol of IPPROTO_TCP explicitly on input restricts us to one result and should be pretty safe as it's already in use elsewhere in the test script.
The call to getaddrinfo with host=localhost/service=ftp/flags=AI_NUMERICHOST/socktype=SOCK_STREAM succeeded but was expected to fail. This smells like an actual bug in the VMS implementation. It kinda looks like they special-cased "localhost" so it's treated exactly like 127.0.0.1 and it considers the host numeric even when it's not. We could reasonably skip this test on VMS, but what I did instead was made it use "cpan.perl.org" instead of "localhost", which produces the expected failure.
In getnameinfo.t, calling getnameinfo for a service that does not have a service name registered fails unless you specify NI_NUMERICSERV. It seems some implementations infer NI_NUMERICSERV when there is no service name, and the Linux man page even documents that behavior, but I can't find anything in the standard requiring it and the VMS implementation doesn't do it. So I add NI_NUMERICSERV explicitly to the flags for those cases where we fail to look up a service name.
That gets all tests passing (also checked on OS X as well as VMS).
Show quoted text
________________________________________
Craig A. Berry
mailto:craigberry@mac.com
"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser
Message body is not shown because sender requested not to inline it.