From 153b89f10e0c3d539b1f32a869cf07b8b821cd99 Mon Sep 17 00:00:00 2001 From: zackees Date: Sun, 23 Aug 2026 13:15:22 -0700 Subject: [PATCH] fix(test): spawn the emulator test harness via an absolute /bin/sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An ubuntu runner failed with: called `Result::unwrap()` on an `Err` value: DeployFailed( "failed to launch QEMU at sh: No such file or directory (os error 2). The cached QEMU toolchain may be incomplete or corrupt. On Linux/macOS, also ensure runtime deps are installed: libgcrypt, glib2, pixman, SDL2, and libslirp.") No QEMU is involved. `test_process_command` builds a fake process that just prints canned lines, and on Unix it returned a bare `sh` for the runtime to resolve through PATH. When that lookup misses, the spawn error is reported by the QEMU launch path — so a PATH problem in the test harness reads as a corrupt emulator toolchain, complete with advice about installing pixman. The Windows branch of the same function already builds an absolute path (`%SystemRoot%\System32\cmd.exe`); this side just never did. POSIX requires `/bin/sh`, so naming it outright takes the runner's environment out of the equation rather than hoping PATH is well-formed. This is the only bare-program spawn of its kind in the workspace. Co-Authored-By: Claude Opus 5 (1M context) --- .../src/handlers/emulator/tests_process.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/fbuild-daemon/src/handlers/emulator/tests_process.rs b/crates/fbuild-daemon/src/handlers/emulator/tests_process.rs index a503b36d..fa5980dc 100644 --- a/crates/fbuild-daemon/src/handlers/emulator/tests_process.rs +++ b/crates/fbuild-daemon/src/handlers/emulator/tests_process.rs @@ -25,7 +25,16 @@ pub(super) fn test_process_command(lines: &[&str]) -> (PathBuf, Vec) { .map(|line| format!("printf '%s\\n' '{}'", line.replace('\'', "'\"'\"'"))) .collect::>() .join("; "); - (PathBuf::from("sh"), vec!["-c".to_string(), script]) + // Absolute, not a bare `sh` resolved through PATH. The Windows branch + // above already builds an absolute `cmd.exe` path; this side did not, + // and an ubuntu runner failed with + // + // failed to launch QEMU at sh: No such file or directory (os error 2) + // + // which is a PATH lookup miss dressed up as a missing emulator. POSIX + // requires `/bin/sh`, so naming it outright removes the runner's + // environment from the equation entirely. + (PathBuf::from("/bin/sh"), vec!["-c".to_string(), script]) } }