mirror of
https://git.yoctoproject.org/poky
synced 2026-04-28 15:32:27 +02:00
util-linux: Fix lscpu on musl
(From OE-Core rev: 565b22f4927c76b7bbc3d84198a4d5d3927d8401) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -35,6 +35,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
|
||||
file://run-ptest \
|
||||
file://display_testname_for_subtest.patch \
|
||||
file://avoid_parallel_tests.patch \
|
||||
file://0001-lscpu-Use-4K-buffer-size-instead-of-BUFSIZ.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "890ae8ff810247bd19e274df76e8371d202cda01ad277681b0ea88eeaa00286b"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 95b0405338440cf5cd6d4b2b5c66cda8bf381b28 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Fri, 15 Sep 2023 00:18:18 -0700
|
||||
Subject: [PATCH] lscpu: Use 4K buffer size instead of BUFSIZ
|
||||
|
||||
Some lines in /proc/cpuinfo can be large e.g. flags and can then
|
||||
truncate them in displaying them
|
||||
|
||||
BUFSIZ can vary quite a bit e.g. glibc/linux systems its 8192
|
||||
but on musl/linux and OSX its 1024, on mingW it is 256, some tests e.g.
|
||||
x86_64-64cpu-linux6.2.tar.gz has added really long line for cpu flags
|
||||
line which is greater than 1024 characters and hence this test fails
|
||||
on musl because lscpu -s reports truncated string
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2492]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
sys-utils/lscpu-cputype.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/sys-utils/lscpu-cputype.c b/sys-utils/lscpu-cputype.c
|
||||
index 3fd5f7a3c..c8f72ab8a 100644
|
||||
--- a/sys-utils/lscpu-cputype.c
|
||||
+++ b/sys-utils/lscpu-cputype.c
|
||||
@@ -462,7 +462,9 @@ static int cpuinfo_parse_cache(struct lscpu_cxt *cxt, int keynum, char *data)
|
||||
int lscpu_read_cpuinfo(struct lscpu_cxt *cxt)
|
||||
{
|
||||
FILE *fp;
|
||||
- char buf[BUFSIZ];
|
||||
+ /* Used to be BUFSIZ which is small on some platforms e.g, musl,
|
||||
+ * therefore hardcode to 4K */
|
||||
+ char buf[4096];
|
||||
size_t i;
|
||||
struct lscpu_cputype *ct;
|
||||
struct cpuinfo_parser _pr = { .cxt = cxt }, *pr = &_pr;
|
||||
--
|
||||
2.42.0
|
||||
|
||||
Reference in New Issue
Block a user