public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/autogen/, sys-devel/autogen/files/
Date: Sat,  2 Dec 2023 07:13:13 +0000 (UTC)	[thread overview]
Message-ID: <1701501016.bc1a2e327998227c5537b25bd81a146c17b3431c.sam@gentoo> (raw)

commit:     bc1a2e327998227c5537b25bd81a146c17b3431c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  2 07:09:52 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec  2 07:10:16 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc1a2e32

sys-devel/autogen: fix configure modern c issues, fix FORTIFY_SOURCE=3 test issue

Closes: https://bugs.gentoo.org/889394
Closes: https://bugs.gentoo.org/898590
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/autogen/autogen-5.18.16-r3.ebuild        |  74 +++++++++++++++
 .../files/autogen-5.18.16-FORTIFY_SOURCE.patch     | 100 +++++++++++++++++++++
 .../files/autogen-5.18.16-configure-c99.patch      |  42 +++++++++
 3 files changed, 216 insertions(+)

diff --git a/sys-devel/autogen/autogen-5.18.16-r3.ebuild b/sys-devel/autogen/autogen-5.18.16-r3.ebuild
new file mode 100644
index 000000000000..462f4d2b5059
--- /dev/null
+++ b/sys-devel/autogen/autogen-5.18.16-r3.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools toolchain-funcs
+
+DESCRIPTION="Program and text file generation"
+HOMEPAGE="https://www.gnu.org/software/autogen/"
+SRC_URI="
+	mirror://gnu/${PN}/rel${PV}/${P}.tar.xz
+	https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/verify.h;h=3b57ddee0acffd23cc51bc8910a15cf879f90619;hb=537a5511ab0b1326e69b32f87593a50aedb8a589 -> ${P}-gnulib-3b57ddee0acffd23cc51bc8910a15cf879f90619-lib-verify.h
+"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="libopts static-libs"
+
+RDEPEND="
+	>=dev-scheme/guile-2.0:=
+	dev-libs/libxml2
+"
+DEPEND="${RDEPEND}"
+# TODO: investigate & drop this!
+BDEPEND="sys-apps/which"
+
+# We don't pass the flag explicitly, bug #796776.
+# Let's fix it upstream after next autogen release if it happens.
+QA_CONFIGURE_OPTIONS+=" --enable-snprintfv-convenience"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-5.18.16-no-werror.patch
+	"${FILESDIR}"/${PN}-5.18.16-rpath.patch
+	"${FILESDIR}"/${PN}-5.18.16-respect-TMPDIR.patch
+	"${FILESDIR}"/${PN}-5.18.16-make-4.3.patch
+	"${FILESDIR}"/${PN}-5.18.16-guile-3.patch
+	"${FILESDIR}"/${PN}-5.18.16-configure-c99.patch
+	"${FILESDIR}"/${PN}-5.18.16-FORTIFY_SOURCE.patch
+)
+
+src_prepare() {
+	default
+
+	# missing tarball file
+	cp "${DISTDIR}"/${P}-gnulib-3b57ddee0acffd23cc51bc8910a15cf879f90619-lib-verify.h autoopts/verify.h || die
+
+	# May be able to drop this on next release (>5.18.16)
+	eautoreconf
+}
+
+src_configure() {
+	# suppress possibly incorrect -R flag
+	export ag_cv_test_ldflags=
+
+	# autogen requires run-time sanity of regex and string functions.
+	# Use defaults of linux-glibc until we need somethig more advanced.
+	if tc-is-cross-compiler ; then
+		export ag_cv_run_strcspn=no
+		export libopts_cv_with_libregex=yes
+	fi
+
+	econf $(use_enable static-libs static)
+}
+
+src_install() {
+	default
+
+	find "${ED}" -name '*.la' -delete || die
+
+	if ! use libopts ; then
+		rm "${ED}"/usr/share/autogen/libopts-*.tar.gz || die
+	fi
+}

