Upgrade to version 3.9

This commit is contained in:
Jiayi Chen 2023-01-17 23:00:28 +08:00
parent a20f8ff888
commit 898a2ac5f2
6 changed files with 39 additions and 69 deletions

Binary file not shown.

BIN
diffutils-3.9.tar.xz Normal file

Binary file not shown.

View File

@ -1,3 +1,6 @@
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

View File

@ -1,7 +1,10 @@
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
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
@@ -76,6 +76,8 @@ static _Noreturn void try_help (char con
static void check_stdout (void);
static void usage (void);
@ -10,7 +13,7 @@ diff -up diffutils-3.6/src/diff.c.i18n diffutils-3.6/src/diff.c
/* If comparing directories, compare their common subdirectories
recursively. */
static bool recursive;
@@ -298,6 +300,13 @@ main (int argc, char **argv)
@@ -303,6 +305,13 @@ main (int argc, char **argv)
presume_output_tty = false;
xstdopen ();
@ -24,9 +27,9 @@ diff -up diffutils-3.6/src/diff.c.i18n diffutils-3.6/src/diff.c
/* Decode the options. */
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
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>
@ -45,22 +48,22 @@ diff -up diffutils-3.6/src/diff.h.i18n diffutils-3.6/src/diff.h
/* What kind of changes a hunk contains. */
enum changes
{
@@ -381,7 +392,11 @@ extern void print_sdiff_script (struct c
@@ -389,7 +400,11 @@ extern void print_sdiff_script (struct c
/* util.c */
extern char const change_letter[4];
extern char const pr_program[];
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;
-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;
+#ifdef HANDLE_MULTIBYTE
+extern bool lines_differ_multibyte (char const *, size_t, char const *, size_t) _GL_ATTRIBUTE_PURE;
+extern bool lines_differ_multibyte (char const *, size_t, char const *, size_t) 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.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
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
@@ -23,6 +23,7 @@
#include <cmpbuf.h>
#include <file-type.h>
@ -69,7 +72,7 @@ diff -up diffutils-3.6/src/io.c.i18n diffutils-3.6/src/io.c
/* Rotate an unsigned value to the left. */
#define ROL(v, n) ((v) << (n) | (v) >> (sizeof (v) * CHAR_BIT - (n)))
@@ -215,6 +216,28 @@ slurp (struct file_data *current)
@@ -214,6 +215,28 @@ slurp (struct file_data *current)
/* Split the file into lines, simultaneously computing the equivalence
class for each line. */
@ -98,7 +101,7 @@ diff -up diffutils-3.6/src/io.c.i18n diffutils-3.6/src/io.c
static void
find_and_hash_each_line (struct file_data *current)
@@ -241,12 +264,300 @@ find_and_hash_each_line (struct file_dat
@@ -240,12 +263,300 @@ find_and_hash_each_line (struct file_dat
bool same_length_diff_contents_compare_anyway =
diff_length_compare_anyway | ig_case;
@ -399,7 +402,7 @@ diff -up diffutils-3.6/src/io.c.i18n diffutils-3.6/src/io.c
/* Hash this line until we find a newline. */
switch (ig_white_space)
{
@@ -397,7 +708,7 @@ find_and_hash_each_line (struct file_dat
@@ -396,7 +707,7 @@ find_and_hash_each_line (struct file_dat
else if (!diff_length_compare_anyway)
continue;
@ -408,10 +411,10 @@ diff -up diffutils-3.6/src/io.c.i18n diffutils-3.6/src/io.c
break;
}
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)
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)
Return nonzero if the lines differ. */
bool
@ -421,7 +424,7 @@ diff -up diffutils-3.6/src/util.c.i18n diffutils-3.6/src/util.c
{
register char const *t1 = s1;
register char const *t2 = s2;
@@ -1141,6 +1142,354 @@ lines_differ (char const *s1, char const
@@ -1240,6 +1241,354 @@ lines_differ (char const *s1, char const
return true;
}

View File

@ -1,13 +1,12 @@
Name: diffutils
Version: 3.8
Release: 3
Version: 3.9
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
Patch3: diff3-set-flagging-to-true-in-X-option.patch
Patch4: sdiff-fix-unlikely-memory-leak.patch
License: GPLv3+
Provides: bundled(gnulib)
@ -56,6 +55,12 @@ cat tests/test-suite.log
%exclude %{_infodir}/dir
%changelog
* 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

View File

@ -1,41 +0,0 @@
From f2e2b4d3c3288e6cae3918fc432bdab8c0c485b7 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 22 Aug 2021 13:54:04 -0700
Subject: [PATCH] sdiff: fix unlikely memory leak
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* src/sdiff.c (temporary_file): Fix memory leak when mkstemp fails.
Dont assume temporary file name length fits in int.
---
src/sdiff.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/sdiff.c b/src/sdiff.c
index 11e4da9..ab12987 100644
--- a/src/sdiff.c
+++ b/src/sdiff.c
@@ -1163,11 +1163,14 @@ temporary_file (void)
{
char const *tmpdir = getenv (TMPDIR_ENV);
char const *dir = tmpdir ? tmpdir : P_tmpdir;
- char *buf = xmalloc (strlen (dir) + 1 + 5 + 6 + 1);
- int fd;
- sprintf (buf, "%s/sdiffXXXXXX", dir);
- fd = mkstemp (buf);
- if (0 <= fd)
+ size_t dirlen = strlen (dir);
+ char *buf = xmalloc (dirlen + 1 + 5 + 6 + 1);
+ memcpy (buf, dir, dirlen);
+ strcpy (buf + dirlen, "/sdiffXXXXXX");
+ int fd = mkstemp (buf);
+ if (fd < 0)
+ free (buf);
+ else
tmpname = buf;
return fd;
}
--
2.27.0