I've installed your patch to gnulib fixing this.

/Simon

Zineb Zaadoud via GNU gettext discussion list
<bug-gettext-mXXj517/[email protected]> writes:

> Hi,
>
> Ubuntu hit a build failure in gettext 1.0-1 caused by test-getaddrinfo.
>
> The test tries to resolve external hostnames with getaddrinfo(). In the
> Ubuntu build environment, where DNS resolution may be unavailable,
> getaddrinfo() returned EAI_NONAME (-2). The test expected success and
> failed.
>
> The test already treats EAI_AGAIN as a no-network case and skips instead of
> failing. The attached patch treats EAI_NONAME the same way, since this can
> also be returned when DNS resolution is unavailable in sandboxed build
> environments.
>
> PPA validation:
> https://launchpad.net/~zineb/+archive/ubuntu/gettext-ftbfs
>
> Thanks,
> Zineb
> diff --git a/gettext-tools/gnulib-tests/test-getaddrinfo.c 
> b/gettext-tools/gnulib-tests/test-getaddrinfo.c
> index 83e52d10..4070cc26 100644
> --- a/gettext-tools/gnulib-tests/test-getaddrinfo.c
> +++ b/gettext-tools/gnulib-tests/test-getaddrinfo.c
> @@ -120,6 +120,16 @@ simple (int pass, char const *host, char const *service)
>            fprintf (stderr, "skipping getaddrinfo test: no network?\n");
>            return 77;
>          }
> +
> +      /* EAI_NONAME can be returned in sandboxed build environments where
> +         DNS resolution is unavailable. Treat it like EAI_AGAIN and skip.  */
> +      if (res == EAI_NONAME)
> +        {
> +          skip++;
> +          fprintf (stderr, "skipping getaddrinfo test: no DNS resolver?\n");
> +          return 77;
> +        }
> +
>        /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
>           fail the test merely because of this.  */
>        if (res == EAI_SERVICE)
>
From 48c984ad10f8dc4a6470389fc99b906406dfcd19 Mon Sep 17 00:00:00 2001
From: Zineb Zaadoud <[email protected]>
Date: Tue, 30 Jun 2026 18:10:59 +0200
Subject: [PATCH] getaddrinfo tests: Skip when DNS resolution is unavailable

* tests/test-getaddrinfo.c (simple): Skip tests for unavailable DNS.

Signed-off-by: Simon Josefsson <[email protected]>
---
 ChangeLog                |  5 +++++
 tests/test-getaddrinfo.c | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 1164db433b..4a0e91ef9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2026-06-30  Zineb Zaadoud <[email protected]>  (tiny change)
+
+	getaddrinfo: Skip when DNS resolution is unavailable
+	* tests/test-getaddrinfo.c (simple): Skip tests for unavailable DNS.
+
 2026-06-26  Paul Eggert  <[email protected]>
 
 	strfmon_l: be consistent about unsigned vs size_t
diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index 83e52d1091..4070cc2685 100644
--- a/tests/test-getaddrinfo.c
+++ b/tests/test-getaddrinfo.c
@@ -120,6 +120,16 @@ simple (int pass, char const *host, char const *service)
           fprintf (stderr, "skipping getaddrinfo test: no network?\n");
           return 77;
         }
+
+      /* EAI_NONAME can be returned in sandboxed build environments where
+         DNS resolution is unavailable. Treat it like EAI_AGAIN and skip.  */
+      if (res == EAI_NONAME)
+        {
+          skip++;
+          fprintf (stderr, "skipping getaddrinfo test: no DNS resolver?\n");
+          return 77;
+        }
+
       /* Solaris reports EAI_SERVICE for "http" and "https".  Don't
          fail the test merely because of this.  */
       if (res == EAI_SERVICE)
-- 
2.54.0

Attachment: signature.asc
Description: PGP signature

Reply via email to