!23 update to 3.10

From: @dillon_chen 
Reviewed-by: @overweight 
Signed-off-by: @overweight
This commit is contained in:
openeuler-ci-bot 2023-07-12 08:33:04 +00:00 committed by Gitee
commit 523765dc2f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 63 additions and 214 deletions

View File

@ -1,112 +0,0 @@
From ba08fbbb0ca5da455bf695236c57bc50e7faed50 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
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 <http://bugs.gnu.org/61193>.
+
+. "${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

View File

@ -1,45 +0,0 @@
From aa13187f2a982a2d3d46c93cd08691960915ac74 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@meta.com>
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

View File

@ -0,0 +1,27 @@
From cb52fa88d5f2d9bc4894a7eccd90fdc2e03f5af4 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Tue, 4 Jul 2023 18:45:33 +0200
Subject: [PATCH] diff: Fix output of "diff -l -y" for non-ASCII input files
* src/side.c (print_half_line): Output the multibyte character to out,
not stdout.
---
src/side.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/side.c b/src/side.c
index 2f566f8..46ef095 100644
--- a/src/side.c
+++ b/src/side.c
@@ -146,7 +146,7 @@ print_half_line (char const *const *line, intmax_t indent, intmax_t out_bound)
if (in_position <= out_bound)
{
out_position = in_position;
- fwrite (tp0, 1, bytes, stdout);
+ fwrite (tp0, 1, bytes, out);
}
text_pointer = tp0 + bytes;
break;
--
2.34.1

