From 4e425ec5a918ad1cdd42261dcf0b5c5bf0c5e681 Mon Sep 17 00:00:00 2001 From: Pablo Greco Date: Aug 10 2019 13:42:52 +0000 Subject: Fix cmp --- diff --git a/SOURCES/diffutils-cmp-sentinel.patch b/SOURCES/diffutils-cmp-sentinel.patch new file mode 100644 index 0000000..683d22e --- /dev/null +++ b/SOURCES/diffutils-cmp-sentinel.patch @@ -0,0 +1,51 @@ +From ffd63aedad3c0eb08ebb27103e5f242f8732dc0c Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Tue, 24 Jul 2018 10:18:28 -0700 +Subject: cmp: fix bug in -b diagnostic + +Problem reported by mancha (Bug#32249). +* src/cmp.c (count_newlines): Restore old value of sentinel. +* tests/cmp: Test for the bug. +--- + src/cmp.c | 2 ++ + tests/cmp | 10 ++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/src/cmp.c b/src/cmp.c +index 04638e3..2811392 100644 +--- a/src/cmp.c ++++ b/src/cmp.c +@@ -639,9 +639,11 @@ count_newlines (char *buf, size_t bufsize) + size_t count = 0; + char *p; + char *lim = buf + bufsize; ++ char ch = *lim; + *lim = '\n'; + for (p = buf; (p = rawmemchr (p, '\n')) != lim; p++) + count++; ++ *lim = ch; + return count; + } + +diff --git a/tests/cmp b/tests/cmp +index 160c1ea..ca0fe5e 100755 +--- a/tests/cmp ++++ b/tests/cmp +@@ -208,4 +208,14 @@ done >out1 + + compare exp1 out1 || fail=1 + ++printf 'bad\n' >bad ++printf 'bug\n' >bug ++echo LC_ALL=C cmp -b bad bug ++LC_ALL=C cmp -b bad bug ++test $? -eq 1 || fail=1 ++case `LC_ALL=C cmp -b bad bug` in ++ 'bad bug differ: byte 2, line 1 is '*' a '*' u') ;; ++ *) echo 'expected cmp -b to report a and u'; fail=1;; ++esac ++ + Exit $fail +-- +cgit v1.0-41-gc330 + diff --git a/SPECS/diffutils.spec b/SPECS/diffutils.spec index e9a937e..b967e6a 100644 --- a/SPECS/diffutils.spec +++ b/SPECS/diffutils.spec @@ -1,13 +1,14 @@ Summary: A GNU collection of diff utilities Name: diffutils Version: 3.6 -Release: 5%{?dist} +Release: 5%{?dist}.0.1 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-i18n.patch Patch3: diffutils-3.6-covscan.patch +Patch9999: diffutils-cmp-sentinel.patch License: GPLv3+ Requires(post): info Requires(preun): info @@ -37,6 +38,8 @@ Install diffutils if you need to compare text files. # covscan issues %patch3 -p1 -b .covscan +%patch9999 -p1 + # Run autoreconf for aarch64 support (bug #925256). autoreconf @@ -78,6 +81,9 @@ rm -rf $RPM_BUILD_ROOT %{_infodir}/diffutils.info*gz %changelog +* Sat Aug 10 2019 Pablo Greco - 3.6-5.0.1 +- Fix cmp + * Mon Aug 13 2018 Than Ngo - 3.6-5 - Resolves: #1606949, covscan issues