From 65fb3dd3f53b395b9eb332609c17668c08361a3d Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Mon, 21 Sep 2026 01:39:23 +0800 Subject: [PATCH] expat asks for entropy the graph has, instead of one no musl provides `lib/expat_config.h` is one static header shared by every target, and it carried `#define HAVE_ARC4RANDOM_BUF 1` from a glibc configure run. Over openkal-musl the member stopped at xmlparse.c:977:3: error: call to undeclared function 'arc4random_buf' musl 1.2.5 has no arc4random at all --- its `src/prng/` is the rand48 family, and the name appears in no header. This is therefore a recipe that claims a function for hosts that do not have it, not a gap in the C library. THE MACRO SHORT-CIRCUITS THE WHOLE CHAIN, which is why the fallbacks below it never ran. `generate_hash_secret_salt` reads: #if defined(HAVE_ARC4RANDOM_BUF) arc4random_buf(&entropy, sizeof(entropy)); #elif defined(HAVE_ARC4RANDOM) #else /* Try high quality providers first .. */ # elif defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) Undefined, the chain falls to `HAVE_GETRANDOM`, already defined in this same header and provided by both musl and glibc, and then to `XML_DEV_URANDOM`. No target loses a high-quality entropy source; the glibc hosts that were reaching arc4random_buf reach getrandom instead. Verified against the published stack --- openkal-linux 0.15.0, openkal-musl 0.18.0, openkal-llvm-runtime 0.13.0 --- with this checkout as a live index: expat 2.7.1 compiles and the program links and runs, and the artefact references no arc4random symbol. --- pkgs/c/compat.expat.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/c/compat.expat.lua b/pkgs/c/compat.expat.lua index 417e9077..e2037b3f 100644 --- a/pkgs/c/compat.expat.lua +++ b/pkgs/c/compat.expat.lua @@ -134,7 +134,17 @@ package = { /* #undef HAVE_ARC4RANDOM */ /* Define to 1 if you have the `arc4random_buf' function. */ -#define HAVE_ARC4RANDOM_BUF 1 +/* NOT DEFINED, AND THIS HEADER IS SHARED BY EVERY TARGET. The value was + carried over from a glibc configure run. expat's selection is a chain that + `HAVE_ARC4RANDOM_BUF` SHORT-CIRCUITS -- `generate_hash_secret_salt` calls + `arc4random_buf` unconditionally under it and never reaches the getrandom + or /dev/urandom branches below. musl 1.2.5 has no arc4random at all (its + `src/prng/` is the rand48 family), so over openkal-musl the member stopped + at `call to undeclared function 'arc4random_buf'`. + Undefined, the chain falls to HAVE_GETRANDOM, which is defined below and + which musl and glibc both provide, and then to XML_DEV_URANDOM. No target + loses a high-quality entropy source. */ +/* #undef HAVE_ARC4RANDOM_BUF */ /* define if the compiler supports basic C++11 syntax */ /* #undef HAVE_CXX11 */