Duplicate artifact tracking issue.
@ehuss is already working on this.
Since Nov 13, 2018.
Assessment
This issue has not been assessed yet.
Description
#6308 added a check if multiple jobs produce the same files. To be safe, it is currently a warning. At some point in the future it should be turned into a hard error if no problems are reported. Collisions are almost certainly bad behavior that will cause problems, so rejecting it is probably the right thing to do.
Related issues:
- #5524: Request to warn on duplicate artifact creation — wherein
.rmetafiles started to collide because bin targets started producing them, and were corrupting one another if built simultaneously..rmetacollisions fixed in #6292. - #6293: Handling multiple targets in a workspace with the same name.
- #5444: Hardlink collisions when target is built multiple times (like panic/no-panic). Fixed by #5460 by only hardlinking what was requested.
Known situations where collisions may occur:
- Multiple binary/example/lib targets in a workspace with the same name. (Or reusing a shared target directory.)
- Using
--out-dirwith an example and binary with the same name. - Multiple path dependencies with dylibs with the same name.
- Multiple dependencies with the same name and you select both of them on the command-line, for example:
cargo build -p rand:0.4.3 -p rand:0.5.5. - rustdoc in a workspace where multiple crates have the same name. This can arise from a variety of situations (renamed dependencies, multiple versions of a package, different packages with the same crate names, etc.). (rust-lang/rust#56169, rust-lang/rust#61378)
panic="abort"and cdylibs and tests: Create a project with a lib (cdylib crate type), binary, and an integration test, withpanic="abort"in the profile. Whencargo testruns, the cdylib is built twice (once with panic=abort for the binary, and once without for the test), with the same filename. Building the lib for the test should probably skip thecdylibcrate type (assuming rlib is also available), but implementing this is very difficult. See https://github.com/rust-lang/cargo/issues/6313#issuecomment-480014371.- Multiple targets (particularly executables) that differ only by case on case-insensitive filesystems.
- PDB collisions on Windows. If the package has a binary and a dylib library of the same name, then the
.pdbfile for each target will have the same name. This is easy to hit if you have a proc-macro package with a binary. - Dylib built multiple times with different features
- for example with new feature resolver, see #9278.
- and with workspace members, see #12345
- Shared cdylib built with different profile settings, such as a build script and release mode https://github.com/rust-lang/cargo/issues/6313#issuecomment-916741203
Notes on implementation issues:
- Cargo is hard-coded with the outputs that rustc produces. If those outputs change, it will not be able to catch those changes. In particular, #5524 would not have been caught by these checks.
OutputFileis currently not calculated correctly in some cases. Known issues:Debug files (likeFixed in #8210.dSYM) are not tracked in some cases becauseTargetInfo::file_typesis making decisions about what should be hardlinked too early.- It is also very likely that it is missing certain platform differences.
Doc outputs are not tracked correctly (it generates incorrect paths).Fixed in #6998.Doctests generate incorrect paths. This should be fixed.Fixed in #6998, doc tests do not have any output paths.
- Not all outputs are checked. Such as:
- The
.ddep info file. This uses the same hash as the main artifact, so is unlikely to be a problem. - Incremental files. One hopes that the hashes used in rustc are good enough?
- Other temp files created by rustc, like
rcgufiles, which should always include the hash. - Anything done by build scripts.
- The
cargo dochas a dedicated path for detecting collisions. Ifcargo docis ever updated to support multiple crates with the same names, this code path can be removed.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-lang/cargo
-
C-bug S-triage
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
A-completions C-bug S-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
C-bug S-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Command-fix
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
cargo remove prints "Removing X" for dependencies that never get removed when the command fails OpenC-bug Command-remove S-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100