mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-11 06:56:58 +02:00
sys-apps/diffutils: Sync with Gentoo
It's from Gentoo commit 277ce2dbccc1a02ddf2676c0ce4c39683b49de2f.
This commit is contained in:
parent
d4156c5f89
commit
2faaf4ed4d
67
sdk_container/src/third_party/portage-stable/sys-apps/diffutils/diffutils-3.11-r2.ebuild
vendored
Normal file
67
sdk_container/src/third_party/portage-stable/sys-apps/diffutils/diffutils-3.11-r2.ebuild
vendored
Normal file
@ -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[@]}"
|
||||||
|
}
|
@ -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
|
||||||
|
|
||||||
|
|
@ -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
|
@ -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
|
Loading…
Reference in New Issue
Block a user