coreutils: fix cksum on musl

musl has subtly different type definitions to glibc, which broke cksum
under musl. Backport a patch from upstream to fix this.

(From OE-Core rev: b177a9d5676cf0cfbaca3c589c513d7d89a2035c)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton 2025-03-27 21:36:26 +00:00 committed by Richard Purdie
parent d1f59f7267
commit 847f0f2346
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,47 @@
From 7eada35b4fbb48e7fe430d1b18dae7d191f84f8e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon, 17 Feb 2025 02:27:09 -0800
Subject: [PATCH 2/2] cksum: port to 32-bit uint_fast32_t
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* src/cksum_vmull.c (cksum_vmull): Dont assume
uint_fast32_t can hold 64 bits.
Problem reported by Alyssa Ross (Bug#76360).
Upstream-Status: Backport [7eada35b4fbb48e7fe430d1b18dae7d191f84f8e]
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
NEWS | 3 +++
src/cksum_vmull.c | 7 +++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/cksum_vmull.c b/src/cksum_vmull.c
index 7611c4244..0ff81e225 100644
--- a/src/cksum_vmull.c
+++ b/src/cksum_vmull.c
@@ -92,7 +92,9 @@ cksum_vmull (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
data = bswap_neon (data);
/* XOR in initial CRC value (for us 0 so no effect), or CRC value
calculated for previous BUFLEN buffer from fread */
- xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (crc << 32));
+
+ uint64_t wcrc = crc;
+ xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (wcrc << 32));
crc = 0;
data = veorq_u64 (data, xor_crc);
data3 = vld1q_u64 ((uint64_t *) (datap + 1));
@@ -193,7 +195,8 @@ cksum_vmull (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out)
{
data = vld1q_u64 ((uint64_t *) (datap));
data = bswap_neon (data);
- xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (crc << 32));
+ uint64_t wcrc = crc;
+ xor_crc = vcombine_u64 (vcreate_u64 (0), vcreate_u64 (wcrc << 32));
crc = 0;
data = veorq_u64 (data, xor_crc);
while (bytes_read >= 32)
--
2.45.2

View File

@ -18,6 +18,7 @@ SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
file://0001-local.mk-fix-cross-compiling-problem.patch \
file://intermittent-testfailure.patch \
file://0001-ls-fix-crash-with-context.patch \
file://0001-cksum-port-to-32-bit-uint_fast32_t.patch \
file://run-ptest \
"
SRC_URI[sha256sum] = "7a0124327b398fd9eb1a6abde583389821422c744ffa10734b24f557610d3283"