diff --git a/backport-cksum-improve-problematic_chars-function.patch b/backport-cksum-improve-problematic_chars-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..e3031d51fbaa4cb238f70c13196f987612c0188b --- /dev/null +++ b/backport-cksum-improve-problematic_chars-function.patch @@ -0,0 +1,28 @@ +From c0e7e4a1d41049bbf38cf902d13746b1ab5b1e38 Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Thu, 4 Sep 2025 18:16:16 +0800 +Subject: [PATCH] cksum: improve problematic_chars function + +* src/digest.c (problematic_chars): Implement using strcspn, +and traversing S only once, rather than once per escaped byte. +--- + src/digest.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/digest.c b/src/digest.c +index 123eda7..4f58a93 100644 +--- a/src/digest.c ++++ b/src/digest.c +@@ -549,7 +549,8 @@ or equivalent standalone program.\ + static bool + problematic_chars (char const *s) + { +- return strchr (s, '\\') || strchr (s, '\n') || strchr (s, '\r'); ++ size_t length = strcspn (s, "\\\n\r"); ++ return s[length] != '\0'; + } + + #define ISWHITE(c) ((c) == ' ' || (c) == '\t') +-- +2.43.0 + diff --git a/coreutils.spec b/coreutils.spec index ee972182a41920d4ab487533f6d8c73743b2cd43..7e05454f3341267f674f78e486f6ac78b7e4fee1 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,6 +1,6 @@ Name: coreutils Version: 9.0 -Release: 22 +Release: 23 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -68,6 +68,7 @@ Patch53: backport-dd-fix-error-detection-with-nocache-flag.patch Patch54: backport-tests-dd-ensure-posix_fadvise-errors-are-handled.patch Patch55: backport-timeout-ensure-infinitesimal-timeouts-timeout-quickl.patch Patch56: backport-cksum-escape-filenames-with-a-leading-in-check-statu.patch +Patch57: backport-cksum-improve-problematic_chars-function.patch Patch9001: coreutils-9.0-sw.patch @@ -196,6 +197,9 @@ fi %{_mandir}/man*/* %changelog +* Thu Sep 04 2025 cenhuilin - 9.0-23 +- cksum: improve problematic_chars function + * Thu Aug 21 2025 cenhuilin - 9.0-22 - cksum: escape filenames with a leading '\' in --check status