import diffutils-3.6-6.el8

This commit is contained in:
CentOS Sources 2020-04-28 05:42:43 -04:00 committed by Andrew Lukoshko
parent 7787d57c8c
commit 30cd070c92
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,45 @@
commit ffd63aedad3c0eb08ebb27103e5f242f8732dc0c
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue Jul 24 10:18:28 2018 -0700
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.
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

View File

@ -1,13 +1,14 @@
Summary: A GNU collection of diff utilities
Name: diffutils
Version: 3.6
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-i18n.patch
Patch3: diffutils-3.6-covscan.patch
Patch4: diffutils-3.6-shows_incorrect_data.patch
License: GPLv3+
Requires(post): info
Requires(preun): info
@ -34,9 +35,13 @@ Install diffutils if you need to compare text files.
%patch1 -p1 -b .cmp-s-empty
%patch2 -p1 -b .i18n
# covscan issues
%patch3 -p1 -b .covscan
# bz#1732960, cmp -b shows incorrect data
%patch4 -p1 -b .shows_incorrect_data
# Run autoreconf for aarch64 support (bug #925256).
autoreconf
@ -78,6 +83,9 @@ rm -rf $RPM_BUILD_ROOT
%{_infodir}/diffutils.info*gz
%changelog
* Tue Nov 19 2019 Than Ngo <than@redhat.com> - 3.6-6
- Resolves: #1732960 - cmp -b shows incorrect data
* Mon Aug 13 2018 Than Ngo <than@redhat.com> - 3.6-5
- Resolves: #1606949, covscan issues