diff --git a/sys-devel/autogen/files/autogen-5.18.16-FORTIFY_SOURCE.patch b/sys-devel/autogen/files/autogen-5.18.16-FORTIFY_SOURCE.patch
new file mode 100644
index 000000000000..b8108c1c0ed1
--- /dev/null
+++ b/sys-devel/autogen/files/autogen-5.18.16-FORTIFY_SOURCE.patch
@@ -0,0 +1,100 @@
+https://bugs.gentoo.org/889394
+https://sourceforge.net/p/autogen/bugs/212/
+https://bugzilla.redhat.com/2173623
+https://siddhesh.in/posts/that-is-not-a-number-that-is-a-freed-object.html
+https://gcc.gnu.org/PR105217
+https://src.fedoraproject.org/rpms/autogen/blob/684b717191dd8bcd4e01a7775e62d50bc41b8ccb/f/autogen-fortify.patch
+
+commit 772b282a4e858a27af610bcdcc8b66925cbf1a83
+Author: Tomas Korbar <tkorbar@redhat.com>
+Date:   Tue Feb 28 16:08:13 2023 +0100
+
+    avoid GCC code analysis bug
+
+--- a/agen5/defLoad.c
++++ b/agen5/defLoad.c
+@@ -448,17 +448,28 @@ read_defs(void)
+     FILE *        fp;
+     def_input_mode_t in_mode = ready_def_input(&def_fname, &data_sz);
+ 
++    /*
++     * "ready_def_input" has a lot of side effects. It's possible that
++     * there are no definitions, so "in_mode" is set to DONE and there's
++     * nothing to do.
++     */
+     if (in_mode == INPUT_DONE)
+         return;
+ 
+     /*
+      *  Allocate the space we need for our definitions.
++     * "data_sz" was set by read_def_input to the size of the
++     * definitions file (or 4096 if we're reading from a fifo file).
++     * In that alternate case, we'll start the input size at 4096 bytes.
++     * The allocation includes space for context and a NUL byte or two
+      */
+-    rem_sz = data_sz+4+sizeof(*base_ctx);
+-    base_ctx = (scan_ctx_t *)AGALOC(rem_sz, "file buf");
+-    memset(VOIDP(base_ctx), 0, rem_sz);
++    {
++        size_t sz = data_sz + sizeof(long) + sizeof(*base_ctx);
++        base_ctx = (scan_ctx_t *)AGALOC(sz, "file buf");
++        memset(VOIDP(base_ctx), 0, sz);
++    }
+     base_ctx->scx_line = 1;
+-    rem_sz = data_sz;
++    rem_sz = data_sz; // size available for storing def text
+ 
+     /*
+      *  Our base context will have its currency pointer set to this
+@@ -482,6 +493,9 @@ read_defs(void)
+         if (fp == NULL)
+             AG_CANT(READ_DEF_OPEN, def_fname);
+ 
++        /*
++         * If we're emitting dependency information, then do so.
++         */
+         if (dep_fp != NULL)
+             add_source_file(def_fname);
+     }
+@@ -516,8 +530,7 @@ read_defs(void)
+          *  See if there is any space left
+          */
+         if (rem_sz == 0) {
+-            scan_ctx_t * p;
+-            off_t dataOff;
++            off_t scan_off;
+ 
+             /*
+              *  IF it is a regular file, then we are done
+@@ -527,24 +540,16 @@ read_defs(void)
+ 
+             /*
+              *  We have more data and we are out of space.
+-             *  Try to reallocate our input buffer.
++             *  AGREALOC will succeed or not return.
+              */
+             data_sz += (rem_sz = 0x1000);
+-            dataOff = data - base_ctx->scx_data;
+-            p = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx),
+-                         "expand f buf");
++            scan_off = data - base_ctx->scx_data;
++            base_ctx = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx),
++                                "expand f buf");
+ 
+-            /*
+-             *  The buffer may have moved.  Set the data pointer at an
+-             *  offset within the new buffer and make sure our base pointer
+-             *  has been corrected as well.
+-             */
+-            if (p != base_ctx) {
+-                p->scx_scan = \
+-                    p->scx_data = (char *)(p + 1);
+-                data = p->scx_data + dataOff;
+-                base_ctx = p;
+-            }
++            base_ctx->scx_scan = \
++                base_ctx->scx_data = (char *)(base_ctx + 1);
++            data = base_ctx->scx_data + scan_off;
+         }
+     }
+ 

diff --git a/sys-devel/autogen/files/autogen-5.18.16-configure-c99.patch b/sys-devel/autogen/files/autogen-5.18.16-configure-c99.patch
new file mode 100644
index 000000000000..75e2e760a792
--- /dev/null
+++ b/sys-devel/autogen/files/autogen-5.18.16-configure-c99.patch
@@ -0,0 +1,42 @@
+https://bugs.gentoo.org/898590
+https://src.fedoraproject.org/rpms/autogen/c/7d157d98e73dcd1602111309a690643faa80e207?branch=rawhide
+--- a/config/ag_macros.m4
++++ b/config/ag_macros.m4
+@@ -113,7 +113,7 @@ AC_DEFUN([INVOKE_AG_MACROS_LAST],[
+   fi
+ 
+   AC_CACHE_CHECK([for static inline], [snv_cv_static_inline], [
+-  AC_TRY_COMPILE([static inline foo(bar) int bar; { return bar; }],
++  AC_TRY_COMPILE([static inline int foo(bar) int bar; { return bar; }],
+     [return foo(0);],
+     [snv_cv_static_inline='static inline'],
+     [snv_cv_static_inline='static'])
+@@ -428,7 +428,7 @@ int main (int argc, char ** argv) {
+    char zRej@<:@@:>@ = reject;
+    char zAcc@<:@@:>@ = "a-ok-eject";
+    return strcspn( zAcc, zRej ) - 5;
+-}] )]
++}] )],
+     [ag_cv_run_strcspn=yes],[ag_cv_run_strcspn=no],[ag_cv_run_strcspn=no]
+   ) # end of RUN_IFELSE
+   ]) # end of AC_CACHE_VAL for ag_cv_run_strcspn
+--- a/configure
++++ b/configure
+@@ -17338,7 +17338,7 @@ int main (int argc, char ** argv) {
+    char zAcc[] = "a-ok-eject";
+    return strcspn( zAcc, zRej ) - 5;
+ }
+-    ag_cv_run_strcspn=yes
++#error
+ _ACEOF
+ if ac_fn_c_try_run "$LINENO"; then :
+   ag_cv_run_strcspn=no
+@@ -18406,7 +18405,7 @@ else
+ 
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+-static inline foo(bar) int bar; { return bar; }
++static inline int foo(bar) int bar; { return bar; }
+ int
+ main ()
+ {


             reply	other threads:[~2023-12-02  7:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-02  7:13 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-15  2:03 [gentoo-commits] repo/gentoo:master commit in: sys-devel/autogen/, sys-devel/autogen/files/ Sam James
2020-01-04 23:02 Sergei Trofimovich
2019-02-02 20:07 Sergei Trofimovich
2017-12-04 14:51 Lars Wendler
2015-11-23 11:27 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1701501016.bc1a2e327998227c5537b25bd81a146c17b3431c.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox