From 0f17951a0b9c486e2e9cfa862b7bff97cb1131ac Mon Sep 17 00:00:00 2001 From: Jiayi Chen Date: Sun, 26 Feb 2023 06:56:06 +0800 Subject: [PATCH] fix diff -D option failed --- ...-diff-fix-bug-where--D-does-not-work.patch | 112 ++++++++++++++++++ ...ort-maint-post-release-administrivia.patch | 45 +++++++ diffutils.spec | 11 +- 3 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 backport-diff-fix-bug-where--D-does-not-work.patch create mode 100644 backport-maint-post-release-administrivia.patch diff --git a/backport-diff-fix-bug-where--D-does-not-work.patch b/backport-diff-fix-bug-where--D-does-not-work.patch new file mode 100644 index 0000000..7138bc0 --- /dev/null +++ b/backport-diff-fix-bug-where--D-does-not-work.patch @@ -0,0 +1,112 @@ +From ba08fbbb0ca5da455bf695236c57bc50e7faed50 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Fri, 10 Feb 2023 15:33:40 -0800 +Subject: diff: fix bug where -D does not work +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Problem reported by Robert Webb (bug#61193). +* NEWS: Mention this. +* src/diff.c (main): Omit stray ‘sizeof’. +* tests/ifdef: New test. +* tests/Makefile.am (TESTS): Add it. + +Reference:https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=ba08fbbb0ca5da455bf695236c57bc50e7faed50 +Conflict:NA + +--- + NEWS | 5 +++++ + src/diff.c | 2 +- + tests/Makefile.am | 1 + + tests/ifdef | 37 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 44 insertions(+), 1 deletion(-) + create mode 100755 tests/ifdef + +diff --git a/NEWS b/NEWS +index ad9c6cc..f146730 100644 +--- a/NEWS ++++ b/NEWS +@@ -2,6 +2,11 @@ GNU diffutils NEWS -*- outline -*- + + * Noteworthy changes in release ?.? (????-??-??) [?] + ++** Bug fixes ++ ++ diff -D no longer fails to output #ifndef lines. ++ [bug#61193 introduced in 3.9] ++ + + * Noteworthy changes in release 3.9 (2023-01-15) [stable] + +diff --git a/src/diff.c b/src/diff.c +index dd6f63b..2b4834f 100644 +--- a/src/diff.c ++++ b/src/diff.c +@@ -416,7 +416,7 @@ main (int argc, char **argv) + char *base = b; + int changes = 0; + +- for (i = 0; i < sizeof sizeof C_ifdef_group_formats; i++) ++ for (i = 0; i < sizeof C_ifdef_group_formats; i++) + { + char ch = C_ifdef_group_formats[i]; + switch (ch) +diff --git a/tests/Makefile.am b/tests/Makefile.am +index d98df82..624192d 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -10,6 +10,7 @@ TESTS = \ + diff3 \ + excess-slash \ + help-version \ ++ ifdef \ + invalid-re \ + function-line-vs-leading-space \ + ignore-matching-lines \ +diff --git a/tests/ifdef b/tests/ifdef +new file mode 100755 +index 0000000..d3b05dd +--- /dev/null ++++ b/tests/ifdef +@@ -0,0 +1,37 @@ ++#!/bin/sh ++# --ifdef ++ ++# Bug reported by Robert Webb in . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++ ++fail=0 ++ ++cat <<'EOF' >a ++1 ++2 ++3 ++4 ++5 ++EOF ++ ++cat <<'EOF' >b ++1 ++4 ++5 ++EOF ++ ++cat <<'EOF' >exp ++1 ++#ifndef ZZZ ++2 ++3 ++#endif /* ! ZZZ */ ++4 ++5 ++EOF ++ ++returns_ 1 diff -D ZZZ a b >out 2>err || fail=1 ++compare exp out || fail=1 ++ ++Exit $fail +-- +cgit v1.1 + diff --git a/backport-maint-post-release-administrivia.patch b/backport-maint-post-release-administrivia.patch new file mode 100644 index 0000000..df9078a --- /dev/null +++ b/backport-maint-post-release-administrivia.patch @@ -0,0 +1,45 @@ +From aa13187f2a982a2d3d46c93cd08691960915ac74 Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Sun, 15 Jan 2023 13:25:29 -0800 +Subject: maint: post-release administrivia + +* NEWS: Add header line for next release. +* cfg.mk (old_NEWS_hash): Auto-update. + +Reference:https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=aa13187f2a982a2d3d46c93cd08691960915ac74 +Conflict:remove change on .prev-version + +--- + NEWS | 3 +++ + cfg.mk | 2 +- + 2 files changed, 4 insertions(+), 1 deletions(-) + +diff --git a/NEWS b/NEWS +index b410596..ad9c6cc 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,5 +1,8 @@ + GNU diffutils NEWS -*- outline -*- + ++* Noteworthy changes in release ?.? (????-??-??) [?] ++ ++ + * Noteworthy changes in release 3.9 (2023-01-15) [stable] + + ** Bug fixes +diff --git a/cfg.mk b/cfg.mk +index 142a9ce..3c10efb 100644 +--- a/cfg.mk ++++ b/cfg.mk +@@ -36,7 +36,7 @@ announcement_Cc_ = $(translation_project_), $(PACKAGE)-devel@gnu.org + # Now that we have better tests, make this the default. + export VERBOSE = yes + +-old_NEWS_hash = 94e919f647d397a84992078ccedba212 ++old_NEWS_hash = cf070086af56e7394cc5a0c862d0cd11 + + # Tell maint.mk's syntax-check rules that diff gets config.h directly or + # via diff.h or system.h. +-- +cgit v1.1 + diff --git a/diffutils.spec b/diffutils.spec index eaaead9..2980f0c 100644 --- a/diffutils.spec +++ b/diffutils.spec @@ -1,6 +1,6 @@ Name: diffutils Version: 3.9 -Release: 1 +Release: 2 Summary: A GNU collection of diff utilities URL: http://www.gnu.org/software/diffutils/diffutils.html Source: ftp://ftp.gnu.org/gnu/diffutils/diffutils-%{version}.tar.xz @@ -8,6 +8,9 @@ Patch1: diffutils-cmp-s-empty.patch Patch2: diffutils-i18n.patch Patch3: diff3-set-flagging-to-true-in-X-option.patch +Patch4: backport-maint-post-release-administrivia.patch +Patch5: backport-diff-fix-bug-where--D-does-not-work.patch + License: GPLv3+ Provides: bundled(gnulib) BuildRequires: gcc, help2man, gettext-devel @@ -55,6 +58,12 @@ cat tests/test-suite.log %exclude %{_infodir}/dir %changelog +* Wed Mar 8 2023 Jiayi Chen - 3.9-2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix diff -D option failed + * Sat Jan 28 2023 Jiayi Chen - 3.9-1 - Type:enhancement - ID:NA