From: "Eli Schwartz" <eschwartz@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/patch/, sys-devel/patch/files/
Date: Thu, 27 Feb 2025 05:54:40 +0000 (UTC) [thread overview]
Message-ID: <1740635624.0bc98b5f3b280ab33857da098557edf1df1d4b14.eschwartz@gentoo> (raw)
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
next reply other threads:[~2025-02-27 5:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 5:54 Eli Schwartz [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-03-21 21:04 [gentoo-commits] repo/gentoo:master commit in: sys-devel/patch/, sys-devel/patch/files/ Sam James
2025-02-05 16:51 Sam James
2018-02-12 15:14 Thomas Deutschmann
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=1740635624.0bc98b5f3b280ab33857da098557edf1df1d4b14.eschwartz@gentoo \
--to=eschwartz@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