nss_wrapper support for musl-libc
Andreas Schneider
asn at samba.org
Tue Feb 28 14:22:14 UTC 2017
On Tuesday, 28 February 2017 12:20:00 CET Dennis Schridde wrote:
> Hi Andreas!
>
> On Montag, 20. Februar 2017 17:08:33 CET Dennis Schridde wrote:
> > > About tests/test_getaddrinfo.c:
> > >
> > > I think you should report those to the developers of musl-libc. These
> > > tests
> > > pass correctly on Linux, Solaris and BSD. All have different libc
> > > implementations.
> > >
> > > rc = getaddrinfo(NULL, "echo", &hints, &res);
> > >
> > > - assert_int_equal(rc, EAI_NONAME);
> > > + if (rc != EAI_SERVICE) { // musl-libc returns EAI_SERVICE
> > > + assert_int_equal(rc, EAI_NONAME);
> > > + }
> > >
> > > I would argue that EAI_NONAME is the correct error code here as it is
> > > NULL.
> > > EAI_SERICE is obviously the wrong return code.
> >
> > Is EAI_NONAME correct, because "echo" is specified in /etc/services as
> > 7/tcp or 7/udp? I.e. because a remote "node" address is necessary to
> > communicate via TCP or UDP and getaddrinfo is supposed to deduct that
> > from
> > /etc/services?
>
> From reading freeaddrinfo(3p) (redirect from getaddrinfo(3p)) it is not
> clear to me what the expected behaviour is. It says about these two errors:
>
> [EAI_NONAME]
> The name does not resolve for the supplied parameters.
>
> Neither nodename nor servname were supplied. At least one of these
> shall be supplied.
>
> [EAI_SERVICE]
> The service passed was not recognized for the specified socket type.
>
> It seems that EAI_NONAME is about resolving the nodename only, while
> EAI_SERVICE indicates whether the provided servname and hints represent a
> sane combination.
>
> The test specifies no nodename, only a servname. Thus musl's behaviour of
> indicating that "the service passed was not recognized for the specified
> socket type" seems to be spot on. Going by the specs, it seems that either
> GNU libc's behaviour is wrong or the specification is too lax in this
> regard.
>
> Another question would be what we are actually testing here: Conformance of
> libc to POSIX, or whether nss_wrapper works as intended?
Normally I try to mimic the behaviour of glibc. Then I test on other platforms
BSD, OpenSolaris if they differ. They often did the same as glibc.
I'm currently checking why BSD and Solaris nightly build are not working.
Andreas
--
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
www.samba.org
More information about the samba-technical
mailing list