nss_wrapper support for musl-libc
Andreas Schneider
asn at samba.org
Thu Jan 26 09:19:26 UTC 2017
On Wednesday, 25 January 2017 23:47:23 CET Dennis Schridde wrote:
> Hello!
Hi Dennis,
thank you very much for your contribution!
> I made a few changes to nss_wrapper to get it to run on musl-libc 1.1
> (Alpine Linux 3.5). Please find the patch attached.
>
> One test failed, without me being able to fix it: gethostent returns NULL on
> musl-libc, but I don't know what might cause this or whether the test is
> actually valid for musl-libc. If you could provide me with further
> information on the purpose and expected behaviour of this function (the
> information on the net was rather scarce) or why it might return NULL in
> this case, I would be very glad.
The only documentation is the source. You need to dig there to see what is
going on.
>
> If you want to test this, I suggest using my Dockerfile [1] as a basis. By
> also installing "cmocka" and changing the build instructions at the bottom
> appropriately, you can run the testsuite.
>
> I would be glad if you could integrate this into your sources for the next
> release. If you have concerns about my changes, related to coding style or
> anything else, please do not hesitate to explain to me how I should improve
> this code to allow inclusion into your sources.
The changes to src/nss_wrapper.c are fine, if you comment #else and #endif,
like:
#ifdef HAVE_GETPWENT_R
...
#else /* HAVE_GETPWENT_R */
...
#endif /* HAVE_GETPWENT_R */
This makes it easier to understand which #ifdef it is is.
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.
The changes to tests/testsuite.c are fine if comments are added. Please make
seperate commits for each file.
Thanks!
Andreas
--
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
www.samba.org
More information about the samba-technical
mailing list