!131 升级到9.4版本

From: @lvgenggeng 
Reviewed-by: @ship_harbour 
Signed-off-by: @ship_harbour
This commit is contained in:
openeuler-ci-bot 2024-02-02 01:38:15 +00:00 committed by Gitee
commit c9ac216efe
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 606 additions and 643 deletions

View File

@ -1,22 +1,20 @@
From f11a739f6aabbf280fa68a8013974de7d0855ecd Mon Sep 17 00:00:00 2001 From 6e36198f10a2f63b89c89ebb5d5c185b20fb3a63 Mon Sep 17 00:00:00 2001
From: xueyamao <xueyamao@kylinos.cn> From: Kamil Dudka <kdudka@redhat.com>
Date: Wed, 20 Jul 2022 17:49:23 +0800 Date: Mon, 29 Mar 2010 17:20:34 +0000
Subject: [PATCH 2/2] coreutils-df-direct add df --direct option,direct statfs Subject: [PATCH] coreutils-df-direct.patch
for a file. Do not resolve mount point and show statistics directly for a
file. Signed-off-by: xueyamao <xueyamao@kylinos.cn>
--- ---
doc/coreutils.texi | 7 ++++++ doc/coreutils.texi | 7 ++++++
src/df.c | 38 ++++++++++++++++++++++++++++--- src/df.c | 34 ++++++++++++++++++++++++++--
tests/df/direct.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++ tests/df/direct.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 98 insertions(+), 3 deletions(-) 3 files changed, 94 insertions(+), 2 deletions(-)
create mode 100644 tests/df/direct.sh create mode 100755 tests/df/direct.sh
diff --git a/doc/coreutils.texi b/doc/coreutils.texi diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index cb00eea..7667ace 100644 index 5b9a597..6810c15 100644
--- a/doc/coreutils.texi --- a/doc/coreutils.texi
+++ b/doc/coreutils.texi +++ b/doc/coreutils.texi
@@ -12067,6 +12067,13 @@ some systems (notably Solaris), doing this yields more up to date results, @@ -12074,6 +12074,13 @@ some systems (notably Solaris), doing this yields more up to date results,
but in general this option makes @command{df} much slower, especially when but in general this option makes @command{df} much slower, especially when
there are many or very busy file systems. there are many or very busy file systems.
@ -31,7 +29,7 @@ index cb00eea..7667ace 100644
@opindex --total @opindex --total
@cindex grand total of file system size, usage and available space @cindex grand total of file system size, usage and available space
diff --git a/src/df.c b/src/df.c diff --git a/src/df.c b/src/df.c
index 6256d0a..1c5fe5f 100644 index 48025b9..c8efa5b 100644
--- a/src/df.c --- a/src/df.c
+++ b/src/df.c +++ b/src/df.c
@@ -125,6 +125,9 @@ static bool print_type; @@ -125,6 +125,9 @@ static bool print_type;
@ -55,16 +53,16 @@ index 6256d0a..1c5fe5f 100644
static struct option const long_options[] = static struct option const long_options[] =
{ {
{"all", no_argument, NULL, 'a'}, {"all", no_argument, nullptr, 'a'},
{"block-size", required_argument, NULL, 'B'}, {"block-size", required_argument, nullptr, 'B'},
+ {"direct",no_argument,NULL,DIRECT_OPTION}, + {"direct", no_argument, nullptr, DIRECT_OPTION},
{"inodes", no_argument, NULL, 'i'}, {"inodes", no_argument, nullptr, 'i'},
{"human-readable", no_argument, NULL, 'h'}, {"human-readable", no_argument, nullptr, 'h'},
{"si", no_argument, NULL, 'H'}, {"si", no_argument, nullptr, 'H'},
@@ -583,7 +588,10 @@ get_header (void) @@ -583,7 +588,10 @@ get_header (void)
for (col = 0; col < ncolumns; col++) for (col = 0; col < ncolumns; col++)
{ {
char *cell = NULL; char *cell = nullptr;
- char const *header = _(columns[col]->caption); - char const *header = _(columns[col]->caption);
+ char const *header = (columns[col]->field == TARGET_FIELD + char const *header = (columns[col]->field == TARGET_FIELD
+ && direct_statfs)? + && direct_statfs)?
@ -73,29 +71,25 @@ index 6256d0a..1c5fe5f 100644
if (columns[col]->field == SIZE_FIELD if (columns[col]->field == SIZE_FIELD
&& (header_mode == DEFAULT_MODE && (header_mode == DEFAULT_MODE
@@ -1480,7 +1488,20 @@ get_point (char const *point, const struct stat *statp) @@ -1486,6 +1494,17 @@ get_point (char const *point, const struct stat *statp)
static void static void
get_entry (char const *name, struct stat const *statp) get_entry (char const *name, struct stat const *statp)
{ {
- if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
+ if (direct_statfs) + if (direct_statfs)
+ { + {
+ char *resolved = canonicalize_file_name (name); + char *resolved = canonicalize_file_name (name);
+ if (resolved) + if (resolved)
+ { + {
+ char *mp = find_mount_point (name, statp); + get_dev (NULL, resolved, name, NULL, NULL, false, false, NULL, false);
+ get_dev (NULL, mp, resolved, NULL, NULL, false, false, NULL, false);
+ free(mp);
+ free (resolved); + free (resolved);
+ return; + return;
+ } + }
+ } + }
+ +
+ if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode)) if ((S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
&& get_device (name)) && get_device (name))
return; return;
@@ -1556,6 +1575,7 @@ or all file systems by default.\n\
@@ -1550,6 +1571,7 @@ or all file systems by default.\n\
-B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\
'-BM' prints sizes in units of 1,048,576 bytes;\n\ '-BM' prints sizes in units of 1,048,576 bytes;\n\
see SIZE format below\n\ see SIZE format below\n\
@ -103,7 +97,7 @@ index 6256d0a..1c5fe5f 100644
-h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\ -h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\
-H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\ -H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\
"), stdout); "), stdout);
@@ -1640,6 +1662,9 @@ main (int argc, char **argv) @@ -1646,6 +1666,9 @@ main (int argc, char **argv)
xstrtol_fatal (e, oi, c, long_options, optarg); xstrtol_fatal (e, oi, c, long_options, optarg);
} }
break; break;
@ -113,7 +107,7 @@ index 6256d0a..1c5fe5f 100644
case 'i': case 'i':
if (header_mode == OUTPUT_MODE) if (header_mode == OUTPUT_MODE)
{ {
@@ -1736,6 +1761,13 @@ main (int argc, char **argv) @@ -1742,6 +1765,13 @@ main (int argc, char **argv)
} }
} }
@ -128,11 +122,11 @@ index 6256d0a..1c5fe5f 100644
{ {
if (posix_format) if (posix_format)
diff --git a/tests/df/direct.sh b/tests/df/direct.sh diff --git a/tests/df/direct.sh b/tests/df/direct.sh
new file mode 100644 new file mode 100755
index 0000000..25fbc57 index 0000000..8e4cfb8
--- /dev/null --- /dev/null
+++ b/tests/df/direct.sh +++ b/tests/df/direct.sh
@@ -0,0 +1,56 @@ @@ -0,0 +1,55 @@
+#!/bin/sh +#!/bin/sh
+# Ensure "df --direct" works as documented +# Ensure "df --direct" works as documented
+ +
@ -188,7 +182,6 @@ index 0000000..25fbc57
+compare file_out file_exp || fail=1 +compare file_out file_exp || fail=1
+ +
+Exit $fail +Exit $fail
+
-- --
2.33.0 2.31.1

File diff suppressed because it is too large Load Diff

View File

@ -1,67 +0,0 @@
From 3fb0cc80fa5e1cede9ec05303a70c26d0d23ca1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Tue, 25 Apr 2023 14:07:03 +0100
Subject: [PATCH] pr: fix infinite loop when double spacing
* src/pr.c (init_parameters): Ensure we avoid a 0 lines_per_body
which was possible when adjusting for double spacing.
That caused print_page() to always return true,
causing an infinite loop.
* tests/pr/pr-tests.pl: Add a test case.
* NEWS: Mention the fix.
Fixes https://bugs.debian.org/1034808
Conflict:NEWS context adaption
Reference:https://github.com/coreutils/coreutils/commit/3fb0cc80fa5e1cede9ec05303a70c26d0d23ca1d
---
NEWS | 3 +++
src/pr.c | 2 +-
tests/pr/pr-tests.pl | 3 +++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index f65eb95..5320b9c 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ GNU coreutils NEWS -*- outline -*-
* Noteworthy changes in release 9.3 (2023-04-18) [stable]
** Bug fixes
+
+ 'pr --length=1 --double-space' no longer enters an infinite loop.
+ [This bug was present in "the beginning".]
cp --reflink=auto (the default), mv, and install
will again fall back to a standard copy in more cases.
Previously copies could fail with permission errors on
diff --git a/src/pr.c b/src/pr.c
index 2c5cdceb1..14a368b6c 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -1209,7 +1209,7 @@ init_parameters (int number_of_files)
lines_per_body = lines_per_page;
if (double_space)
- lines_per_body = lines_per_body / 2;
+ lines_per_body = MAX (1, lines_per_body / 2);
/* If input is stdin, cannot print parallel files. BSD dumps core
on this. */
diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl
index 265e6e108..eafc13d81 100755
--- a/tests/pr/pr-tests.pl
+++ b/tests/pr/pr-tests.pl
@@ -415,6 +415,9 @@ my @tv = (
['padding2', '-t -n,64', "1\n", (" "x 63)."1,1\n", 0],
# Ensure we handle buffer truncation correctly
['padding3', '-t -N1000000 -n,1', "1\n", "0,1\n", 0],
+
+# This entered an infinite loop before coreutils-9.4
+['page-length1', '-dl1', "", "", 0],
);
# Convert the above old-style test vectors to the newer
--
2.36.1

Binary file not shown.

BIN
coreutils-9.4.tar.xz Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
Name: coreutils Name: coreutils
Version: 9.3 Version: 9.4
Release: 3 Release: 1
License: GPLv3+ License: GPLv3+
Summary: A set of basic GNU tools commonly used in shell scripts Summary: A set of basic GNU tools commonly used in shell scripts
Url: https://www.gnu.org/software/coreutils/ Url: https://www.gnu.org/software/coreutils/
@ -19,11 +19,10 @@ Patch3: bugfix-remove-usr-local-lib-from-m4.patch
Patch4: bugfix-dummy_help2man.patch Patch4: bugfix-dummy_help2man.patch
Patch6: skip-the-tests-that-require-selinux-if-selinux-is-di.patch Patch6: skip-the-tests-that-require-selinux-if-selinux-is-di.patch
Patch7: backport-config-color-alias-for-ls.patch Patch7: backport-config-color-alias-for-ls.patch
Patch8: backport-coreutils-i18n.patch Patch8: backport-coreutils-df-direct.patch
Patch9: backport-pr-fix-infinite-loop-when-double-spacing.patch Patch9: backport-coreutils-i18n.patch
patch10: backport-CVE-2024-0684-split-do-not-shrink-hold-buffer.patch patch10: backport-CVE-2024-0684-split-do-not-shrink-hold-buffer.patch
Patch9000: openEuler-coreutils-df-direct.patch
%ifarch sw_64 %ifarch sw_64
Patch9001: coreutils-9.0-sw.patch Patch9001: coreutils-9.0-sw.patch
%endif %endif
@ -155,6 +154,9 @@ fi
%{_mandir}/man*/* %{_mandir}/man*/*
%changelog %changelog
* Thu Feb 1 2024 lvgenggeng <lvgenggeng@uniontech.com> - 9.4-1
- bump to 9.4
* Wed Jan 24 2024 Jiangchuangang <jiangchuangang@huawei.com> - 9.3-3 * Wed Jan 24 2024 Jiangchuangang <jiangchuangang@huawei.com> - 9.3-3
- fix CVE-2024-0684 - fix CVE-2024-0684