uutils: fix nix 0.30.1 Redox SaFlags_t (c_ulong -> c_int)

nix 0.30.1 wrongly types Redox's sigaction SaFlags_t as c_ulong, but
relibc and the libc crate both declare sa_flags/SA_* as c_int (nix 0.31
already uses c_int for Redox). With the `kill` feature the nix signal
module is compiled and the u64-vs-i32 mismatch breaks the SaFlags
bitflags (E0308). This was latent (uutils built from cache); the relibc
epoll rebuild forced a clean recompile and surfaced it.

Patch the nix Redox branch before cookbook_cargo, with cargo fetch first
so the registry source exists before patching.
This commit is contained in:
2026-07-17 08:19:10 +09:00
parent ccccf94fb5
commit ca757f9898
+14
View File
@@ -32,6 +32,20 @@ if start != -1:
text = text[:start] + text[end + 3:]
tmp_dir.write_text(text)
PY
# nix 0.30.1 wrongly types Redox's sigaction SaFlags_t as c_ulong, but relibc
# and the libc crate both declare sa_flags/SA_* as c_int (nix 0.31 already uses
# c_int for Redox). With the `kill` feature the nix signal module is compiled,
# and the u64-vs-i32 mismatch breaks the SaFlags bitflags (E0308). Correct the
# Redox branch. cargo fetch first so the registry source exists before patching
# (it is only unpacked during the build).
cargo fetch --manifest-path "${COOKBOOK_SOURCE}/Cargo.toml" || true
for nix_src in "${HOME}/.cargo/registry/src/"*/nix-0.30.1; do
sig="$nix_src/src/sys/signal.rs"
[ -f "$sig" ] || continue
sed -i '/if #\\[cfg(target_os = "redox")\\] {/{n;s/type SaFlags_t = libc::c_ulong;/type SaFlags_t = libc::c_int;/}' "$sig"
done
# TODO: upstream changes, consider using feat_require_unix_core if relibc is ready?
CARGO_PROFILE_RELEASE_LTO=thin cookbook_cargo --no-default-features --features feat_os_unix_redox,kill --bin coreutils