<div dir="ltr"><div><div class="gmail_quote"><div>It looked to me as if #582916 and roughly duplicate #671789 could have been fixed in libc6 2.17-7 which it includes two commits<br></div></div></div><div><div><br class="">

   <a href="http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=cfde9b463d63092ff0908d4c2748ace648e2ead8">http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=cfde9b463d63092ff0908d4c2748ace648e2ead8</a></div></div><div>

   <a href="http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=3d04f5db20c8f0d1ba3881b5f5373586a18cf188">http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=3d04f5db20c8f0d1ba3881b5f5373586a18cf188</a><br></div><div>

<br></div><div>the first of which is included in eglibc 2.17</div><div><br></div><div>    <a href="http://www.eglibc.org/cgi-bin/viewvc.cgi/branches/eglibc-2_17/libc/NEWS?view=markup">http://www.eglibc.org/cgi-bin/viewvc.cgi/branches/eglibc-2_17/libc/NEWS?view=markup</a><br>

</div><div><br></div><div>and the second of which is included as a patch named 'cvs-getaddrinfo-EAI_NONAME.diff' in 2.17-7.</div><div><br></div><div>So I upgraded libc6 on my Debian 7.0 machine.</div><div><br></div>

<div>With the standard nsswitch.conf there is no change in the behavior of my test program.  As before, either with empty or with bogus resolv.conf or with bogus domain name getaddrinfo() returns -2 with (supposedly therefore not significant) errno 2.<br>

</div><div><br></div><div>With nsswitch.conf changed to have simply "hosts: dns", the following is the output of the test program.</div><div><br></div><div>================================<br></div><div><div>Making resolv.conf empty</div>

<div>Results of looking up <a href="http://www.google.com">www.google.com</a>: status = -2, errno = 111</div><div>Results of looking up a bogus name: status = -2, errno = 111</div><div>Writing nameserver option to resolv.conf</div>

<div>Results of looking up <a href="http://www.google.com">www.google.com</a>: status = 0, errno = 101</div><div>Results of looking up a bogus name: status = -2, errno = 101</div><div>Making resolv.conf empty</div><div>Results of looking up <a href="http://www.google.com">www.google.com</a>: status = -2, errno = 111</div>

<div>Results of looking up a bogus name: status = -2, errno = 111</div><div>Writing incorrect nameserver option to resolv.conf</div><div>Results of looking up <a href="http://www.google.com">www.google.com</a>: status = -2, errno = 110</div>

<div>Results of looking up a bogus name: status = -2, errno = 110</div></div><div><div>================================<br></div><div></div></div><div><br></div><div>This is different from both Debian 7.0 and Ubuntu 13.04 and sort of half way between the two. As in Debian 7.0 the status is still always -2 in case of error. As in Ubuntu 13.04 errno is 110 when an incorrect nameserver address is given, as opposed to 111 when resolv.conf is empty (but errno is not supposed to be significant here because status is -2).</div>

<div><br></div><div>Callers of getaddrinfo() will only be able to rely on these return values once the values have stabilized in eglibc (which they may not yet have done) and once the bug (assuming it's a bug and not a feature) is fixed whereby, with the standard nsswitch.conf, the incorrect errno is returned.</div>

<div><br></div><div>Interested parties might want to enter into discussion with upstream in order to ensure that there is a clear specification of what these return values should be under different circumstances. Ideally tests would be added which check whether the specification has been adhered to.</div>

<div>-- <br></div><div class="gmail_extra">Thomas</div></div>