Skip to content

Commit bf62dd5

Browse files
authored
expat asks for entropy the graph has, instead of one no musl provides (#451)
`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.
1 parent 3c62571 commit bf62dd5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

pkgs/c/compat.expat.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,17 @@ package = {
134134
/* #undef HAVE_ARC4RANDOM */
135135
136136
/* Define to 1 if you have the `arc4random_buf' function. */
137-
#define HAVE_ARC4RANDOM_BUF 1
137+
/* NOT DEFINED, AND THIS HEADER IS SHARED BY EVERY TARGET. The value was
138+
carried over from a glibc configure run. expat's selection is a chain that
139+
`HAVE_ARC4RANDOM_BUF` SHORT-CIRCUITS -- `generate_hash_secret_salt` calls
140+
`arc4random_buf` unconditionally under it and never reaches the getrandom
141+
or /dev/urandom branches below. musl 1.2.5 has no arc4random at all (its
142+
`src/prng/` is the rand48 family), so over openkal-musl the member stopped
143+
at `call to undeclared function 'arc4random_buf'`.
144+
Undefined, the chain falls to HAVE_GETRANDOM, which is defined below and
145+
which musl and glibc both provide, and then to XML_DEV_URANDOM. No target
146+
loses a high-quality entropy source. */
147+
/* #undef HAVE_ARC4RANDOM_BUF */
138148
139149
/* define if the compiler supports basic C++11 syntax */
140150
/* #undef HAVE_CXX11 */

0 commit comments

Comments
 (0)