Public bug reported: Binary package hint: manpages-posix-dev
Writing an application that looks up IPv6 addresses, I noticed use of NULL for the hints field of getaddrinfo() as decribed in the manpage does not correspond with implementation. Extracted the source as follows: $ apt-get source libc6-dev $ cd glibc-2.5 $ tar xjf glibc-2.5.tar.bz2 $ vi glibc-2.5/sysdeps/posix/getaddrinfo.c The default_hints structure on line 132 has ai_flags = AI_DEFAULT. AI_DEFAULTS expands to: (AI_V4MAPPED | AI_ADDRCONFIG) This is used within getaddrinfo() line 1874 when hints is NULL. However the manpage states: "If hints is a null pointer, the behavior shall be as if it referred to a structure containing the value zero for the ai_flags, ai_socktype, and ai_protocol fields, and AF_UNSPEC for the ai_family field." The problem is that behaviour is not that of a zero ai_flags, but instead that of: ai_flags = AI_V4MAPPED | AI_ADDRCONFIG The quick solution is to adjust the manpage to reflect the existing implementation. Perhaps report it in the manpage's bugs section and suggest the user always populate hints with a non-NULL value so your application is more portable. However the more important question would be what is the correct implementation? The Solaris 10 manpage states: "If the third argument to getaddrinfo() is a null pointer, it is as if the caller had filled in an addrinfo structure initialized to 0 with ai_family set to PF_UNSPEC." Since both manpages suggest a NULL hints is the same as a hints with all fields zero, the implementation in glibc may have a bug. ** Affects: manpages-posix (Ubuntu) Importance: Undecided Status: New -- getaddrinfo manpage doesn't match glibc implementation when hints is NULL https://bugs.launchpad.net/bugs/153571 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs