-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
macos: unreported filename collision with bin and dylib #9325
Comments
@rustbot claim |
I tried to reproduce it but cannot with 1.58.1. I feel like this issue was already fixed coincidentally by #9418 Should we add a test to verify the behavior or just close it? |
Thanks for taking a look! Yea, I think this specific case for macos has been fixed. A test would be good to add. However, there are some edge cases to be careful of. The problem is this block of code. I think both msvc and wasm32-unknown-emscripten have other problems that get in the way ( So the test won't work for msvc. I'm not sure if we need to try to track the |
Thanks for the reply. I also noticed that. Besides adding a test, Edit: There are already collision warning there and the collisions are also tracked, so we only need to add a test to prevent any regression on macOS |
Problem
On macOS, if there is a project with a bin and a dylib (or cdylib), there is a filename collision with the dep-info file
foo.d
. Cargo does not detect this, and results in possible corruption of the fingerprint file. Since there is a race for writing the.d
file, it is possible for both fingerprints to think they are pointing atmain.rs
orlib.rs
.Steps
Notice there is only one
.d
file intarget/debug/deps
(foo.d
). If you're unlucky, you may also notice that Cargo now thinks that both lib and bin aremain.rs
(cat target/debug/.fingerprint/foo-*/dep-*
). That means thattouch src/lib.rs && cargo build
will have no effect.Possible Solution(s)
Off the top of my head, I cannot think of how to solve this. For reasons, it cannot use
-C extra-filename
for both bins and dylibs.--emit
can take paths like--emit dep-info=target/debug/deps/foo-somehash.d
, so maybe that is an option. At a minimum, cargo should emit a warning that this is a known bug, similar to #6313.Notes
Output of
cargo version
:cargo 1.52.0-nightly (90691f2 2021-03-16)
The text was updated successfully, but these errors were encountered: