oxidecomputer / oxidecomputer/hubris

Error message when two tasks try to claim the same interrupt isn't very helpful

Open
#777 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build developer-experience
Dominant language
Rust
Stars
3.6k
Forks
239
Avg merge
1d 12h
Merged PRs (30d)
23

Description

In development, I accidentally had two tasks trying to claim the same hardware interrupt:

[tasks.one]
interrupts = {"usart1.irq" = 0b01}
# ...

[tasks.two]
interrupts = {"usart1.irq" = 0b10}
# ...

This correctly does not build, but we should fail more nicely than we do:

   Compiling kern v0.1.0 (/home/john/github/hubris/sys/kern)
error: failed to run custom build command for `kern v0.1.0 (/home/john/github/hubris/sys/kern)`

Caused by:
  process didn't exit successfully: `/home/john/github/hubris/target/release/build/kern-c72a9bb98816b09a/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-cfg=armv7m
  cargo:rerun-if-env-changed=HUBRIS_SECURE
  cargo:rerun-if-env-changed=HUBRIS_IMAGE_ID
  cargo:rerun-if-env-changed=HUBRIS_KCONFIG

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Cannot build a perfect hash with duplicate keys', sys/kern/build.rs:304:22
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: command failed, see output for details

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the duplicate interrupt configuration from the issue and inspect sys/kern/build.rs around line 304, where the duplicate-key failure is reported. Improve the diagnostic so it identifies the conflicting task or interrupt configuration instead of exposing the perfect-hash panic, then verify the build fails with the clearer message.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.