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 0a83eac2798f9c3aae7c9e09caf17f62dca6f11e..c77daefd9a8cd3b2232971f5ce3d2e060152d2cb 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,6 @@ Name: coreutils Version: 9.0 -Release: 13 +Release: 14 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts 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 Patch28: test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch Patch29: fix-typo-in-zh_CN.patch +Patch30: backport-sort-don-t-trust-st_size-on-proc-files.patch %ifarch sw_64 Patch13: coreutils-9.0-sw.patch @@ -171,6 +172,9 @@ fi %{_mandir}/man*/* %changelog +* Wed Jun 12 2024 yanglongkang - 9.0-14 +- sort: don't trust st_size on /proc files + * Thu Nov 28 2023 jiangchuangang - 9.0-13 - fix typo in zh_CN.po