On Mon, Nov 23, 2026 at 08:43:47PM +0100, Bruno Haible wrote:
> This patch documents a few portability problems with musl libc.
> 
> 
> 2026-11-23  Bruno Haible  <[email protected]>
> 
>       Document a few musl libc problems.
>       * doc/posix-functions/gethostent.texi: Document the musl libc problem.
>       * doc/posix-functions/getnetent.texi: Likewise.
>       * doc/posix-functions/getservent.texi: Likewise.
>       * doc/posix-functions/getservbyname.texi: Likewise.
>       * doc/posix-functions/getservbyport.texi: Likewise.
> 
> diff --git a/doc/posix-functions/gethostent.texi 
> b/doc/posix-functions/gethostent.texi
> index 4b234d93a8..6a71e1559f 100644
> --- a/doc/posix-functions/gethostent.texi
> +++ b/doc/posix-functions/gethostent.texi
> @@ -15,4 +15,8 @@
>  @item
>  This function is missing on some platforms:
>  Minix 3.1.8, Cygwin 2.9, mingw, MSVC 14.
> +@item
> +This function always returns @code{NULL} (as if @file{/etc/hosts} were empty)
> +on some platforms:
> +musl libc.

Yes, we don't treat there as being an iterable space of hostnames.

>  @end itemize
> diff --git a/doc/posix-functions/getnetent.texi 
> b/doc/posix-functions/getnetent.texi
> index 8c3845032f..48912d40c1 100644
> --- a/doc/posix-functions/getnetent.texi
> +++ b/doc/posix-functions/getnetent.texi
> @@ -15,4 +15,8 @@
>  @item
>  This function is missing on some platforms:
>  Cygwin 2.9, mingw, MSVC 14, Android 8.1.
> +@item
> +This function always returns @code{NULL} (as if @file{/etc/networks} were 
> empty)
> +on some platforms:
> +musl libc.

Likewise network names.

>  @end itemize
> diff --git a/doc/posix-functions/getservbyname.texi 
> b/doc/posix-functions/getservbyname.texi
> index 93eddab92e..6b32a06517 100644
> --- a/doc/posix-functions/getservbyname.texi
> +++ b/doc/posix-functions/getservbyname.texi
> @@ -20,4 +20,8 @@
>  @item
>  On Windows, in 32-bit mode, this function is defined with a calling
>  convention that is different from @code{cdecl}.
> +@item
> +The returned @code{struct servent} has a nonsensical @code{s_aliases} value
> +on some platforms:
> +musl libc.

Can you clarify "nonsensical"? My understanding is that we treat each
name a service may be known by independently rather than as a primary
and set of aliases. Our internals for this are largely built around
the needs of the modern interfaces, getaddrinfo/getnameinfo, which
don't have a separate concept of "aliases", rather than the legacy
interfaces which are non-thread-safe unless you use the nonstandard _r
extensions.

>  @end itemize
> diff --git a/doc/posix-functions/getservbyport.texi 
> b/doc/posix-functions/getservbyport.texi
> index 01665136c4..262482dd26 100644
> --- a/doc/posix-functions/getservbyport.texi
> +++ b/doc/posix-functions/getservbyport.texi
> @@ -20,4 +20,8 @@
>  @item
>  On Windows, in 32-bit mode, this function is defined with a calling
>  convention that is different from @code{cdecl}.
> +@item
> +The returned @code{struct servent} has a nonsensical @code{s_aliases} value
> +on some platforms:
> +musl libc.

Same.

>  @end itemize
> diff --git a/doc/posix-functions/getservent.texi 
> b/doc/posix-functions/getservent.texi
> index 91848c6ecb..931f6c1723 100644
> --- a/doc/posix-functions/getservent.texi
> +++ b/doc/posix-functions/getservent.texi
> @@ -15,4 +15,8 @@
>  @item
>  This function is missing on some platforms:
>  mingw, MSVC 14.
> +@item
> +This function always returns @code{NULL} (as if @file{/etc/services} were 
> empty)
> +on some platforms:
> +musl libc.
>  @end itemize

And like with hosts and networks, we don't treat these as enumerable
but as if there is just an abstract backend that only does lookups by
name or port number.

Rich

Reply via email to