summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2025-02-05 16:24:46 +0000
committerSam James <sam@gentoo.org>2025-02-05 16:51:08 +0000
commit26a8a019b6665b80a970188bba49846554797b4b (patch)
tree567efff8b72c8bac971a43e4330e9f6d7be43f60 /sys-devel
parentdev-db/mariadb: add 10.11.11 (diff)
downloadgentoo-26a8a019b6665b80a970188bba49846554797b4b.tar.gz
gentoo-26a8a019b6665b80a970188bba49846554797b4b.tar.bz2
gentoo-26a8a019b6665b80a970188bba49846554797b4b.zip
sys-devel/patch: refine mkdir configure patch; fix test failure with -DNDEBUG
* Add another hunk for another configure test (that only fires in some cases) and also add a hunk for Android (which might be needed for people doing Prefix). Noticed this whlie looking into something that ended up being related. * Fix test failure with -DNDEBUG, reported by Michał Górny <mgorny@gentoo.org> at https://github.com/conda-forge/patch-feedstock/issues/11. Closes: https://bugs.gentoo.org/898598 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/patch/files/patch-2.7.6-configure-mkdir-spruced-up.patch38
-rw-r--r--sys-devel/patch/files/patch-2.7.6-ndebug-assert-hash-table.patch37
-rw-r--r--sys-devel/patch/patch-2.7.6-r7.ebuild86
3 files changed, 161 insertions, 0 deletions
diff --git a/sys-devel/patch/files/patch-2.7.6-configure-mkdir-spruced-up.patch b/sys-devel/patch/files/patch-2.7.6-configure-mkdir-spruced-up.patch
new file mode 100644
index 000000000000..8ef7a954a4d9
--- /dev/null
+++ b/sys-devel/patch/files/patch-2.7.6-configure-mkdir-spruced-up.patch
@@ -0,0 +1,38 @@
+https://bugs.gentoo.org/898598
+https://github.com/coreutils/gnulib/commit/3c136a2cc38d71083f123231a8b9ad4b01930789
+--- a/configure
++++ b/configure
+@@ -17084,6 +17084,8 @@ else
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <errno.h>
++/* Android 4.3 declares fchownat() in <sys/stat.h> instead. */
++#include <sys/stat.h>
+ #include <sys/types.h>
+ int
+ main ()
+@@ -17130,6 +17132,8 @@ else
+ /* end confdefs.h. */
+ #include <unistd.h>
+ #include <fcntl.h>
++ /* Android 4.3 declares fchownat() in <sys/stat.h> instead. */
++ #include <sys/stat.h>
+
+ int
+ main ()
+--- a/lib/unistd.in.h
++++ b/lib/unistd.in.h
+@@ -113,6 +113,13 @@
+ # include <netdb.h>
+ #endif
+
++/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>. */
++/* But avoid namespace pollution on glibc systems. */
++#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
++ && !defined __GLIBC__
++# include <sys/stat.h>
++#endif
++
+ /* MSVC defines off_t in <sys/types.h>.
+ May also define off_t to a 64-bit type on native Windows. */
+ #if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
diff --git a/sys-devel/patch/files/patch-2.7.6-ndebug-assert-hash-table.patch b/sys-devel/patch/files/patch-2.7.6-ndebug-assert-hash-table.patch
new file mode 100644
index 000000000000..d3aa7aa4c34e
--- /dev/null
+++ b/sys-devel/patch/files/patch-2.7.6-ndebug-assert-hash-table.patch
@@ -0,0 +1,37 @@
+From 01ae7ce6a7f270937face6aec75db28d30d83059 Mon Sep 17 00:00:00 2001
+Message-ID: <01ae7ce6a7f270937face6aec75db28d30d83059.1738773172.git.sam@gentoo.org>
+From: Sam James <sam@gentoo.org>
+Date: Wed, 5 Feb 2025 16:16:06 +0000
+Subject: [PATCH] Fix dodgy assert with side-effects in insert_cached_dirfd
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Michał Górny <mgorny@gentoo.org> reported that patch was running out of
+FDs and that the `deep-directories` test was failing. This turns out
+to be because `hash_insert` isn't called at all with `-DNDEBUG` because
+`insert_cached_dirfd` only calls it in one case inside of an `assert`.
+
+See https://github.com/conda-forge/patch-feedstock/issues/11.
+
+This regressed in 025a54b789bd88ed15430f8633514e296826983e.
+
+* src/safe.c (insert_cached_dirfd): Don't use 'assert' for 'hash_insert'
+ call with side-effects.
+--- a/src/safe.c
++++ b/src/safe.c
+@@ -183,7 +183,8 @@ static void insert_cached_dirfd (struct cached_dirfd *entry, int keepfd)
+
+ /* Only insert if the parent still exists. */
+ if (! list_empty (&entry->children_link))
+- assert (hash_insert (cached_dirfds, entry) == entry);
++ if (hash_insert (cached_dirfds, entry) != entry)
++ xalloc_die ();
+ }
+
+ static void invalidate_cached_dirfd (int dirfd, const char *name)
+
+base-commit: 1da6bf84db2ed0be88ccb47139256e48243a75f0
+--
+2.48.1
+
diff --git a/sys-devel/patch/patch-2.7.6-r7.ebuild b/sys-devel/patch/patch-2.7.6-r7.ebuild
new file mode 100644
index 000000000000..61ce4a002a1d
--- /dev/null
+++ b/sys-devel/patch/patch-2.7.6-r7.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/patch.asc
+inherit flag-o-matic verify-sig
+
+DESCRIPTION="Utility to apply diffs to files"
+HOMEPAGE="https://www.gnu.org/software/patch/patch.html"
+if [[ ${PV} == 9999 ]] ; then
+ EGIT_REPO_URI="https://git.savannah.gnu.org/git/patch.git"
+ inherit git-r3
+else
+ SRC_URI="mirror://gnu/patch/${P}.tar.xz"
+ SRC_URI+=" verify-sig? ( mirror://gnu/patch/${P}.tar.xz.sig )"
+
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+fi
+
+LICENSE="GPL-3+"
+SLOT="0"
+IUSE="static test xattr"
+RESTRICT="!test? ( test )"
+
+RDEPEND="xattr? ( sys-apps/attr )"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ test? ( sys-apps/ed )
+ verify-sig? ( sec-keys/openpgp-keys-patch )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-fix-test-suite.patch
+ "${FILESDIR}"/${PN}-2.7.6-fix-error-handling-with-git-style-patches.patch
+ "${FILESDIR}"/${PN}-2.7.6-CVE-2018-6951.patch
+ "${FILESDIR}"/${PN}-2.7.6-allow-input-files-to-be-missing-for-ed-style-patches.patch
+ "${FILESDIR}"/${PN}-2.7.6-CVE-2018-1000156.patch
+ "${FILESDIR}"/${PN}-2.7.6-CVE-2018-6952.patch
+ "${FILESDIR}"/${PN}-2.7.6-Do-not-crash-when-RLIMIT_NOFILE-is-set-to-RLIM_INFINITY.patch
+ "${FILESDIR}"/${PN}-2.7.6-CVE-2018-1000156-fix1.patch
+ "${FILESDIR}"/${PN}-2.7.6-CVE-2018-1000156-fix2.patch
+ "${FILESDIR}"/${PN}-2.7.6-CVE-2019-13636.patch
+ "${FILESDIR}"/${PN}-2.7.6-CVE-2019-13638.patch
+ "${FILESDIR}"/${PN}-2.7.6-Avoid-invalid-memory-access-in-context-format-diffs.patch
+ "${FILESDIR}"/${PN}-2.7.6-configure-mkdir-spruced-up.patch
+ "${FILESDIR}"/${PN}-2.7.6-ndebug-assert-hash-table.patch
+)
+
+src_unpack() {
+ if [[ ${PV} == 9999 ]] ; then
+ git-r3_src_unpack
+
+ cd "${S}" || die
+ ./bootstrap || die
+ elif use verify-sig ; then
+ verify-sig_verify_detached "${DISTDIR}"/${P}.tar.xz{,.sig}
+ fi
+
+ default
+}
+
+src_configure() {
+ use static && append-ldflags -static
+
+ local myeconfargs=(
+ $(use_enable xattr)
+ # rename to gpatch for better BSD compatibility
+ --program-prefix=g
+ )
+ # Do not let $ED mess up the search for `ed` 470210.
+ ac_cv_path_ED=$(type -P ed) \
+ econf "${myeconfargs[@]}"
+}
+
+src_test() {
+ emake check gl_public_submodule_commit=
+}
+
+src_install() {
+ default
+
+ # symlink to the standard name
+ dosym gpatch /usr/bin/patch
+ dosym gpatch.1 /usr/share/man/man1/patch.1
+}