oxidecomputer / oxidecomputer/omicron

cargo doc reports a filename collision between the `oximeter` bin target and the separate `oximeter` lib target

Open
#5,976 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
572
Forks
97
Avg merge
2d 12h
Merged PRs (30d)
96

Description

I think we hadn't noticed this before because we had been running cargo doc without --no-deps, so it got lost in all the duplicate targets from having several dependencies at different versions:

+ ptime -m cargo doc --workspace --no-deps
warning: output filename collision.
The bin target `oximeter` in package `oximeter-collector v0.1.0 (/work/oxidecomputer/omicron/oximeter/collector)`
has the same output filename as the lib target `oximeter` in package `oximeter v0.1.0 (/work/oxidecomputer/omicron/oximeter/oximeter)`.
Colliding filename is: /work/oxidecomputer/omicron/target/doc/oximeter/index.html
The targets should have unique names.
This is a known bug where multiple crates with the same name use
the same path; see <https://github.com/rust-lang/cargo/issues/6313>.

(output wrapped for readability)

Specifically, having a crate named "oximeter" and having a bin target in a separate package (oximeter-collector) called "oximeter" is triggering an output filename collision warning while building documentation. It's unclear whether this matters long-term; Cargo can't reasonably make this a hard error in the future until cargo doc is capable of supporting multiple crates with the same names (at different versions), at which point they might also support this particular issue.

Options:

  1. Do nothing and ignore the warning.
  2. Rename the "oximeter" crate; this has the effect of needing to also fix the crate name in every other repo that uses this library, which is painful.
  3. Rename the "oximeter" binary; this is self-contained to Omicron.
  4. Possibly hack around the issue by renaming the lib target without renaming the crate by explicitly listing a [lib] section with a different name.

cc @bnaecker

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 by running cargo doc --workspace --no-deps and inspect the Cargo manifests under oximeter/collector and oximeter/oximeter for the oximeter bin and lib targets. Review the listed options and Cargo target documentation before choosing a resolution. Done means the selected change avoids the output filename collision without breaking affected consumers, and the command no longer reports this warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, documentation
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.