From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/, sys-apps/diffutils/
Date: Fri, 14 Mar 2025 06:46:25 +0000 (UTC) [thread overview]
Message-ID: <1741934749.277ce2dbccc1a02ddf2676c0ce4c39683b49de2f.sam@gentoo> (raw)
commit: 277ce2dbccc1a02ddf2676c0ce4c39683b49de2f
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 14 06:45:49 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 14 06:45:49 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=277ce2db
sys-apps/diffutils: backport regression fixes to 3.11
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/diffutils/diffutils-3.11-r2.ebuild | 67 +++++++++++++++++
.../files/diffutils-3.11-allocation-crash.patch | 29 ++++++++
.../files/diffutils-3.11-empty-files.patch | 83 ++++++++++++++++++++++
.../diffutils/files/diffutils-3.11-tests-seq.patch | 64 +++++++++++++++++
4 files changed, 243 insertions(+)
diff --git a/sys-apps/diffutils/diffutils-3.11-r2.ebuild b/sys-apps/diffutils/diffutils-3.11-r2.ebuild
new file mode 100644
index 000000000000..22e8514a4f1f
--- /dev/null
+++ b/sys-apps/diffutils/diffutils-3.11-r2.ebuild
@@ -0,0 +1,67 @@
+# 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/diffutils.asc
+inherit verify-sig
+
+DESCRIPTION="Tools to make diffs and compare files"
+HOMEPAGE="https://www.gnu.org/software/diffutils/"
+
+if [[ ${PV} == *_p* ]] ; then
+ # Subscribe to the 'platform-testers' ML to find these.
+ # Useful to test on our especially more niche arches and report issues upstream.
+ MY_COMMIT="242-d65b"
+ MY_P=${PN}-$(ver_cut 1-2).${MY_COMMIT}
+ SRC_URI="https://meyering.net/diff/${MY_P}.tar.xz"
+ SRC_URI+=" verify-sig? ( https://meyering.net/diff/${MY_P}.tar.xz.sig )"
+ S="${WORKDIR}"/${MY_P}
+else
+ SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+ SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${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-2"
+SLOT="0"
+IUSE="nls"
+
+BDEPEND="
+ nls? ( sys-devel/gettext )
+ verify-sig? ( sec-keys/openpgp-keys-diffutils )
+"
+RDEPEND="
+ nls? ( app-i18n/gnulib-l10n )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-empty-files.patch
+ "${FILESDIR}"/${P}-tests-seq.patch
+ "${FILESDIR}"/${P}-allocation-crash.patch
+)
+
+src_prepare() {
+ default
+
+ # Needed because of ${P}-diff-D-option-regression.patch
+ #touch man/diff.1 || die
+}
+
+src_configure() {
+ # Disable automagic dependency over libsigsegv; see bug #312351.
+ export ac_cv_libsigsegv=no
+
+ # required for >=glibc-2.26, bug #653914
+ use elibc_glibc && export gl_cv_func_getopt_gnu=yes
+
+ local myeconfargs=(
+ # Interferes with F_S (sets F_S=2)
+ --disable-gcc-warnings
+ --with-packager="Gentoo"
+ --with-packager-version="${PVR}"
+ --with-packager-bug-reports="https://bugs.gentoo.org/"
+ $(use_enable nls)
+ )
+ econf "${myeconfargs[@]}"
+}
diff --git a/sys-apps/diffutils/files/diffutils-3.11-allocation-crash.patch b/sys-apps/diffutils/files/diffutils-3.11-allocation-crash.patch
new file mode 100644
index 000000000000..3f80cd7e7c69
--- /dev/null
+++ b/sys-apps/diffutils/files/diffutils-3.11-allocation-crash.patch
@@ -0,0 +1,29 @@
+https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=e9f8e6a439fd607adbdd846ab93267dc367b5c79
+
+From e9f8e6a439fd607adbdd846ab93267dc367b5c79 Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Fri, 28 Feb 2025 22:53:28 -0800
+Subject: diff: fix allocation typo leading to crashes
+
+But reported by Nick Smallbone, with one-line fix by
+Collin Funk <https://bugs.gnu.org/76613>.
+* src/io.c (find_and_hash_each_line): Fix size computation.
+---
+ src/io.c | 2 +-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+--- a/src/io.c
++++ b/src/io.c
+@@ -1012,7 +1012,7 @@ find_and_hash_each_line (struct file_data *current)
+ linbuf += linbuf_base;
+ linbuf = xpalloc (linbuf, &n, 1, -1, sizeof *linbuf);
+ linbuf -= linbuf_base;
+- alloc_lines = n - linbuf_base;
++ alloc_lines = linbuf_base + n;
+ }
+ linbuf[line] = p;
+
+--
+cgit v1.1
+
+
diff --git a/sys-apps/diffutils/files/diffutils-3.11-empty-files.patch b/sys-apps/diffutils/files/diffutils-3.11-empty-files.patch
new file mode 100644
index 000000000000..1f78bce8d972
--- /dev/null
+++ b/sys-apps/diffutils/files/diffutils-3.11-empty-files.patch
@@ -0,0 +1,83 @@
+https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=6ce0ebd033c395265c262ae3aab6477a49d4c2f1
+
+From 6ce0ebd033c395265c262ae3aab6477a49d4c2f1 Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Thu, 20 Feb 2025 21:59:55 -0800
+Subject: diff: don't treat empty files as a different file type
+
+Reported by Kate Deplaix <kit-ty-kate@outlook.com> in
+<https://lists.gnu.org/r/bug-diffutils/2025-02/msg00005.html>.
+
+* src/diff.c (compare_prepped_files): Don't rely on string
+file type, as that might not agree with our idea of a file type.
+---
+ src/diff.c | 26 +++++++++++++-------------
+ 1 file changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/src/diff.c b/src/diff.c
+index fa6100e..6e1bbc5 100644
+--- a/src/diff.c
++++ b/src/diff.c
+@@ -1223,14 +1223,14 @@ compare_prepped_files (struct comparison const *parent,
+ the type is unusual, then simply report their type.
+ However, at the top level do this only if one file is a symlink
+ and the other is not. */
+- if (toplevel
+- ? (!S_ISLNK (cmp->file[0].stat.st_mode)
+- != !S_ISLNK (cmp->file[1].stat.st_mode))
+- : (cmp->file[0].filetype != cmp->file[1].filetype
+- || ! (S_ISREG (cmp->file[0].stat.st_mode)
+- || S_ISLNK (cmp->file[0].stat.st_mode)
+- || S_ISCHR (cmp->file[0].stat.st_mode)
+- || S_ISBLK (cmp->file[0].stat.st_mode))))
++ mode_t mode0 = cmp->file[0].stat.st_mode;
++ mode_t mode1 = cmp->file[1].stat.st_mode;
++ if (toplevel ? !S_ISLNK (mode0) != !S_ISLNK (mode1)
++ : S_ISREG (mode0) ? !S_ISREG (mode1)
++ : S_ISLNK (mode0) ? !S_ISLNK (mode1)
++ : S_ISCHR (mode0) ? !S_ISCHR (mode1)
++ : S_ISBLK (mode0) ? !S_ISBLK (mode1)
++ : true)
+ {
+ /* POSIX 1003.1-2017 says any message will do, so long as it
+ contains the file names. */
+@@ -1244,7 +1244,7 @@ compare_prepped_files (struct comparison const *parent,
+ }
+
+ /* If both files are symlinks, compare symlink contents. */
+- if (S_ISLNK (cmp->file[0].stat.st_mode))
++ if (S_ISLNK (mode0))
+ {
+ /* We get here only if we are not dereferencing symlinks. */
+ dassert (no_dereference_symlinks);
+@@ -1295,7 +1295,7 @@ compare_prepped_files (struct comparison const *parent,
+ and report file types of all other non-regular files.
+ POSIX 1003.1-2017 says any message will do,
+ so long as it contains the file names. */
+- if (!toplevel && !S_ISREG (cmp->file[0].stat.st_mode))
++ if (!toplevel && !S_ISREG (mode0))
+ {
+ if (cmp->file[0].stat.st_rdev == cmp->file[1].stat.st_rdev)
+ return EXIT_SUCCESS;
+@@ -1311,7 +1311,7 @@ compare_prepped_files (struct comparison const *parent,
+ for (int i = 0; i < n_num; i++)
+ sprintf (numbuf[i], "%"PRIdMAX, num[i]);
+
+- message ((S_ISCHR (cmp->file[0].stat.st_mode)
++ message ((S_ISCHR (mode0)
+ ? ("Character special files %s (%s, %s)"
+ " and %s (%s, %s) differ\n")
+ : ("Block special files %s (%s, %s)"
+@@ -1323,8 +1323,8 @@ compare_prepped_files (struct comparison const *parent,
+ }
+
+ if (files_can_be_treated_as_binary
+- && S_ISREG (cmp->file[0].stat.st_mode)
+- && S_ISREG (cmp->file[1].stat.st_mode)
++ && S_ISREG (mode0)
++ && S_ISREG (mode1)
+ && cmp->file[0].stat.st_size != cmp->file[1].stat.st_size
+ && 0 <= cmp->file[0].stat.st_size
+ && 0 <= cmp->file[1].stat.st_size)
+--
+cgit v1.1
diff --git a/sys-apps/diffutils/files/diffutils-3.11-tests-seq.patch b/sys-apps/diffutils/files/diffutils-3.11-tests-seq.patch
new file mode 100644
index 000000000000..407b76ac05f7
--- /dev/null
+++ b/sys-apps/diffutils/files/diffutils-3.11-tests-seq.patch
@@ -0,0 +1,64 @@
+https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=58e734dedd2ed84b559c313b4fbe8e2a1b987a1d
+
+From 58e734dedd2ed84b559c313b4fbe8e2a1b987a1d Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Fri, 28 Feb 2025 14:32:44 -0800
+Subject: tests: make seq replacement more available
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This refactoring should let other future tests use ‘seq’.
+* tests/diff3 (seq): Move from here ...
+* tests/init.cfg: ... to here.
+---
+ tests/diff3 | 12 ------------
+ tests/init.cfg | 12 ++++++++++++
+ 2 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/tests/diff3 b/tests/diff3
+index e468243..c2079ec 100644
+--- a/tests/diff3
++++ b/tests/diff3
+@@ -3,18 +3,6 @@
+
+ . "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+-# Some systems lack seq.
+-# A limited replacement for seq: handle 1 or 2 args; increment must be 1
+-seq()
+-{
+- case $# in
+- 1) start=1 final=$1;;
+- 2) start=$1 final=$2;;
+- *) echo you lose 1>&2; exit 1;;
+- esac
+- awk 'BEGIN{for(i='$start';i<='$final';i++) print i}' < /dev/null
+-}
+-
+ echo a > a || framework_failure_
+ echo b > b || framework_failure_
+ echo c > c || framework_failure_
+diff --git a/tests/init.cfg b/tests/init.cfg
+index 8b3b107..66c26d6 100644
+--- a/tests/init.cfg
++++ b/tests/init.cfg
+@@ -120,4 +120,16 @@ require_utf8_locale_()
+ test $found_working_tr = 1 || skip_ "failed to find a working tr program"
+ }
+
++# Some systems lack seq.
++# A limited replacement for seq: handle 1 or 2 args; increment must be 1
++seq()
++{
++ case $# in
++ 1) start=1 final=$1;;
++ 2) start=$1 final=$2;;
++ *) echo you lose 1>&2; exit 1;;
++ esac
++ awk 'BEGIN{for(i='$start';i<='$final';i++) print i}' < /dev/null
++}
++
+ sanitize_path_
+--
+cgit v1.1
next reply other threads:[~2025-03-14 6:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 6:46 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-02-12 6:22 [gentoo-commits] repo/gentoo:master commit in: sys-apps/diffutils/files/, sys-apps/diffutils/ Sam James
2023-01-29 7:33 Sam James
2022-04-25 10:11 WANG Xuerui
2021-11-17 2:41 Georgy Yakovlev
2016-08-15 19:55 Lars Wendler
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=1741934749.277ce2dbccc1a02ddf2676c0ce4c39683b49de2f.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