BIN
diffutils-3.10.tar.xz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,23 +0,0 @@
Reference:https://src.fedoraproject.org/rpms/diffutils/blob/rawhide/f/diffutils-cmp-s-empty.patch
Conflict:NA
diff -up diffutils-3.6/src/cmp.c.cmp-s-empty diffutils-3.6/src/cmp.c
--- diffutils-3.6/src/cmp.c.cmp-s-empty 2017-05-18 18:39:59.000000000 +0100
+++ diffutils-3.6/src/cmp.c 2017-05-22 10:53:28.477147864 +0100
@@ -330,12 +330,15 @@ 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
&& S_ISREG (stat_buf[0].st_mode)
- && S_ISREG (stat_buf[1].st_mode))
+ && S_ISREG (stat_buf[1].st_mode)
+ && stat_buf[0].st_size > 0
+ && stat_buf[1].st_size > 0)
{
off_t s0 = stat_buf[0].st_size - file_position (0);
off_t s1 = stat_buf[1].st_size - file_position (1);

View File

@ -1,9 +1,6 @@
Reference:https://src.fedoraproject.org/rpms/diffutils/blob/rawhide/f/diffutils-i18n.patch
Conflict:NA
diff -up diffutils-3.9/src/diff.c.i18n diffutils-3.9/src/diff.c
--- diffutils-3.9/src/diff.c.i18n 2023-01-02 01:18:33.000000000 +0000
+++ diffutils-3.9/src/diff.c 2023-01-16 14:40:53.841265893 +0000
diff -up diffutils-3.10/src/diff.c.i18n diffutils-3.10/src/diff.c
--- diffutils-3.10/src/diff.c.i18n 2023-05-20 11:17:26.000000000 +0200
+++ diffutils-3.10/src/diff.c 2023-06-29 13:24:19.567608253 +0200
@@ -76,6 +76,8 @@ static _Noreturn void try_help (char con
static void check_stdout (void);
static void usage (void);
@ -13,7 +10,7 @@ diff -up diffutils-3.9/src/diff.c.i18n diffutils-3.9/src/diff.c
/* If comparing directories, compare their common subdirectories
recursively. */
static bool recursive;
@@ -303,6 +305,13 @@ main (int argc, char **argv)
@@ -310,6 +312,14 @@ main (int argc, char **argv)
presume_output_tty = false;
xstdopen ();
@ -23,16 +20,17 @@ diff -up diffutils-3.9/src/diff.c.i18n diffutils-3.9/src/diff.c
+ else
+#endif
+ lines_differ = lines_differ_singlebyte;
+
+
/* Decode the options. */
while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
diff -up diffutils-3.9/src/diff.h.i18n diffutils-3.9/src/diff.h
--- diffutils-3.9/src/diff.h.i18n 2023-01-02 01:18:33.000000000 +0000
+++ diffutils-3.9/src/diff.h 2023-01-16 14:41:58.620317020 +0000
@@ -23,6 +23,17 @@
#include <stdio.h>
#include <unlocked-io.h>
while ((c = getopt_long (argc, argv, shortopts, longopts, nullptr)) != -1)
diff -up diffutils-3.10/src/diff.h.i18n diffutils-3.10/src/diff.h
--- diffutils-3.10/src/diff.h.i18n 2023-05-20 11:37:55.000000000 +0200
+++ diffutils-3.10/src/diff.h 2023-06-29 13:25:49.451271873 +0200
@@ -33,6 +33,17 @@ _GL_INLINE_HEADER_BEGIN
# define XTERN extern
#endif
+/* For platforms which support the ISO C ammendment 1 functionality we
+ support user-defined character classes. */
@ -41,14 +39,14 @@ diff -up diffutils-3.9/src/diff.h.i18n diffutils-3.9/src/diff.h
+# include <wchar.h>
+# include <wctype.h>
+# if defined (HAVE_MBRTOWC)
+# define HANDLE_MULTIBYTE 1
+# define HANDLE_MULTIBYTE 1
+# endif
+#endif
+
/* What kind of changes a hunk contains. */
enum changes
{
@@ -389,7 +400,11 @@ extern void print_sdiff_script (struct c
@@ -392,7 +403,11 @@ extern void print_sdiff_script (struct c
/* util.c */
extern char const change_letter[4];
extern char const pr_program[];
@ -61,9 +59,9 @@ diff -up diffutils-3.9/src/diff.h.i18n diffutils-3.9/src/diff.h
extern lin translate_line_number (struct file_data const *, lin);
extern struct change *find_change (struct change *);
extern struct change *find_reverse_change (struct change *);
diff -up diffutils-3.9/src/io.c.i18n diffutils-3.9/src/io.c
--- diffutils-3.9/src/io.c.i18n 2023-01-02 01:18:33.000000000 +0000
+++ diffutils-3.9/src/io.c 2023-01-16 14:40:53.841265893 +0000
diff -up diffutils-3.10/src/io.c.i18n diffutils-3.10/src/io.c
--- diffutils-3.10/src/io.c.i18n 2023-05-20 11:17:26.000000000 +0200
+++ diffutils-3.10/src/io.c 2023-06-29 13:20:52.457820950 +0200
@@ -23,6 +23,7 @@
#include <cmpbuf.h>
#include <file-type.h>
@ -72,7 +70,7 @@ diff -up diffutils-3.9/src/io.c.i18n diffutils-3.9/src/io.c
/* Rotate an unsigned value to the left. */
#define ROL(v, n) ((v) << (n) | (v) >> (sizeof (v) * CHAR_BIT - (n)))
@@ -214,6 +215,28 @@ slurp (struct file_data *current)
@@ -223,6 +224,28 @@ slurp (struct file_data *current)
/* Split the file into lines, simultaneously computing the equivalence
class for each line. */
@ -101,7 +99,7 @@ diff -up diffutils-3.9/src/io.c.i18n diffutils-3.9/src/io.c
static void
find_and_hash_each_line (struct file_data *current)
@@ -240,12 +263,300 @@ find_and_hash_each_line (struct file_dat
@@ -249,12 +272,300 @@ find_and_hash_each_line (struct file_dat
bool same_length_diff_contents_compare_anyway =
diff_length_compare_anyway | ig_case;
@ -402,7 +400,7 @@ diff -up diffutils-3.9/src/io.c.i18n diffutils-3.9/src/io.c
/* Hash this line until we find a newline. */
switch (ig_white_space)
{
@@ -396,7 +707,7 @@ find_and_hash_each_line (struct file_dat
@@ -405,7 +716,7 @@ find_and_hash_each_line (struct file_dat
else if (!diff_length_compare_anyway)
continue;
@ -411,10 +409,10 @@ diff -up diffutils-3.9/src/io.c.i18n diffutils-3.9/src/io.c
break;
}
diff -up diffutils-3.9/src/util.c.i18n diffutils-3.9/src/util.c
--- diffutils-3.9/src/util.c.i18n 2023-01-02 01:18:33.000000000 +0000
+++ diffutils-3.9/src/util.c 2023-01-16 14:40:53.842265909 +0000
@@ -1084,7 +1084,8 @@ finish_output (void)
diff -up diffutils-3.10/src/util.c.i18n diffutils-3.10/src/util.c
--- diffutils-3.10/src/util.c.i18n 2023-02-19 19:04:39.000000000 +0100
+++ diffutils-3.10/src/util.c 2023-06-29 13:20:52.457820950 +0200
@@ -1085,7 +1085,8 @@ finish_output (void)
Return nonzero if the lines differ. */
bool
@ -424,7 +422,7 @@ diff -up diffutils-3.9/src/util.c.i18n diffutils-3.9/src/util.c
{
register char const *t1 = s1;
register char const *t2 = s2;
@@ -1240,6 +1241,354 @@ lines_differ (char const *s1, char const
@@ -1241,6 +1242,354 @@ lines_differ (char const *s1, char const
return true;
}

View File

@ -1,16 +1,14 @@
Name: diffutils
Version: 3.9
Release: 2
Version: 3.10
Release: 1
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
Patch1: diffutils-cmp-s-empty.patch
Patch2: diffutils-i18n.patch
Patch1: diffutils-i18n.patch
#Fix output of "diff -l -y" for non-ASCII input files
Patch2: diff-Fix-output-of-diff-l-y-for-non-ASCII-input-file.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
@ -58,6 +56,12 @@ cat tests/test-suite.log
%exclude %{_infodir}/dir
%changelog
* Wed Jul 12 2023 dillon chen <dillon.chen@gmail.com> - 3.10-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update version to 3.10
* Wed Mar 8 2023 Jiayi Chen <chenjiayi22@huawei.com> - 3.9-2
- Type:bugfix
- ID:NA