!159 [sync] PR-155: sort: don't trust st_size on /proc files
From: @openeuler-sync-bot Reviewed-by: @openeuler-basic Signed-off-by: @openeuler-basic
This commit is contained in:
commit
fd71f3d315
32
backport-sort-don-t-trust-st_size-on-proc-files.patch
Normal file
32
backport-sort-don-t-trust-st_size-on-proc-files.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From 8ff3903281e03d36dd1aa2a202a56f38af726d91 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Sat, 6 Apr 2024 15:17:14 -0700
|
||||||
|
Subject: [PATCH] =?UTF-8?q?sort:=20don=E2=80=99t=20trust=20st=5Fsize=20on?=
|
||||||
|
=?UTF-8?q?=20/proc=20files?=
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Problem and fix reported by Takashi Kusumi in:
|
||||||
|
https://bugs.gnu.org/70231
|
||||||
|
* src/sort.c (sort_buffer_size): Don’t trust st_size == 0.
|
||||||
|
---
|
||||||
|
src/sort.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/sort.c b/src/sort.c
|
||||||
|
index e779845..b983ca2 100644
|
||||||
|
--- a/src/sort.c
|
||||||
|
+++ b/src/sort.c
|
||||||
|
@@ -1538,7 +1538,7 @@ sort_buffer_size (FILE *const *fps, size_t nfps,
|
||||||
|
!= 0)
|
||||||
|
sort_die (_("stat failed"), files[i]);
|
||||||
|
|
||||||
|
- if (S_ISREG (st.st_mode))
|
||||||
|
+ if (usable_st_size (&st) && 0 < st.st_size)
|
||||||
|
file_size = st.st_size;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 9.0
|
Version: 9.0
|
||||||
Release: 13
|
Release: 14
|
||||||
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/
|
||||||
@ -41,6 +41,7 @@ Patch26: backport-doc-od-strings-clarify-operation.patch
|
|||||||
Patch27: backport-wc-port-to-kernels-that-disable-XSAVE-YMM.patch
|
Patch27: backport-wc-port-to-kernels-that-disable-XSAVE-YMM.patch
|
||||||
Patch28: test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch
|
Patch28: test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch
|
||||||
Patch29: fix-typo-in-zh_CN.patch
|
Patch29: fix-typo-in-zh_CN.patch
|
||||||
|
Patch30: backport-sort-don-t-trust-st_size-on-proc-files.patch
|
||||||
|
|
||||||
%ifarch sw_64
|
%ifarch sw_64
|
||||||
Patch13: coreutils-9.0-sw.patch
|
Patch13: coreutils-9.0-sw.patch
|
||||||
@ -171,6 +172,9 @@ fi
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 12 2024 yanglongkang <yanglongkang@h-partners.com> - 9.0-14
|
||||||
|
- sort: don't trust st_size on /proc files
|
||||||
|
|
||||||
* Thu Nov 28 2023 jiangchuangang <jiangchuangang@huawei.com> - 9.0-13
|
* Thu Nov 28 2023 jiangchuangang <jiangchuangang@huawei.com> - 9.0-13
|
||||||
- fix typo in zh_CN.po
|
- fix typo in zh_CN.po
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user