From 112f3556e3c802293668e54571cebcbf84b91b64 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Wed, 24 Jul 2024 11:59:20 +0200 Subject: [PATCH] fix a regression, cmp-s returns 1 even if files are identical --- diffutils-3.10-cmp-s-empty.patch | 19 +++++++++++++++++++ diffutils.spec | 12 +++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 diffutils-3.10-cmp-s-empty.patch diff --git a/diffutils-3.10-cmp-s-empty.patch b/diffutils-3.10-cmp-s-empty.patch new file mode 100644 index 0000000..80bd4b9 --- /dev/null +++ b/diffutils-3.10-cmp-s-empty.patch @@ -0,0 +1,19 @@ +diff -up diffutils-3.10/src/cmp.c.orig diffutils-3.10/src/cmp.c +--- diffutils-3.10/src/cmp.c.orig 2024-07-23 12:27:16.243455513 +0200 ++++ diffutils-3.10/src/cmp.c 2024-07-23 12:31:55.560196269 +0200 +@@ -343,12 +343,13 @@ main (int argc, char **argv) + + /* If only a return code is needed, + and if both input descriptors are associated with plain files, ++ and if both files are larger than 0 bytes (procfs files are always 0), + conclude that the files differ if they have different sizes + and if more bytes will be compared than are in the smaller file. */ + + if (comparison_type == type_status +- && 0 <= stat_buf[0].st_size && S_ISREG (stat_buf[0].st_mode) +- && 0 <= stat_buf[1].st_size && S_ISREG (stat_buf[1].st_mode)) ++ && 0 < stat_buf[0].st_size && S_ISREG (stat_buf[0].st_mode) ++ && 0 < stat_buf[1].st_size && S_ISREG (stat_buf[1].st_mode)) + { + off_t s0 = stat_buf[0].st_size - file_position (0); + off_t s1 = stat_buf[1].st_size - file_position (1); diff --git a/diffutils.spec b/diffutils.spec index 2aec6e5..d17ceb7 100644 --- a/diffutils.spec +++ b/diffutils.spec @@ -1,11 +1,13 @@ Summary: GNU collection of diff utilities Name: diffutils Version: 3.10 -Release: 6%{?dist} +Release: 7%{?dist} URL: https://www.gnu.org/software/diffutils/diffutils.html Source: https://ftp.gnu.org/gnu/diffutils/diffutils-%{version}.tar.xz +# Multibyte Patch0: diffutils-i18n.patch Patch1: 0001-diff-Fix-output-of-diff-l-y-for-non-ASCII-input-file.patch +Patch2: diffutils-3.10-cmp-s-empty.patch License: GPL-3.0-or-later Provides: bundled(gnulib) BuildRequires: gcc @@ -27,10 +29,7 @@ to merge two files interactively. Install diffutils if you need to compare text files. %prep -%setup -q -# Multibyte -%patch -P0 -p1 -b .i18n -%patch -P1 -p1 -b .fix-output-of-diff-l-y-for-non-ASCII-input-file +%autosetup -p1 # Run autoreconf for aarch64 support (bug #925256). autoreconf @@ -58,6 +57,9 @@ make check %{_infodir}/diffutils.info* %changelog +* Tue Jul 23 2024 Than Ngo - 3.10-7 +- fix a regression, cmp-s returns 1 even if files are identical + * Wed Jul 17 2024 Fedora Release Engineering - 3.10-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild