I have since identified another issue that is less obvious.

The configure check for res_search() used an old K&R style declaration,
it's part of fetchmail versions 6.3.4.rc1 and 6.3.4 (19.5 years ago)
through 6.5.4.  The check uses a K&R style function declaration without
prototype, which is considered a function declaration with prototype
(void) by C23 compilers, and as a consequence it believes the system had
no res_search() support when in fact it has.

As consequence, the build succeeds, but disables DNS-related features
(alias checks for servers in multidrop mode; calling res_init() to
reload the resolv.conf file, possibly more). It is user-testable easily:

$ LANG=en ./fetchmail -V | head -n1
This is fetchmail release 6.5.4+TLS+NLS-DNS.

Versions with "-DNS" string after the version lack DNS support, versions
with DNS support lack this string.

The cause is this contribution in 2006 that contained this one line for
configure.ac

extern int res_search();

<https://gitlab.com/fetchmail/fetchmail/-/blame/6.5.4/configure.ac?ref_type=tags#L161>

which leads the configure check to fail. The code has served us well
until the first relevant compiler switched to gnu23 by default, and to
distract you, the GCC bugtracker has an ongoing discussion about
warnings here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108694


With C17 or older compilers:

configure:10809: gcc -o conftest -O2 -std=gnu17   conftest.c   >&5
configure:10809: $? = 0
configure:10811: result: found

With C23 or newer compiler mode:

configure:10809: gcc -o conftest -O2 -std=gnu23   conftest.c   >&5
conftest.c:65:12: error: conflicting types for 'res_search'; have 'int(void)'
   65 | extern int res_search();
      |            ^~~~~~~~~~
In file included from conftest.c:63:
/usr/include/resolv.h:202:17: note: previous declaration of 'res_search' with 
type 'int(const char *, int,  int,  unsigned char *, int)'
  202 | int             res_search (const char *, int, int, unsigned char *, 
int)
      |                 ^~~~~~~~~~
conftest.c: In function 'main':
conftest.c:70:1: error: too many arguments to function 'res_search'; expected 
0, have 5
   70 | res_search(0, 0, 0, 0, 0); dn_skipname(0,0);
      | ^~~~~~~~~~ ~
conftest.c:65:12: note: declared here
   65 | extern int res_search();
      |            ^~~~~~~~~~
configure:10809: $? = 1
[...]
configure:10818: result: not found

The net result in configure.h

C17 or previous compiler:

/* Define to 1 if you have the 'res_search' and 'dn_skipname' functions. */
#define HAVE_RES_SEARCH 1

C23 or recent compiler:

/* Define to 1 if you have the 'res_search' and 'dn_skipname' functions. */
/* #undef HAVE_RES_SEARCH */


Workarounds, any one suffices:

1. add -std=gnu17 to CFLAGS for/before configure
2. add -DHAVE_RES_SEARCH=1 to CFLAGS for the build to override the configure 
check's result
3. strip the line    extern int res_search();    (it's not indented) from 
configure, or if you regenerate it, from configure.ac instead.

See
https://gcc.gnu.org/gcc-15/porting_to.html#c23-fn-decls-without-parameters

this is likely hitting more configure checks from older days, not just
fetchmail and possibly also in custom auto-configuration scripts.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2120850

Title:
  fetchmail: questing autopkgtests failures

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/fetchmail/+bug/2120850/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to