Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colliding filenames cause a panic when a build is re-run #10231

Closed
saethlin opened this issue Dec 25, 2021 · 5 comments · Fixed by #10243
Closed

Colliding filenames cause a panic when a build is re-run #10231

saethlin opened this issue Dec 25, 2021 · 5 comments · Fixed by #10243
Assignees
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. A-layout Area: target output directory layout, naming, and organization C-bug Category: bug E-easy Experience: Easy

Comments

@saethlin
Copy link
Member

saethlin commented Dec 25, 2021

Problem

When cargo emits a warning about output filename collision, running a second build produces a panic inside cargo.

Steps

Download either one of chipo-2.1.0 or paranoia-caller-0.1.0, run cargo build twice. The first run emits a warning, the second panics.

Possible Solution(s)

Promote the warning to a hard error.

Notes

This was found browsing crater outputs. Here are the two published crates that produce the error:
https://crater-reports.s3.amazonaws.com/beta-1.58-1/1.57.0/reg/chipo-2.1.0/log.txt
https://crater-reports.s3.amazonaws.com/beta-1.58-1/1.57.0/reg/paranoia-caller-0.1.0/log.txt

Version

cargo 1.59.0-nightly (fcef61230 2021-12-17)
release: 1.59.0-nightly
commit-hash: fcef61230c3b6213b6b0d233a36ba4ebd1649ec3
commit-date: 2021-12-17
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1l)
os: Ubuntu 20.4.0 [64-bit]
@saethlin saethlin added the C-bug Category: bug label Dec 25, 2021
@heisen-li
Copy link
Contributor

Did I make a mistake?
I run:

git clone https://gitlab.com/jeffrey-xiao/chipo-rs.git
cargo build
cargo build

But nothing seems to have happened.
image

@saethlin
Copy link
Member Author

I found this with crater among the published versions on crates.io. You can use cargo-download or in this case the author has made git tags for releases, so git checkout tags/v2.1.0 will get you the right code.

@weihanglo
Copy link
Member

After an investigation, this panic exists for a long time since 1.36.0 released. Although it acts like a "hard error" but I don't think we can turn the warning to an error until an actual fix is landed.
Maybe we can do it in reversed by removing the assert!?

@ehuss
Copy link
Contributor

ehuss commented Dec 25, 2021

It looks like these packages set both dylib and cdylib crate types.
Cargo can't support that at this time, since they both output the same filename.
I think that specific case can be turned into a hard error now.

In the future, there might be something like #9778 which would allow setting different filenames for things like cdylibs, but it isn't supported now (and might be difficult to add).

@ehuss ehuss added A-diagnostics Area: Error and warning messages generated by Cargo itself. A-layout Area: target output directory layout, naming, and organization E-easy Experience: Easy labels Dec 25, 2021
@Rustin170506
Copy link
Member

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. A-layout Area: target output directory layout, naming, and organization C-bug Category: bug E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants