mozilla / mozilla/cbindgen

Reliance on environment variables breaks hermetic builds

Open
#1,049 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3k
Forks
386
Avg merge
1h 43m
Merged PRs (30d)
1

Description

While executing cargo metadata, and perhaps elsewhere, cbindgen invokes the binary specified CARGO environment variable, else an unadorned cargo.

Our build system does not permit reliance on environment variables, and that prevents us from using cbindgen. I'd like to be able to specify --cargo-bin as an argument to cbindgen, and use the following priorities for selecting cargo.

  1. --cargo-bin, if specified.
  2. CARGO environment variable, if set.
  3. cargo, otherwise.

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

Start in src/bindgen/cargo/cargo_metadata.rs around the cargo metadata invocation at line 233, and trace how cbindgen currently selects the cargo binary. Add the requested command-line option with the stated priority over CARGO and the default cargo executable; done means hermetic builds can select cargo without relying on environment variables.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.