Compare commits

..

No commits in common. "40e556c1c06c20bc6edbe021cdf5849b3c5de606" and "ae028d11c6fd0c6645d0745a7b20764e444ff0b2" have entirely different histories.

6 changed files with 54 additions and 93 deletions

View File

@ -1,27 +0,0 @@
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

Binary file not shown.

BIN
diffutils-3.8.tar.xz Normal file

Binary file not shown.

View File

@ -0,0 +1,20 @@
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,7 +1,7 @@
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
diff -up diffutils-3.6/src/diff.c.i18n diffutils-3.6/src/diff.c
--- diffutils-3.6/src/diff.c.i18n 2017-05-06 20:02:54.000000000 +0100
+++ diffutils-3.6/src/diff.c 2017-05-22 10:52:21.989254674 +0100
@@ -76,6 +76,8 @@ static void try_help (char const *, char
static void check_stdout (void);
static void usage (void);
@ -10,7 +10,7 @@ diff -up diffutils-3.10/src/diff.c.i18n diffutils-3.10/src/diff.c
/* If comparing directories, compare their common subdirectories
recursively. */
static bool recursive;
@@ -310,6 +312,14 @@ main (int argc, char **argv)
@@ -298,6 +300,13 @@ main (int argc, char **argv)
presume_output_tty = false;
xstdopen ();
@ -20,17 +20,16 @@ diff -up diffutils-3.10/src/diff.c.i18n diffutils-3.10/src/diff.c
+ else
+#endif
+ lines_differ = lines_differ_singlebyte;
+
+
/* Decode the options. */
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
while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1)
diff -up diffutils-3.6/src/diff.h.i18n diffutils-3.6/src/diff.h
--- diffutils-3.6/src/diff.h.i18n 2017-01-01 11:22:36.000000000 +0000
+++ diffutils-3.6/src/diff.h 2017-05-22 10:51:09.050371844 +0100
@@ -23,6 +23,17 @@
#include <stdio.h>
#include <unlocked-io.h>
+/* For platforms which support the ISO C ammendment 1 functionality we
+ support user-defined character classes. */
@ -39,29 +38,29 @@ diff -up diffutils-3.10/src/diff.h.i18n diffutils-3.10/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
{
@@ -392,7 +403,11 @@ extern void print_sdiff_script (struct c
/* util.c */
@@ -381,7 +392,11 @@ extern void print_sdiff_script (struct c
extern char const change_letter[4];
extern char const pr_program[];
-extern bool lines_differ (char const *, char const *) ATTRIBUTE_PURE;
+extern bool (*lines_differ) (char const *, size_t, char const *, size_t) ATTRIBUTE_PURE;
+extern bool lines_differ_singlebyte (char const *, size_t, char const *, size_t) ATTRIBUTE_PURE;
extern char *concat (char const *, char const *, char const *);
-extern bool lines_differ (char const *, char const *) _GL_ATTRIBUTE_PURE;
+extern bool (*lines_differ) (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
+extern bool lines_differ_singlebyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
+#ifdef HANDLE_MULTIBYTE
+extern bool lines_differ_multibyte (char const *, size_t, char const *, size_t) ATTRIBUTE_PURE;
+extern bool lines_differ_multibyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
+#endif
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.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
diff -up diffutils-3.6/src/io.c.i18n diffutils-3.6/src/io.c
--- diffutils-3.6/src/io.c.i18n 2017-01-01 11:22:36.000000000 +0000
+++ diffutils-3.6/src/io.c 2017-05-22 10:51:09.050371844 +0100
@@ -23,6 +23,7 @@
#include <cmpbuf.h>
#include <file-type.h>
@ -70,7 +69,7 @@ diff -up diffutils-3.10/src/io.c.i18n diffutils-3.10/src/io.c
/* Rotate an unsigned value to the left. */
#define ROL(v, n) ((v) << (n) | (v) >> (sizeof (v) * CHAR_BIT - (n)))
@@ -223,6 +224,28 @@ slurp (struct file_data *current)
@@ -215,6 +216,28 @@ slurp (struct file_data *current)
/* Split the file into lines, simultaneously computing the equivalence
class for each line. */
@ -99,7 +98,7 @@ diff -up diffutils-3.10/src/io.c.i18n diffutils-3.10/src/io.c
static void
find_and_hash_each_line (struct file_data *current)
@@ -249,12 +272,300 @@ find_and_hash_each_line (struct file_dat
@@ -241,12 +264,300 @@ find_and_hash_each_line (struct file_dat
bool same_length_diff_contents_compare_anyway =
diff_length_compare_anyway | ig_case;
@ -400,7 +399,7 @@ diff -up diffutils-3.10/src/io.c.i18n diffutils-3.10/src/io.c
/* Hash this line until we find a newline. */
switch (ig_white_space)
{
@@ -405,7 +716,7 @@ find_and_hash_each_line (struct file_dat
@@ -397,7 +708,7 @@ find_and_hash_each_line (struct file_dat
else if (!diff_length_compare_anyway)
continue;
@ -409,10 +408,10 @@ diff -up diffutils-3.10/src/io.c.i18n diffutils-3.10/src/io.c
break;
}
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)
diff -up diffutils-3.6/src/util.c.i18n diffutils-3.6/src/util.c
--- diffutils-3.6/src/util.c.i18n 2017-05-18 18:39:59.000000000 +0100
+++ diffutils-3.6/src/util.c 2017-05-22 10:51:09.050371844 +0100
@@ -985,7 +985,8 @@ finish_output (void)
Return nonzero if the lines differ. */
bool
@ -422,7 +421,7 @@ diff -up diffutils-3.10/src/util.c.i18n diffutils-3.10/src/util.c
{
register char const *t1 = s1;
register char const *t2 = s2;
@@ -1241,6 +1242,354 @@ lines_differ (char const *s1, char const
@@ -1141,6 +1142,354 @@ lines_differ (char const *s1, char const
return true;
}

View File

@ -1,12 +1,11 @@
Name: diffutils
Version: 3.10
Version: 3.8
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
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
Patch1: diffutils-cmp-s-empty.patch
Patch2: diffutils-i18n.patch
Patch3: diff3-set-flagging-to-true-in-X-option.patch
License: GPLv3+
@ -28,7 +27,7 @@ GNU Diffutils is a package of several programs related to finding differences be
autoreconf -ifv
%build
%ifarch aarch64 riscv64
%ifarch aarch64
CFLAGS="$RPM_OPT_FLAGS -fsigned-char"
%endif
%configure
@ -56,36 +55,6 @@ cat tests/test-suite.log
%exclude %{_infodir}/dir
%changelog
* Tue Aug 29 2023 yoo <sunyuechi@iscas.ac.cn> - 3.10-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix riscv build error
* 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
- SUG:NA
- DESC:fix diff -D option failed
* Sat Jan 28 2023 Jiayi Chen <chenjiayi22@huawei.com> - 3.9-1
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:update version to 3.9
* Wed Oct 19 2022 zhangruifang <zhangruifang1@h-partners.com> - 3.8-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix unlikely memory leak
* Tue Mar 22 2022 panxiaohe<panxh.life@foxmail.com> - 3.8-2
- Type:bugfix
- ID:NA