Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 806376 - sys-devel/autoconf-2.69: provide optional mode where `autoconf` does not inject `runstatedir` variable.
Summary: sys-devel/autoconf-2.69: provide optional mode where `autoconf` does not inje...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-08-04 10:20 UTC by Sergei Trofimovich (RETIRED)
Modified: 2023-06-11 14:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich (RETIRED) gentoo-dev 2021-08-04 10:20:24 UTC
Some upstream packages like glibc provide both `configure.ac` and `configure` files. Currently upstream uses autoconf-2.69.

Gentoo's autoconf:2.69 package generates quite a it of unrelated diff every time I try to make a small patch that I have to clean up manually before submisison upstream. At example:

--- a/configure.ac
+++ b/configure.ac
@@ -1083,15 +1083,23 @@ test -n "$aux_missing" && AC_MSG_WARN([
 *** some features or tests will be disabled.
 *** Check the INSTALL file for required versions.])

-# if using special system headers, find out the compiler's sekrit
-# header directory and add that to the list.  NOTE: Only does the right
-# thing on a system that doesn't need fixincludes.  (Not presently a problem.)
+# If using special system headers, find out the compiler's internal
+# header directory and add that to the list to negate -nostdinc effect.
+# NOTE: Only does the right thing on a system that doesn't need fixincludes.
+# (Not presently a problem.)
+# NOTE: sometimes 'include' is also present in gcc's ABI-specific paths
+# like in https://sourceware.org/PR28183. To avoid it we probe a known
+# 'stddef.h' header that resides in a common include directory.
 if test -n "$sysheaders"; then
   SYSINCLUDES=-nostdinc
   for d in include include-fixed; do
     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
     SYSINCLUDES="$SYSINCLUDES -isystem $i"
   done
+  for d in include/stddef.h; do
+    i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
+    SYSINCLUDES="$SYSINCLUDES -isystem $(dirname "$i")"
+  done
   SYSINCLUDES="$SYSINCLUDES \
 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
   if test -n "$CXX"; then

Example patch after `autoconf-2.69` run:

--- a/configure
+++ b/configure
@@ -732,6 +732,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -844,6 +845,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1096,6 +1098,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;

+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1233,7 +1244,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir
+               libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1386,6 +1397,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -5452,15 +5464,23 @@ $as_echo "$as_me: WARNING:
 *** some features or tests will be disabled.
 *** Check the INSTALL file for required versions." >&2;}

-# if using special system headers, find out the compiler's sekrit
-# header directory and add that to the list.  NOTE: Only does the right
-# thing on a system that doesn't need fixincludes.  (Not presently a problem.)
+# If using special system headers, find out the compiler's internal
+# header directory and add that to the list to negate -nostdinc effect.
+# NOTE: Only does the right thing on a system that doesn't need fixincludes.
+# (Not presently a problem.)
+# NOTE: sometimes 'include' is also present in gcc's ABI-specific paths
+# like in https://sourceware.org/PR28183. To avoid it we probe a known
+# 'stddef.h' header that resides in a common include directory.
 if test -n "$sysheaders"; then
   SYSINCLUDES=-nostdinc
   for d in include include-fixed; do
     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
     SYSINCLUDES="$SYSINCLUDES -isystem $i"
   done
+  for d in include/stddef.h; do
+    i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
+    SYSINCLUDES="$SYSINCLUDES -isystem $(dirname "$i")"
+  done
   SYSINCLUDES="$SYSINCLUDES \
 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
   if test -n "$CXX"; then

Sometimes the cleanup is not hard (like in this case), but sometimes there are other variable names that get into runstate hunk.

Sometimes I accidentally rely on ${runstatedir} and send upstream something that does not actually work for others. Similar failure: https://github.com/proftpd/proftpd/issues/1055

It would be nice to have a way to generate vanilla-style configure.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-08-07 03:53:01 UTC
I agree it seems like this could be useful, although a lot of distributions have backported this (both Debian [0] and Fedora [1] have).

[0] https://sources.debian.org/src/autoconf/2.69-14/debian/patches/add-runstatedir.patch/
[1] https://src.fedoraproject.org/rpms/autoconf/blob/rawhide/f/autoconf-2.69-backport-runstatedir-option.patch
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-30 08:48:24 UTC
My inclination is we should just revbump 2.69 and drop the patch. I don't think it should've been there in the first place really.

It just causes noise every time we try to submit a patch upstream.
Comment 3 Larry the Git Cow gentoo-dev 2022-07-30 09:40:29 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78a8211dcda0a866326f6ee99cc4c5da1a40fed4

commit 78a8211dcda0a866326f6ee99cc4c5da1a40fed4
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-07-30 09:40:07 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-07-30 09:40:07 +0000

    sys-devel/autoconf: drop runstatedir patch for 2.69
    
    It's confusing when sending patches upstream and we've had 2.71
    for a while now.
    
    Closes: https://bugs.gentoo.org/806376
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/autoconf/autoconf-2.69-r6.ebuild | 62 ++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
Comment 4 Larry the Git Cow gentoo-dev 2022-09-19 16:26:48 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dbcc188c5ef6bc63190cc07c93452652c682f5bb

