public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/patch/, sys-devel/patch/files/
@ 2018-02-12 15:14 Thomas Deutschmann
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Deutschmann @ 2018-02-12 15:14 UTC (permalink / raw
  To: gentoo-commits

commit:     ff5c04761b1534110b752bddfe904114cd42f430
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 12 15:14:13 2018 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Feb 12 15:14:13 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff5c0476

sys-devel/patch: Rev bump to fix test suite

Package-Manager: Portage-2.3.24, Repoman-2.3.6

 .../patch/files/patch-2.7.6-fix-test-suite.patch   | 120 +++++++++++++++++++++
 .../{patch-2.7.6.ebuild => patch-2.7.6-r1.ebuild}  |   2 +
 2 files changed, 122 insertions(+)

diff --git a/sys-devel/patch/files/patch-2.7.6-fix-test-suite.patch b/sys-devel/patch/files/patch-2.7.6-fix-test-suite.patch
new file mode 100644
index 00000000000..3aff5c0f77b
--- /dev/null
+++ b/sys-devel/patch/files/patch-2.7.6-fix-test-suite.patch
@@ -0,0 +1,120 @@
+http://git.savannah.gnu.org/cgit/patch.git/commit/?id=f6bc5b14bd193859851d15a049bafb1007acd288
+http://git.savannah.gnu.org/cgit/patch.git/commit/?id=074e2395f81d0ecaa66b71a6c228c70b49db72e5
+
+--- a/tests/crlf-handling
++++ b/tests/crlf-handling
+@@ -14,7 +14,7 @@ use_local_patch
+ use_tmpdir
+ 
+ lf2crlf() {
+-    while read l; do echo -e "$l\r"; done
++    while read l; do printf "%s\r\n" "$l"; done
+ }
+ 
+ echo 1 > a
+--- a/tests/git-cleanup
++++ b/tests/git-cleanup
+@@ -36,8 +36,8 @@ BAD PATCH
+ EOF
+ 
+ echo 1 > f
+-echo -n '' > g
+-echo -n '' > h
++printf '' > g
++printf '' > h
+ 
+ check 'patch -f -i 1.diff || echo status: $?' <<EOF
+ patching file f
+--- a/tests/merge
++++ b/tests/merge
+@@ -30,30 +30,28 @@ x2() {
+     while test $# -gt 0 && test "$1" != -- ; do
+ 	echo "$1"
+ 	shift
+-    done > a.sed
+-    echo "$body" | sed -f a.sed > b
++    done > b.sed
++    echo "$body" | sed -f b.sed > b
+     shift
+     while test $# -gt 0 ; do
+ 	echo "$1"
+ 	shift
+-    done > b.sed
+-    echo "$body" | sed -f b.sed > c
+-    rm -f a.sed b.sed
++    done > c.sed
++    echo "$body" | sed -f c.sed > c
++    rm -f b.sed c.sed
+     output=`diff -u a b | patch $ARGS -f c`
+     status=$?
+     echo "$output" | sed -e '/^$/d' -e '/^patching file c$/d'
+     cat c
+-    test $status == 0 || echo "Status: $status"
++    test $status = 0 || echo "Status: $status"
+ }
+ 
+ x() {
+-    ARGS="$ARGS --merge" x2 "$@"
++    ARGS="--merge" x2 "$@"
+     echo
+-    ARGS="$ARGS --merge=diff3" x2 "$@"
++    ARGS="--merge=diff3" x2 "$@"
+ }
+ 
+-unset ARGS
+-
+ # ==============================================================
+ 
+ check 'x 3' <<EOF
+--- a/tests/test-lib.sh
++++ b/tests/test-lib.sh
+@@ -41,7 +41,7 @@ use_local_patch() {
+ 
+     eval 'patch() {
+ 	if test -n "$GDB" ; then
+-	  echo -e "\n" >&3
++	  printf "\n\n" >&3
+ 	  gdbserver localhost:53153 $PATCH "$@" 2>&3
+ 	else
+           $PATCH "$@"
+@@ -113,22 +113,15 @@ cleanup() {
+     exit $status
+ }
+ 
+-if test -z "`echo -n`"; then
+-    if eval 'test -n "${BASH_LINENO[0]}" 2>/dev/null'; then
+-	eval '
+-	    _start_test() {
+-		echo -n "[${BASH_LINENO[2]}] $* -- "
+-	    }'
+-    else
+-	eval '
+-	    _start_test() {
+-		echo -n "* $* -- "
+-	    }'
+-    fi
++if eval 'test -n "${BASH_LINENO[0]}" 2>/dev/null'; then
++    eval '
++	_start_test() {
++	    printf "[${BASH_LINENO[2]}] %s -- " "$*"
++	}'
+ else
+     eval '
+ 	_start_test() {
+-	    echo "* $*"
++	    printf "* %s -- " "$*"
+ 	}'
+ fi
+ 
+--- a/tests/merge
++++ b/tests/merge
+@@ -32,7 +32,7 @@ x2() {
+ 	shift
+     done > b.sed
+     echo "$body" | sed -f b.sed > b
+-    shift
++    test $# -eq 0 || shift
+     while test $# -gt 0 ; do
+ 	echo "$1"
+ 	shift
+-- 

diff --git a/sys-devel/patch/patch-2.7.6.ebuild b/sys-devel/patch/patch-2.7.6-r1.ebuild
similarity index 94%
rename from sys-devel/patch/patch-2.7.6.ebuild
rename to sys-devel/patch/patch-2.7.6-r1.ebuild
index b16c1511b88..388826a546a 100644
--- a/sys-devel/patch/patch-2.7.6.ebuild
+++ b/sys-devel/patch/patch-2.7.6-r1.ebuild
@@ -18,6 +18,8 @@ RDEPEND="xattr? ( sys-apps/attr )"
 DEPEND="${RDEPEND}
 	test? ( sys-apps/ed )"
 
+PATCHES=( "${FILESDIR}"/${P}-fix-test-suite.patch )
+
 src_configure() {
 	use static && append-ldflags -static
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/patch/, sys-devel/patch/files/
@ 2025-02-05 16:51 Sam James
  0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2025-02-05 16:51 UTC (permalink / raw
  To: gentoo-commits

commit:     26a8a019b6665b80a970188bba49846554797b4b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  5 16:24:46 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb  5 16:51:08 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26a8a019

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 <AT> gentoo.org>
  at https://github.com/conda-forge/patch-feedstock/issues/11.

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

 .../patch-2.7.6-configure-mkdir-spruced-up.patch   | 38 ++++++++++
 .../patch-2.7.6-ndebug-assert-hash-table.patch     | 37 ++++++++++
 sys-devel/patch/patch-2.7.6-r7.ebuild              | 86 ++++++++++++++++++++++
 3 files changed, 161 insertions(+)

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
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/patch/, sys-devel/patch/files/
@ 2025-02-27  5:54 Eli Schwartz
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Schwartz @ 2025-02-27  5:54 UTC (permalink / raw
  To: gentoo-commits

commit:     0bc98b5f3b280ab33857da098557edf1df1d4b14
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 27 04:56:42 2025 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Thu Feb 27 05:53:44 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0bc98b5f

sys-devel/patch: backport two regression fixes for the alpha

Yes I know, we were trying to move on from needing patch to build patch.
On the plus side we are getting really close to a well polished stable
release? Worth it.

Closes: https://bugs.gentoo.org/949834
Acked-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>

 ...20250206-no-backup-if-mismatch-regression.patch | 131 +++++++++++++++++++++
 ...ch-2.7.6_p20250206-traditional-diff-lines.patch | 114 ++++++++++++++++++
 ...0206.ebuild => patch-2.7.6_p20250206-r1.ebuild} |  16 +++
 3 files changed, 261 insertions(+)

diff --git a/sys-devel/patch/files/patch-2.7.6_p20250206-no-backup-if-mismatch-regression.patch b/sys-devel/patch/files/patch-2.7.6_p20250206-no-backup-if-mismatch-regression.patch
new file mode 100644
index 000000000000..f4d162694ab4
--- /dev/null
+++ b/sys-devel/patch/files/patch-2.7.6_p20250206-no-backup-if-mismatch-regression.patch
@@ -0,0 +1,131 @@
+From b5d2124e2e6019ee5d329b49ef6904a0daec74a1 Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Mon, 24 Feb 2025 22:59:51 -0800
+Subject: [PATCH] patch: fix --no-backup-if-mismatch regression
+
+Problem reported by Sam James in:
+https://lists.gnu.org/archive/html/bug-patch/2025-02/msg00014.html
+https://bugs.gentoo.org/show_bug.cgi?id=949834
+* src/patch.c (backup_if_mismatch_specified): New static var.
+(get_some_switches): Set it.
+(main): Default backup_if_mismatch only if not set on command line.
+* tests/no-backup: New file.
+* tests/Makefile.am (TESTS): Add it.
+---
+ src/patch.c       |  6 ++++-
+ tests/Makefile.am |  1 +
+ tests/no-backup   | 56 +++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 62 insertions(+), 1 deletion(-)
+ create mode 100644 tests/no-backup
+
+diff --git a/src/patch.c b/src/patch.c
+index 6c460f7..e4d0524 100644
+--- a/src/patch.c
++++ b/src/patch.c
+@@ -118,6 +118,7 @@ static bool merge;
+ static enum diff reject_format = NO_DIFF;  /* automatic */
+ static bool make_backups;
+ static bool backup_if_mismatch;
++static bool backup_if_mismatch_specified;
+ static char const *version_control;
+ static char const *version_control_context;
+ static bool remove_empty_files;
+@@ -196,7 +197,8 @@ main (int argc, char **argv)
+     if (set_utc && setenv ("TZ", "UTC0", 1) < 0)
+       pfatal ("setenv");
+ 
+-    backup_if_mismatch = ! posixly_correct;
++    if (!backup_if_mismatch_specified)
++      backup_if_mismatch = !posixly_correct;
+     if (make_backups | backup_if_mismatch)
+       backup_type = get_version (version_control_context, version_control);
+ 
+@@ -1050,9 +1052,11 @@ get_some_switches (int argc, char **argv)
+ 		usage (stdout, EXIT_SUCCESS);
+ 	    case CHAR_MAX + 5:
+ 		backup_if_mismatch = true;
++		backup_if_mismatch_specified = true;
+ 		break;
+ 	    case CHAR_MAX + 6:
+ 		backup_if_mismatch = false;
++		backup_if_mismatch_specified = true;
+ 		break;
+ 	    case CHAR_MAX + 7:
+ 		posixly_correct = true;
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 43ddf66..acb449a 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -50,6 +50,7 @@ TESTS = \
+ 	mixed-patch-types \
+ 	munged-context-format \
+ 	need-filename \
++	no-backup \
+ 	no-mode-change-git-diff \
+ 	no-newline-triggers-assert \
+ 	preserve-c-function-names \
+diff --git a/tests/no-backup b/tests/no-backup
+new file mode 100644
+index 0000000..57b73fa
+--- /dev/null
++++ b/tests/no-backup
+@@ -0,0 +1,56 @@
++# Copyright 2025 Free Software Foundation, Inc.
++#
++# Copying and distribution of this file, with or without modification,
++# in any medium, are permitted without royalty provided the copyright
++# notice and this notice are preserved.
++
++# Test the --no-backup-if-mismatch option
++
++. $srcdir/test-lib.sh
++
++require cat
++use_local_patch
++use_tmpdir
++
++# ==============================================================
++
++cat >my_file <<'EOF'
++/* ... */
++void baz();
++
++
++void baz() {
++	/* ... */
++}
++
++int main() {
++	int foo;
++	int bar;
++
++	/* ... */
++	baz();
++}
++EOF
++
++cat >my_file.patch <<'EOF'
++--- my_file	2025-02-16 11:22:12.881765792 +0000
+++++ my_file_new	2025-02-16 11:22:12.881796732 +0000
++@@ -2,7 +2,7 @@
++ void baz();
++
++ void baz() {
++-	/* ... */
+++	// ...
++ }
++
++ int main() {
++EOF
++
++unset POSIXLY_CORRECT
++
++check 'patch -N --no-backup-if-mismatch <my_file.patch || echo "Status: $?"' <<'EOF'
++patching file my_file
++Hunk #1 succeeded at 3 with fuzz 1 (offset 1 line).
++EOF
++
++ncheck 'test ! -f my_file.orig'
+-- 
+2.45.3
+

diff --git a/sys-devel/patch/files/patch-2.7.6_p20250206-traditional-diff-lines.patch b/sys-devel/patch/files/patch-2.7.6_p20250206-traditional-diff-lines.patch
new file mode 100644
index 000000000000..3d9d3109e91c
--- /dev/null
+++ b/sys-devel/patch/files/patch-2.7.6_p20250206-traditional-diff-lines.patch
@@ -0,0 +1,114 @@
+From 29fced6251928e6334fa15fd28bf2c198acd4cd4 Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Wed, 26 Feb 2025 16:44:48 -0800
+Subject: [PATCH 1/2] Count traditional diff pattern lines correctly
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes a bug I introduced on Thu Sep 5 16:37:50 2024 -0700.
+Problem reported by Petr Vaněk in:
+https://lists.gnu.org/archive/html/bug-patch/2025-02/msg00017.html
+* src/pch.c (another_hunk): Fix method for counting number
+of lines in a traditional diff hunk.
+---
+ src/pch.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/pch.c b/src/pch.c
+index 63c9a0c..d9f5c61 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -1765,9 +1765,10 @@ another_hunk (enum diff difftype, bool rev)
+ 	if (*s == ',') {
+ 	    idx_t last;
+ 	    s = scan_linenum (s + 1, &last);
+-	    if (p_first >= IDX_MAX - p_ptrn_lines)
++	    ptrdiff_t diff = last - p_first;
++	    if (! (-1 <= diff && diff < IDX_MAX))
+ 	      malformed ();
+-	    p_ptrn_lines += 1 - p_first;
++	    p_ptrn_lines = diff + 1;
+ 	}
+ 	else
+ 	    p_ptrn_lines = (*s != 'a');
+-- 
+2.45.3
+
+
+From b3d0c933389208ccac795a1b517c5a8b11cc012e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <arkamar@gentoo.org>
+Date: Wed, 26 Feb 2025 16:44:48 -0800
+Subject: [PATCH 2/2] Regression in commit abe92e8010ab affecting MariaDB tests
+
+I have disovered a regression in commit abe92e8010ab ("Prefer idx_t,
+ptrdiff_t to lin") while I was running MariaDB tests. The regression is
+related to a diff file [1], where the patch fails to apply it with
+following error:
+
+  patch: **** '---' expected at line 2 of patch
+
+To illustrate the issue, I have attached a git patch containing a
+testcase with simplified reproducer.
+
+[1] https://github.com/MariaDB/server/blob/mariadb-10.6.21/mysql-test/suite/innodb/r/innodb-wl5522%2Cstrict_crc32.rdiff file
+---
+ tests/Makefile.am             |  1 +
+ tests/regression-abe92e8010ab | 33 +++++++++++++++++++++++++++++++++
+ 2 files changed, 34 insertions(+)
+ create mode 100644 tests/regression-abe92e8010ab
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index acb449a..8f1a248 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -57,6 +57,7 @@ TESTS = \
+ 	preserve-mode-and-timestamp \
+ 	quoted-filenames \
+ 	read-only-files \
++	regression-abe92e8010ab \
+ 	reject-format \
+ 	remember-backup-files \
+ 	remember-reject-files \
+diff --git a/tests/regression-abe92e8010ab b/tests/regression-abe92e8010ab
+new file mode 100644
+index 0000000..0e11e34
+--- /dev/null
++++ b/tests/regression-abe92e8010ab
+@@ -0,0 +1,33 @@
++. $srcdir/test-lib.sh
++
++require cat
++use_local_patch
++use_tmpdir
++
++cat > f <<EOF
++1
++2
++test:
++a
++4
++EOF
++
++cat > f.diff <<EOF
++2,3c2
++< test:
++< a
++---
++> 3
++EOF
++
++check 'patch f < f.diff' <<EOF
++patching file f
++Hunk #1 succeeded at 3 (offset 1 line).
++EOF
++
++check 'cat f' <<EOF
++1
++2
++3
++4
++EOF
+-- 
+2.45.3
+

diff --git a/sys-devel/patch/patch-2.7.6_p20250206.ebuild b/sys-devel/patch/patch-2.7.6_p20250206-r1.ebuild
similarity index 85%
rename from sys-devel/patch/patch-2.7.6_p20250206.ebuild
rename to sys-devel/patch/patch-2.7.6_p20250206-r1.ebuild
index 5e593eb27c80..ebd328194d67 100644
--- a/sys-devel/patch/patch-2.7.6_p20250206.ebuild
+++ b/sys-devel/patch/patch-2.7.6_p20250206-r1.ebuild
@@ -3,6 +3,10 @@
 
 EAPI=8
 
+WANT_AUTOCONF=none
+WANT_LIBTOOL=none
+inherit autotools
+
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/patch.asc
 inherit flag-o-matic verify-sig
 
@@ -36,6 +40,13 @@ BDEPEND="
 	verify-sig? ( >=sec-keys/openpgp-keys-patch-20250206 )
 "
 
+PATCHES=(
+	# backport fix for https://bugs.gentoo.org/949834
+	"${FILESDIR}"/${P}-no-backup-if-mismatch-regression.patch
+	# backport https://lists.gnu.org/archive/html/bug-patch/2025-02/msg00017.html
+	"${FILESDIR}"/${P}-traditional-diff-lines.patch
+)
+
 src_unpack() {
 	if [[ ${PV} == 9999 ]] ; then
 		git-r3_src_unpack
@@ -49,6 +60,11 @@ src_unpack() {
 	default
 }
 
+src_prepare() {
+	default
+	eautomake
+}
+
 src_configure() {
 	use static && append-ldflags -static
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-27  5:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-27  5:54 [gentoo-commits] repo/gentoo:master commit in: sys-devel/patch/, sys-devel/patch/files/ Eli Schwartz
  -- strict thread matches above, loose matches on Subject: below --
2025-02-05 16:51 Sam James
2018-02-12 15:14 Thomas Deutschmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox