[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Zack Weinberg
Date: Sun, 02 Apr 2023 15:42:59 -0400
User-agent: Cyrus-JMAP/3.9.0-alpha0-238-g746678b8b6-fm-20230329.001-g746678b8

AC_TYPE_GETGROUPS is the last remaining use of AC_EGREP_HEADER in
stock Autoconf macros.  It uses it only when cross compiling, as a
fallback from an AC_RUN_IFELSE check, testing for a bug in system
headers from the late 1980s or early 1990s, where gid_t *existed*
but the second argument to getgroups needed to be an array of int,
and this didn’t cause a compile error (i.e. the system headers
declare getgroups with no prototype or an incorrect prototype).
AC_FUNC_GETGROUPS also uses AC_RUN_IFELSE to test for obscure
problems specific to long-obsolete Unixes.

Cross-referencing gnulib’s getgroups.m4 I see that there *are*
current-generation Unixes with bugs in getgroups that are worth
worrying about (notably, FreeBSD mishandles an error case even in
CURRENT).  However, the downsides of AC_RUN_IFELSE and AC_EGREP_HEADER
seem more severe than the chances of someone compiling a current-
generation program, that uses getgroups, on an OS old enough to
have one of the really nasty bugs.

Accordingly, this patch changes AC_FUNC_GETGROUPS to use a
host_os-based *blacklist* both in native and cross compilation.
This is limited to the four host_os values for which either our old
code, or Gnulib, documented a serious bug, but has no version checks.
An incorrect guess by this blacklist can be overridden by setting
ac_cv_func_getgroups_works in  AC_TYPE_GETGROUPS, for its
part, now does a series of regular old AC_COMPILE_IFELSE checks to
probe the prototype of getgroups, and considers that good enough.

While I was in there I noticed that AC_FUNC_GETGROUPS does not
AC_SUBST a documented output variable, and that the name of this
variable is misspelled in the manual.

I'd appreciate comments and testing on this patch particularly
by users of FreeBSD and MacOS X, which are the currently
developed systems on AC_FUNC_GETGROUPS's blacklist -- see
the commentary in functions.m4.  Testing on really old systems,
old enough to actually have unprototyped declarations in unistd.h,
would also be valuable, if only to exercise the code paths in
AC_TYPE_GETGROUPS that aren't exercised on a modern system.


Attachment: 0001-Overhaul-AC_TYPE_GETGROUPS-and-AC_FUNC_GETGROUPS.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]