Skip to content

fix(test): spawn the emulator test harness via an absolute /bin/sh - #1389

Merged
zackees merged 1 commit into
mainfrom
fix/test-sh-absolute-path
Aug 23, 2026
Merged

fix(test): spawn the emulator test harness via an absolute /bin/sh#1389
zackees merged 1 commit into
mainfrom
fix/test-sh-absolute-path

Conversation

@zackees

@zackees zackees commented Aug 23, 2026

Copy link
Copy Markdown
Member

Symptom

Check (ubuntu-latest) failed on #1384 — a PR that touches none of this:

handlers::emulator::tests_process::run_avr8js_headless_halt_on_error ... FAILED
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 prints canned lines, so the
monitor logic can be tested without an emulator. On Unix it returned a bare
sh, left for the runtime to resolve through PATH:

(PathBuf::from("sh"), vec!["-c".to_string(), script])

When that lookup misses, the spawn failure surfaces through the QEMU launch
path — so a PATH problem in the test harness is reported as a corrupt emulator
toolchain, complete with advice to install pixman and SDL2. Anyone debugging
this from the message alone would go a long way in the wrong direction.

Fix

The Windows branch of the same function already builds an absolute path:

let exe = PathBuf::from(system_root).join(r"System32\cmd.exe");

The Unix branch just never did. POSIX requires /bin/sh, so naming it outright
removes the runner's environment from the equation rather than hoping PATH is
well-formed in whatever context the test binary runs.

Grepped the workspace: this was the only bare-program spawn of its kind.

Scope

Deliberately narrow. The misleading error message — a spawn failure reported
as "the cached QEMU toolchain may be incomplete or corrupt" — is a real
separate problem worth fixing, since it will mislead on genuine spawn failures
too. It belongs in its own change against the deploy error path, not bundled
into a one-line test-harness fix.

Verified: soldr cargo test -p fbuild-daemon --lib tests_process — 9 passed,
clippy -D warnings clean. I cannot reproduce the PATH miss locally (Windows
host), so the argument here is that the fix removes the dependency the failure
was on, not that I watched it go from red to green.

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) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 32 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b65daa82-e674-4280-97b6-d848ad18f866

📥 Commits

Reviewing files that changed from the base of the PR and between 9f82da3 and 153b89f.

📒 Files selected for processing (1)
  • crates/fbuild-daemon/src/handlers/emulator/tests_process.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zackees
zackees merged commit de403cf into main Aug 23, 2026
99 checks passed
@zackees
zackees deleted the fix/test-sh-absolute-path branch August 23, 2026 20:53
zackees added a commit that referenced this pull request Aug 23, 2026
Closes #1390.

Every failure to spawn the emulator was reported through
`build_linux_macos_qemu_hint`, which asserts the cached QEMU toolchain is
incomplete or corrupt and lists five system libraries to install. That advice
fits exactly one failure mode — a missing shared library — and that mode
cannot reach this code path: the dynamic loader runs *after* a successful
`execve`, so it surfaces as exit code 127, which the monitor already detects
and already words correctly a few lines below.

So on the spawn path the runtime-deps text was never the right answer. A
reader whose actual problem was a missing binary got sent to reinstall
libgcrypt, glib2, pixman, SDL2 and libslirp — none of which were involved.
That is not hypothetical: it cost a CI debugging session here, where the real
defect was one bare program name in a test helper (#1389) and the message
pointed at the emulator toolchain.

The spawn site now branches on `io::Error::kind()`:

  - `NotFound`         — names the path that was tried, says nothing ran, and
                         says outright that reinstalling runtime libraries
                         will not help.
  - `PermissionDenied` — present but not executable; check the exec bit and
                         `noexec` mounts.
  - anything else      — the path plus the OS error verbatim, rather than a
                         guess at the cause.

`build_linux_macos_qemu_hint` is unchanged and still used by the exit-127
path, which is where it belongs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
zackees added a commit that referenced this pull request Aug 23, 2026
…ain (#1391)

Closes #1390.

Every failure to spawn the emulator was reported through
`build_linux_macos_qemu_hint`, which asserts the cached QEMU toolchain is
incomplete or corrupt and lists five system libraries to install. That advice
fits exactly one failure mode — a missing shared library — and that mode
cannot reach this code path: the dynamic loader runs *after* a successful
`execve`, so it surfaces as exit code 127, which the monitor already detects
and already words correctly a few lines below.

So on the spawn path the runtime-deps text was never the right answer. A
reader whose actual problem was a missing binary got sent to reinstall
libgcrypt, glib2, pixman, SDL2 and libslirp — none of which were involved.
That is not hypothetical: it cost a CI debugging session here, where the real
defect was one bare program name in a test helper (#1389) and the message
pointed at the emulator toolchain.

The spawn site now branches on `io::Error::kind()`:

  - `NotFound`         — names the path that was tried, says nothing ran, and
                         says outright that reinstalling runtime libraries
                         will not help.
  - `PermissionDenied` — present but not executable; check the exec bit and
                         `noexec` mounts.
  - anything else      — the path plus the OS error verbatim, rather than a
                         guess at the cause.

`build_linux_macos_qemu_hint` is unchanged and still used by the exit-127
path, which is where it belongs.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant