Skip to content

fix(emulator): diagnose a spawn failure instead of blaming the toolchain - #1391

Merged
zackees merged 1 commit into
mainfrom
fix/1390-spawn-error-diagnosis
Aug 23, 2026
Merged

fix(emulator): diagnose a spawn failure instead of blaming the toolchain#1391
zackees merged 1 commit into
mainfrom
fix/1390-spawn-error-diagnosis

Conversation

@zackees

@zackees zackees commented Aug 23, 2026

Copy link
Copy Markdown
Member

Closes #1390.

The message was wrong for every case it fired on

Every failure to spawn the emulator went through build_linux_macos_qemu_hint:

The cached QEMU toolchain may be incomplete or corrupt. On Linux/macOS,
also ensure runtime deps are installed: libgcrypt, glib2, pixman, SDL2,
and libslirp.

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 a missing .so surfaces as exit code 127, which the
monitor already detects thirty lines below and already words correctly:

} else if status.code() == Some(127) {
    MonitorOutcome::Error(format!(
        "{} failed to start (exit code 127): a required shared library is missing.\n{}",
        label, build_linux_macos_qemu_hint("")

So on the spawn path the runtime-deps text was never the right answer for
anything. A reader whose real problem was a missing binary got sent to
reinstall five libraries that were never involved.

Not hypothetical — it cost a debugging session in this repo. A CI failure read
failed to launch QEMU at sh: No such file or directory followed by advice
about pixman and SDL2; the actual defect was one bare program name in a test
helper (#1389), and nothing about QEMU or system libraries was wrong.

What it says now

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

kind message
NotFound names the path 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

build_linux_macos_qemu_hint is untouched and still used by the exit-127 path,
which is the one place it is correct.

Tests

Three, and the first one asserts a negative — that a missing binary's message
contains none of libgcrypt, glib2, pixman, SDL2, libslirp. That is the
actual regression to guard: the failure here was never a crash, it was
confidently wrong advice, and only an assertion about what the message must
not say can catch it coming back.

soldr cargo test -p fbuild-daemon --lib — 246 passed. clippy -D warnings
clean.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 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: 8fba53bb-3aab-4c1c-beab-d54a750f3206

📥 Commits

Reviewing files that changed from the base of the PR and between 218caf1 and 86cc220.

📒 Files selected for processing (1)
  • crates/fbuild-daemon/src/handlers/emulator/shared.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.

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
zackees force-pushed the fix/1390-spawn-error-diagnosis branch from 83c5bc3 to 86cc220 Compare August 23, 2026 21:07
@zackees
zackees merged commit 6dc985c into main Aug 23, 2026
98 checks passed
@zackees
zackees deleted the fix/1390-spawn-error-diagnosis branch August 23, 2026 21:49
@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.

deploy: a spawn failure is reported as a corrupt QEMU toolchain

1 participant