From a52813db663ff46bcf452541ac889bdb38a1509e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Mon, 31 Aug 2026 11:27:41 +0200 Subject: [PATCH 1/2] fix(release): unblock the Windows, musl and old-glibc release legs Four defects, all found by the first full-tier + stage-build run on a release candidate since v0.5.1220. None is reachable from the PR tier. - gc/mod.rs imported two `malloc_trim` counters under a bare `#[cfg(test)]` while their declarations are gated to gnu/macOS, so `perry-runtime`'s test build failed to compile on Windows MSVC (E0432). - cycle_malloc_trim.rs (new in #9245) declares a raw `thread_local!` that the policy inventory still recorded against its old home, cycle.rs. - build_linux_glibc_2_31.sh never put `$CARGO_HOME/bin` on PATH, so `rustup` was not found inside the container (exit 127). That leg was added after the last successful release and had never run to completion. - `libc::backtrace`/`backtrace_symbols_fd` are glibc extensions; gating their call sites on `target_os = "linux"` selected them for musl, where they do not exist (E0425). Verified: 59/60 local lint gates, including `cargo check --workspace --all-targets -D warnings` and workspace clippy. The musl compile itself is not verifiable locally (libmimalloc-sys needs a musl C cross-toolchain), but `rustc --print cfg` confirms musl reports `target_env="musl"`, so it now takes the empty arm. --- crates/perry-runtime/src/arena/quarantine.rs | 14 ++++++++++++-- crates/perry-runtime/src/exception.rs | 7 ++++++- crates/perry-runtime/src/gc/mod.rs | 12 ++++++++++-- scripts/build_linux_glibc_2_31.sh | 13 +++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/crates/perry-runtime/src/arena/quarantine.rs b/crates/perry-runtime/src/arena/quarantine.rs index 9f21c694e4..993985d11e 100644 --- a/crates/perry-runtime/src/arena/quarantine.rs +++ b/crates/perry-runtime/src/arena/quarantine.rs @@ -864,7 +864,14 @@ extern "C" fn fromspace_fault_handler( } } -#[cfg(all(unix, any(target_os = "macos", target_os = "linux")))] +// `libc::backtrace`/`backtrace_symbols_fd` are a glibc extension: they do not +// exist in musl, so `target_os = "linux"` alone selected a body that cannot +// compile for `x86_64-unknown-linux-musl` (#9245-era release leg, E0425). The +// musl build takes the empty arm below. +#[cfg(all( + unix, + any(target_os = "macos", all(target_os = "linux", target_env = "gnu")) +))] fn emit_native_backtrace() { const MAX_FRAMES: usize = 64; let mut frames = [std::ptr::null_mut::(); MAX_FRAMES]; @@ -878,7 +885,10 @@ fn emit_native_backtrace() { } } -#[cfg(all(unix, not(any(target_os = "macos", target_os = "linux"))))] +#[cfg(all( + unix, + not(any(target_os = "macos", all(target_os = "linux", target_env = "gnu"))) +))] fn emit_native_backtrace() {} /// Name the objects that still HOLD the stale address, not just the frame that diff --git a/crates/perry-runtime/src/exception.rs b/crates/perry-runtime/src/exception.rs index 55fd91d70a..73bbcc4f12 100644 --- a/crates/perry-runtime/src/exception.rs +++ b/crates/perry-runtime/src/exception.rs @@ -528,7 +528,12 @@ fn emit_uncaught_backtrace() { if !on { return; } - #[cfg(all(unix, any(target_os = "macos", target_os = "linux")))] + // glibc-only pair; musl has no `backtrace`, so this block must not be + // selected there (E0425 at release time on the musl leg). + #[cfg(all( + unix, + any(target_os = "macos", all(target_os = "linux", target_env = "gnu")) + ))] { const MAX_FRAMES: usize = 96; let mut frames = [std::ptr::null_mut::(); MAX_FRAMES]; diff --git a/crates/perry-runtime/src/gc/mod.rs b/crates/perry-runtime/src/gc/mod.rs index 942691e034..68c790b24e 100644 --- a/crates/perry-runtime/src/gc/mod.rs +++ b/crates/perry-runtime/src/gc/mod.rs @@ -172,8 +172,16 @@ mod cycle_malloc_trim; use cycle::*; #[cfg(test)] pub(crate) use cycle_malloc_trim::{ - reset_test_malloc_trim_call_count, reset_test_malloc_trim_executed_count, - test_malloc_trim_call_count, test_malloc_trim_executed_count, + reset_test_malloc_trim_call_count, test_malloc_trim_call_count, +}; +// The *executed* counters only exist where `malloc_trim` itself does, so the +// import has to carry the same gate as the declaration. Importing them under a +// bare `#[cfg(test)]` made `perry-runtime`'s test build fail to compile on +// Windows MSVC (E0432) — a target the PR tier never builds, so only the full +// tier's `windows-build`/`windows-arm64-build` saw it. +#[cfg(all(test, any(target_env = "gnu", target_os = "macos")))] +pub(crate) use cycle_malloc_trim::{ + reset_test_malloc_trim_executed_count, test_malloc_trim_executed_count, }; mod verify; diff --git a/scripts/build_linux_glibc_2_31.sh b/scripts/build_linux_glibc_2_31.sh index 5abb739f82..9f5334a042 100755 --- a/scripts/build_linux_glibc_2_31.sh +++ b/scripts/build_linux_glibc_2_31.sh @@ -43,6 +43,19 @@ export LLVM_SYS_221_PREFIX exit 1 } +# The image deliberately ships no Rust toolchain: release-packages.yml mounts +# the runner's ~/.cargo and ~/.rustup and points CARGO_HOME/RUSTUP_HOME at +# them. Those give cargo its data, not its binaries — nothing puts +# $CARGO_HOME/bin on PATH inside the container, so `rustup` and `cargo` +# resolved to nothing and the leg died with exit 127. This leg was added in +# #8350 (2026-08-18), after the last successful release, so it had never once +# run to completion. +export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:$PATH" +command -v rustup >/dev/null || { + echo "rustup not found on PATH ($PATH) — is \$CARGO_HOME/bin mounted?" >&2 + exit 1 +} + rustup target add "$target" cargo build --profile dist --target "$target" -p perry From 09dec3548bd6e10faff80cecac025812910f825f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ralph=20K=C3=BCpper?= Date: Mon, 31 Aug 2026 11:39:50 +0200 Subject: [PATCH 2/2] docs(changelog): record the release-leg fixes --- changelog.d/9260-release-legs.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog.d/9260-release-legs.md diff --git a/changelog.d/9260-release-legs.md b/changelog.d/9260-release-legs.md new file mode 100644 index 0000000000..e9c0467a6b --- /dev/null +++ b/changelog.d/9260-release-legs.md @@ -0,0 +1,6 @@ +The Windows, musl and old-glibc release build legs no longer fail before they +start. `perry-runtime`'s test build imported two `malloc_trim` counters under a +weaker `cfg` than their declarations, breaking compilation on Windows MSVC; the +glibc-2.31 container never put the mounted Cargo bin directory on `PATH`, so +`rustup` was not found; and the glibc-only `libc::backtrace` pair was selected +for musl targets, where it does not exist.