From 018fcaab38cae90b3c86e75534d94fe8b415dbfb Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 07 2023 09:27:30 +0000 Subject: import diffutils-3.3-6.el7_9 --- diff --git a/SOURCES/diffutils-3.3-diffseq.patch b/SOURCES/diffutils-3.3-diffseq.patch index 3453224..994b381 100644 --- a/SOURCES/diffutils-3.3-diffseq.patch +++ b/SOURCES/diffutils-3.3-diffseq.patch @@ -1,208 +1,18 @@ -diff -up diffutils-3.3/lib/diffseq.h.me diffutils-3.3/lib/diffseq.h ---- diffutils-3.3/lib/diffseq.h.me 2018-08-10 14:26:48.940444056 +0200 -+++ diffutils-3.3/lib/diffseq.h 2018-08-10 14:26:50.453439777 +0200 -@@ -138,12 +132,6 @@ struct partition - /* Midpoints of this partition. */ - OFFSET xmid; - OFFSET ymid; -- -- /* True if low half will be analyzed minimally. */ -- bool lo_minimal; -- -- /* Likewise for high half. */ -- bool hi_minimal; - }; - - -@@ -175,7 +156,7 @@ struct partition - suboptimal diff output. It cannot cause incorrect diff output. */ - - static void --diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal, -+diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, - struct partition *part, struct context *ctxt) - { - OFFSET *const fd = ctxt->fdiag; /* Give the compiler a chance. */ -@@ -235,7 +216,6 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y - { - part->xmid = x; - part->ymid = y; -- part->lo_minimal = part->hi_minimal = true; - return; - } - } -@@ -268,14 +248,10 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y - { - part->xmid = x; - part->ymid = y; -- part->lo_minimal = part->hi_minimal = true; - return; - } - } - -- if (find_minimal) -- continue; -- - #ifdef USE_HEURISTIC - /* Heuristic: check occasionally for a diagonal that has made lots - of progress compared with the edit distance. If we have any -@@ -319,11 +295,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y - } - } - if (best > 0) -- { -- part->lo_minimal = true; -- part->hi_minimal = false; -- return; -- } -+ return; - } - - { -@@ -358,77 +330,10 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y - } - } - if (best > 0) -- { -- part->lo_minimal = false; -- part->hi_minimal = true; -- return; -- } -+ return; - } - } - #endif /* USE_HEURISTIC */ -- -- /* Heuristic: if we've gone well beyond the call of duty, give up -- and report halfway between our best results so far. */ -- if (c >= ctxt->too_expensive) -- { -- OFFSET fxybest; -- OFFSET fxbest IF_LINT (= 0); -- OFFSET bxybest; -- OFFSET bxbest IF_LINT (= 0); -- -- /* Find forward diagonal that maximizes X + Y. */ -- fxybest = -1; -- for (d = fmax; d >= fmin; d -= 2) -- { -- OFFSET x = MIN (fd[d], xlim); -- OFFSET y = x - d; -- if (ylim < y) -- { -- x = ylim + d; -- y = ylim; -- } -- if (fxybest < x + y) -- { -- fxybest = x + y; -- fxbest = x; -- } -- } -- -- /* Find backward diagonal that minimizes X + Y. */ -- bxybest = OFFSET_MAX; -- for (d = bmax; d >= bmin; d -= 2) -- { -- OFFSET x = MAX (xoff, bd[d]); -- OFFSET y = x - d; -- if (y < yoff) -- { -- x = yoff + d; -- y = yoff; -- } -- if (x + y < bxybest) -- { -- bxybest = x + y; -- bxbest = x; -- } -- } -- -- /* Use the better of the two diagonals. */ -- if ((xlim + ylim) - bxybest < fxybest - (xoff + yoff)) -- { -- part->xmid = fxbest; -- part->ymid = fxybest - fxbest; -- part->lo_minimal = true; -- part->hi_minimal = false; -- } -- else -- { -- part->xmid = bxbest; -- part->ymid = bxybest - bxbest; -- part->lo_minimal = false; -- part->hi_minimal = true; -- } -- return; -- } - } - #undef XREF_YREF_EQUAL - } -@@ -452,7 +354,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET y - - static bool - compareseq (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, -- bool find_minimal, struct context *ctxt) -+ struct context *ctxt) - { - #ifdef ELEMENT - ELEMENT const *xv = ctxt->xvec; /* Help the compiler. */ -@@ -498,12 +400,12 @@ compareseq (OFFSET xoff, OFFSET xlim, OF - struct partition part IF_LINT2 (= { .xmid = 0, .ymid = 0 }); - - /* Find a point of correspondence in the middle of the vectors. */ -- diag (xoff, xlim, yoff, ylim, find_minimal, &part, ctxt); -+ diag (xoff, xlim, yoff, ylim, &part, ctxt); - - /* Use the partitions to split this problem into subproblems. */ -- if (compareseq (xoff, part.xmid, yoff, part.ymid, part.lo_minimal, ctxt)) -+ if (compareseq (xoff, part.xmid, yoff, part.ymid, ctxt)) - return true; -- if (compareseq (part.xmid, xlim, part.ymid, ylim, part.hi_minimal, ctxt)) -+ if (compareseq (part.xmid, xlim, part.ymid, ylim, ctxt)) - return true; - } - diff -up diffutils-3.3/src/analyze.c.me diffutils-3.3/src/analyze.c ---- diffutils-3.3/src/analyze.c.me 2018-08-10 14:06:53.473858743 +0200 -+++ diffutils-3.3/src/analyze.c 2018-08-10 14:08:30.533579865 +0200 -@@ -542,7 +542,6 @@ diff_2_files (struct comparison *cmp) - { - struct context ctxt; - lin diags; -- lin too_expensive; - - /* Allocate vectors for the results of comparison: - a flag for each line of each file, saying whether that line -@@ -574,18 +573,11 @@ diff_2_files (struct comparison *cmp) - +--- diffutils-3.3/src/analyze.c.me 2022-12-13 23:52:03.027335306 +0100 ++++ diffutils-3.3/src/analyze.c 2022-12-13 23:56:10.918974724 +0100 +@@ -575,11 +575,12 @@ diff_2_files (struct comparison *cmp) ctxt.heuristic = speed_large_files; -- /* Set TOO_EXPENSIVE to be approximate square root of input size, + /* Set TOO_EXPENSIVE to be approximate square root of input size, - bounded below by 256. */ -- too_expensive = 1; -- for (; diags != 0; diags >>= 2) -- too_expensive <<= 1; ++ bounded below by 4096. 4096 seems to be good for ++ circa-2016 CPUs; see Bug#16848 and Bug#24715 */ + too_expensive = 1; + for (; diags != 0; diags >>= 2) + too_expensive <<= 1; - ctxt.too_expensive = MAX (256, too_expensive); -- ++ ctxt.too_expensive = MAX (4096, too_expensive); + files[0] = cmp->file[0]; files[1] = cmp->file[1]; - - compareseq (0, cmp->file[0].nondiscarded_lines, -- 0, cmp->file[1].nondiscarded_lines, minimal, &ctxt); -+ 0, cmp->file[1].nondiscarded_lines, &ctxt); - - free (ctxt.fdiag - (cmp->file[1].nondiscarded_lines + 1)); - -diff -up diffutils-3.3/src/diff.h.me diffutils-3.3/src/diff.h ---- diffutils-3.3/src/diff.h.me 2018-08-10 14:28:25.878169926 +0200 -+++ diffutils-3.3/src/diff.h 2018-08-10 14:28:40.739127903 +0200 -@@ -376,7 +376,7 @@ extern void print_sdiff_script (struct c - extern char const change_letter[4]; - extern char const pr_program[]; - extern char *concat (char const *, char const *, char const *); --extern bool (*lines_differ) (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE; -+extern bool (*lines_differ) (char const *, size_t, char const *, size_t); - extern bool lines_differ_singlebyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE; - #ifdef HANDLE_MULTIBYTE - extern bool lines_differ_multibyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE; diff --git a/SPECS/diffutils.spec b/SPECS/diffutils.spec index b08c54c..7a5a980 100644 --- a/SPECS/diffutils.spec +++ b/SPECS/diffutils.spec @@ -1,13 +1,15 @@ Summary: A GNU collection of diff utilities Name: diffutils Version: 3.3 -Release: 5%{?dist} +Release: 6%{?dist} Group: Applications/Text URL: http://www.gnu.org/software/diffutils/diffutils.html Source: ftp://ftp.gnu.org/gnu/diffutils/diffutils-%{version}.tar.xz Patch1: diffutils-cmp-s-empty.patch Patch2: diffutils-mkdir_p.patch Patch4: diffutils-i18n.patch +# reversing some of the changes made in diffutils-3.3-5 due to performance issue +# https://www.mail-archive.com/bug-diffutils@gnu.org/msg00919.html Patch5: diffutils-3.3-diffseq.patch License: GPLv3+ Requires(post): info @@ -39,7 +41,7 @@ Install diffutils if you need to compare text files. %patch4 -p1 -b .i18n -%patch5 -p1 -b .diffseq +%patch5 -p1 -b .garbage %build %configure @@ -74,6 +76,9 @@ rm -rf $RPM_BUILD_ROOT %{_infodir}/diffutils.info*gz %changelog +* Wed Feb 15 2023 Than Ngo - 3.3-6 +- Resolves: #2152980, regression + * Wed Nov 21 2018 Than Ngo - 3.3-5 - Resolves: #1611281, diff -y produces garbage