From 0be19f3f9c3ed8e861b6e8b0c22abf8b7f17a30e Mon Sep 17 00:00:00 2001 From: Surma Date: Sat, 7 Nov 2026 12:55:28 +0000 Subject: [PATCH] builder: exclude namespace mounts from Cargo clean --- host/src/builder/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/host/src/builder/mod.rs b/host/src/builder/mod.rs index a241b49..4894657 100644 --- a/host/src/builder/mod.rs +++ b/host/src/builder/mod.rs @@ -95,13 +95,15 @@ impl Builder { // Cargo clean must remove its directory, not a namespace mount point. let target_mount = base.join("target"); let target = target_mount.join("cargo"); + // Keep /tmp's namespace mountpoints outside the directory Cargo clean removes. + let temporary = target_mount.join("tmp"); let registry = base.join("cargo"); let cache = base.join("kache"); if source.exists() { std::fs::remove_dir_all(&source)?; } let before = files::copy_out(self.root.as_ref(), &workspace, &source).await?; - for path in [&target, ®istry, &cache, &target.join("tmp")] { + for path in [&target, ®istry, &cache, &temporary] { std::fs::create_dir_all(path)?; } std::fs::write( @@ -187,7 +189,7 @@ impl Builder { "/nix/store", ]) .arg("--bind") - .arg(target.join("tmp")) + .arg(&temporary) .arg("/tmp") .arg("--ro-bind") .arg(executable("sh")?)