diff --git a/backport-sort-don-t-trust-st_size-on-proc-files.patch b/backport-sort-don-t-trust-st_size-on-proc-files.patch new file mode 100644 index 0000000000000000000000000000000000000000..210774e28df5f49becc7006e141419193fe56020 --- /dev/null +++ b/backport-sort-don-t-trust-st_size-on-proc-files.patch @@ -0,0 +1,32 @@ +From 8ff3903281e03d36dd1aa2a202a56f38af726d91 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +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 + diff --git a/coreutils.spec b/coreutils.spec index 4476c4dba3305aaacea0e7ec5d3ee4788b5f24ba..f08123f810527427e5de09343a6d01ee2f092486 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,6 @@ Name: coreutils Version: 8.32 -Release: 12 +Release: 13 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -51,6 +51,7 @@ Patch33: backport-fix-mem-leaks.patch Patch34: backport-coverity-utimens.patch Patch35: backport-fuse-portal.patch Patch36: backport-expr-unmatched-par.patch +Patch37: backport-sort-don-t-trust-st_size-on-proc-files.patch Conflicts: filesystem < 3 # To avoid clobbering installs @@ -169,6 +170,9 @@ fi %{_mandir}/man*/* %changelog +* Thu Jun 13 2024 yanglongkang - 8.32-13 +- sort: don't trust st_size on /proc files + * Fri Mar 22 2024 cenhuilin - 8.32-12 - sync patches from community - add backport-coverity-utimens.patch