sort: don't trust st_size on /proc files
This commit is contained in:
parent
0c466a051a
commit
fbd4aceb04
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
|
||||
Version: 9.4
|
||||
Release: 4
|
||||
Release: 5
|
||||
License: GPLv3+
|
||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||
Url: https://www.gnu.org/software/coreutils/
|
||||
@ -24,6 +24,7 @@ Patch9: backport-coreutils-i18n.patch
|
||||
patch10: backport-CVE-2024-0684-split-do-not-shrink-hold-buffer.patch
|
||||
patch11: test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch
|
||||
patch12: fix-coredump-if-enable-systemd.patch
|
||||
patch13: backport-sort-don-t-trust-st_size-on-proc-files.patch
|
||||
%ifarch sw_64
|
||||
Patch9001: coreutils-9.0-sw.patch
|
||||
%endif
|
||||
@ -158,6 +159,9 @@ fi
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Wed Jun 12 2024 yanglongkang <yanglongkang@h-partners.com> - 9.4-5
|
||||
- sort: don't trust st_size on /proc files
|
||||
|
||||
* Tue Apr 16 2024 Wenlong Zhang <zhangwenlong@loongson.cn> - 9.4-4
|
||||
- delete strace for loongarch64
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user