From 1502cb2826cf4990f0d514639dcb7f24d282b01d Mon Sep 17 00:00:00 2001 From: Stephen Matula Date: Tue, 10 Nov 2026 13:25:29 -0500 Subject: [PATCH] build-rust: make rustup's install paths group-writable A crate can pin a toolchain via rust-toolchain.toml, which makes rustup install that toolchain at build time. Under OCP's arbitrary-UID/GID-0 model rustup cannot write to RUSTUP_HOME, so the build fails before cargo runs. This extends the existing cargo-cache treatment to the rustup paths an install touches: tmp, downloads, toolchains, update-hashes, and settings.toml. The chmod is non-recursive so already-installed toolchain binaries stay read-only. Co-Authored-By: Claude Opus 5 --- build_scripts/build-rust.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build_scripts/build-rust.sh b/build_scripts/build-rust.sh index 835e48e..4e2b350 100755 --- a/build_scripts/build-rust.sh +++ b/build_scripts/build-rust.sh @@ -74,6 +74,16 @@ cp -r "${RUSTUP_HOME}" /manylinux-rootfs"${PREFIX}"/ mkdir -p /manylinux-rootfs"${PREFIX}"/cargo/{registry,git} chmod -R g+w /manylinux-rootfs"${PREFIX}"/cargo/{registry,git}/ +# A crate can pin a different toolchain via rust-toolchain.toml, which makes +# rustup install it at build time. That writes to tmp, downloads, toolchains and +# update-hashes, and updates settings.toml. Not recursive: toolchains/ only needs +# to be writable so a new toolchain directory can be created, and -R here would +# make already-installed toolchain binaries writable too. +mkdir -p /manylinux-rootfs"${PREFIX}"/rustup/{tmp,downloads,toolchains,update-hashes} +chmod g+w /manylinux-rootfs"${PREFIX}"/rustup \ + /manylinux-rootfs"${PREFIX}"/rustup/{tmp,downloads,toolchains,update-hashes} +chmod g+w /manylinux-rootfs"${PREFIX}"/rustup/settings.toml + # Create wrapper scripts that set environment variables mkdir -p /manylinux-rootfs/usr/local/bin cat > /manylinux-rootfs/usr/local/bin/rustc <