commit dbcc188c5ef6bc63190cc07c93452652c682f5bb
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-19 16:10:24 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-19 16:26:41 +0000

    sys-devel/autoconf: backport K&R decls fix to 2.13
    
    Backport the K&R decls fix to 2.13 to avoid configure tests
    failing (often "silently", i.e. doesn't fail the build of
    the package overall, just leads to wrong results) with
    newer compilers like the upcoming Clang 16.
    
    A consequence of this whole fuss is that we're going to
    have to eautoreconf in a bunch of older packages, but
    as Ionen pointed out on IRC, this means we get some
    other stuff for free like Python 3.10 fixes, so it's
    not all bad.
    
    Undecided how to handle any packages with a generated
    configure from autoconfs not in tree. We may just
    patch the configure manually. Will see.
    
    See linked bug 870412 and the Discourse thread therein for
    details if unfamiliar.
    
    As I remarked on IRC, it's unfortunate to have to backport anything
    which will then infect generated configure, as it's somewhat
    a repeat of the --runstatedir situation, and it leads to confusion/hassle
    when sending patches upstream where a generated/bootstrapped configure
    is required.
    
    But this is different - it's a (serious) bug being fixed
    rather than a gratuitous (although) understandable given we weren't
    sure if we'd ever see another autoconf release backport of a new
    feature.
    
    Bug: https://bugs.gentoo.org/806376
    Bug: https://bugs.gentoo.org/870412
    Thanks-to: Arsen Arsenovic <arsen@aarsen.me>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/autoconf/autoconf-2.13-r3.ebuild         |  51 +++
 .../files/autoconf-2.13-K-R-decls-clang.patch      | 346 +++++++++++++++++++++
 2 files changed, 397 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79c0b97504177b9ee374e3d96af8b03349b86d12

commit 79c0b97504177b9ee374e3d96af8b03349b86d12
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-19 16:07:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-19 16:26:40 +0000

    sys-devel/autoconf: backport K&R decls fix to 2.69
    
    Backport the K&R decls fix to 2.69 to avoid configure tests
    failing (often "silently", i.e. doesn't fail the build of
    the package overall, just leads to wrong results) with
    newer compilers like the upcoming Clang 16.
    
    A consequence of this whole fuss is that we're going to
    have to eautoreconf in a bunch of older packages, but
    as Ionen pointed out on IRC, this means we get some
    other stuff for free like Python 3.10 fixes, so it's
    not all bad.
    
    Undecided how to handle any packages with a generated
    configure from autoconfs not in tree. We may just
    patch the configure manually. Will see.
    
    See linked bug 870412 and the Discourse thread therein for
    details if unfamiliar.
    
    As I remarked on IRC, it's unfortunate to have to backport anything
    which will then infect generated configure, as it's somewhat
    a repeat of the --runstatedir situation, and it leads to confusion/hassle
    when sending patches upstream where a generated/bootstrapped configure
    is required.
    
    But this is different - it's a (serious) bug being fixed
    rather than a gratuitous (although) understandable given we weren't
    sure if we'd ever see another autoconf release backport of a new
    feature.
    
    Bug: https://bugs.gentoo.org/806376
    Bug: https://bugs.gentoo.org/870412
    Thanks-to: Arsen Arsenovic <arsen@aarsen.me>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/autoconf/autoconf-2.69-r7.ebuild         |  63 ++++
 .../files/autoconf-2.69-K-R-decls-clang.patch      | 387 +++++++++++++++++++++
 2 files changed, 450 insertions(+)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0acd23de8af61e7b900c3ff2c0fcbfe0b0ddc3a3

commit 0acd23de8af61e7b900c3ff2c0fcbfe0b0ddc3a3
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-09-19 03:01:26 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-19 16:26:40 +0000

    sys-devel/autoconf: backport K&R decls fix to 2.71
    
    Backport the K&R decls fix to 2.71 to avoid configure tests
    failing (often "silently", i.e. doesn't fail the build of
    the package overall, just leads to wrong results) with
    newer compilers like the upcoming Clang 16.
    
    A consequence of this whole fuss is that we're going to
    have to eautoreconf in a bunch of older packages, but
    as Ionen pointed out on IRC, this means we get some
    other stuff for free like Python 3.10 fixes, so it's
    not all bad.
    
    Undecided how to handle any packages with a generated
    configure from autoconfs not in tree. We may just
    patch the configure manually. Will see.
    
    See linked bug 870412 and the Discourse thread therein for
    details if unfamiliar.
    
    Patches:
    - AC_C_BIGENDIAN-lto.patch ("Port AC_C_BIGENDIAN to cross gcc -std=c11 -flto")
    - AC_LANG_CALL_C_cxx.patch ("Port AC_LANG_CALL(C) to C++")
    - K-R-decls-clang.patch ("Port to compilers that moan about K&R func decls")
    
    The first two are included to make the latter apply cleanly, but they're
    also both harmless and desirable.
    
    As I remarked on IRC, it's unfortunate to have to backport anything
    which will then infect generated configure, as it's somewhat
    a repeat of the --runstatedir situation, and it leads to confusion/hassle
    when sending patches upstream where a generated/bootstrapped configure
    is required.
    
    But this is different - it's a (serious) bug being fixed
    rather than a gratuitous (although) understandable given we weren't
    sure if we'd ever see another autoconf release backport of a new
    feature.
    
    Backports to 2.69 & 2.13 to follow.
    
    Bug: https://bugs.gentoo.org/806376
    Bug: https://bugs.gentoo.org/870412
    Thanks-to: Arsen Arsenovic <arsen@aarsen.me>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/autoconf/autoconf-2.71-r3.ebuild         |  87 +++++++++++++
 .../files/autoconf-2.71-AC_C_BIGENDIAN-lto.patch   |  50 ++++++++
 .../files/autoconf-2.71-AC_LANG_CALL_C_cxx.patch   |  30 +++++
 .../files/autoconf-2.71-K-R-decls-clang.patch      | 136 +++++++++++++++++++++
 4 files changed, 303 insertions(+)