I did: > * tests/test-servent.c: Enable the signature checks unconditionally. > Include macros.h. > (is_aliases_member): New function. > (main): Add more tests.
This test fails on AIX. This patch relaxes the test and the configure test, accordingly. 2026-11-25 Bruno Haible <[email protected]> servent: Fix test failure on AIX. * m4/servent.m4 (gl_SERVENT): Relax configure test on AIX. * tests/test-servent.c (main): Relax expectations on AIX. diff --git a/m4/servent.m4 b/m4/servent.m4 index 29abb1f3f4..1917f13179 100644 --- a/m4/servent.m4 +++ b/m4/servent.m4 @@ -1,5 +1,5 @@ # servent.m4 -# serial 6 +# serial 7 dnl Copyright (C) 2008, 2010-2026 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -88,10 +88,19 @@ AC_DEFUN([gl_SERVENT] if (!(se != NULL && se->s_port == htons (80) && strcmp (se->s_proto, "tcp") == 0 +#if defined _AIX + /* AIX /etc/services really defines the services www + and http on different lines, thus they are not + considered aliases. */ + && (strcmp (se->s_name, "http") == 0 + || strcmp (se->s_name, "www") == 0) +#else && ((strcmp (se->s_name, "http") == 0 && is_aliases_member (se, "www")) || (strcmp (se->s_name, "www") == 0 - && is_aliases_member (se, "http"))))) + && is_aliases_member (se, "http"))) +#endif + ) ) result |= 1; } return result; diff --git a/tests/test-servent.c b/tests/test-servent.c index 463fe000a7..5b95a7c487 100644 --- a/tests/test-servent.c +++ b/tests/test-servent.c @@ -58,24 +58,38 @@ main (void) ASSERT (se != NULL); ASSERT (se->s_port == htons (80)); ASSERT (streq (se->s_proto, "tcp")); +#if defined _AIX + /* AIX /etc/services really defines the services www and http on different + lines, thus they are not considered aliases. */ + ASSERT (streq (se->s_name, "http") || streq (se->s_name, "www")); +#else ASSERT ((streq (se->s_name, "http") && is_aliases_member (se, "www")) || (streq (se->s_name, "www") && is_aliases_member (se, "http"))); +#endif } { struct servent *se = getservbyname ("http", "tcp"); ASSERT (se != NULL); ASSERT (se->s_port == htons (80)); ASSERT (streq (se->s_proto, "tcp")); +#if defined _AIX + ASSERT (streq (se->s_name, "http")); +#else ASSERT ((streq (se->s_name, "http") && is_aliases_member (se, "www")) || (streq (se->s_name, "www") && is_aliases_member (se, "http"))); +#endif } { struct servent *se = getservbyname ("www", "tcp"); ASSERT (se != NULL); ASSERT (se->s_port == htons (80)); ASSERT (streq (se->s_proto, "tcp")); +#if defined _AIX + ASSERT (streq (se->s_name, "www")); +#else ASSERT ((streq (se->s_name, "http") && is_aliases_member (se, "www")) || (streq (se->s_name, "www") && is_aliases_member (se, "http"))); +#endif } return test_exit_status;
