nss_wrapper support for musl-libc

Dennis Schridde dennis.schridde at uni-heidelberg.de
Tue Feb 28 11:20:00 UTC 2017


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?

> > The changes to tests/testsuite.c are fine if comments are added. Please
> > make seperate commits for each file.
> 
> Please find the patch series, one patch for each file, attached.

I also want to mention that I'm using these patches to build a container for 
Alpine Linux:
* https://github.com/urzds/dynamicuser-docker/tree/alpine
* https://quay.io/repository/urzds/dynamicuser

I'm looking forward to your second review of these patches! I hope they are in 
good shape to be accepted for integration.

--Dennis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 681 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170228/93fbc42d/signature.sig>


More information about the samba-technical mailing list