-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Canonicalize path_args src #7079
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Thanks for the PR! I don't think I'm entirely clear on the scenarios though of where this causes issues. Could you perhaps include a test which exhibits the behavior that this is fixing? |
@alexcrichton sure, will do! Looks like the Windows build is failing; the canonical versions of the paths don't seem to be recognized by cargo. Is this a known issue? Should the canonicalizing step be skipped on Windows? (edit: that would make sense since symlinks are anyway a bit of a tricky thing on Windows) |
I wrote a test and rearranged history a bit. I pushed the test and I'll wait for CI to finish (fail) before I re-push the fix. The test shows that if a crate has a local dependency on crate The use case that interests me more is the other way around: the dependency This second use case is what allows me to pre build dependencies on CI, which would most likely solve #1139 (see https://github.com/nmattia/naersk/blob/6b41d979039e06eef6fbe940d439c9f09427f11a/default.nix#L57-L61 for a nix solution). |
The job indeed failed, see: https://travis-ci.com/rust-lang/cargo/jobs/213020941#L2554 |
Hm ok I think I see what's going on here. The problem is that when detecting whether to rebuild something we're not taking into account any symlinks resolved along the way. Ideally we need to not only take into account the mtime of the file that rustc has read but also the mtime of any symlink inbetween. I don't think that this is the right fix since it only handles renames of the project root, and not renames of files underneath the project root which deal with symlinks. That being said this seems like it's very difficult to fix. I'm not really sure if there's a great fix for this other than content-based fingerprinting. |
Oh, content-based fingerprinting would be awesome! Is there any reason why this isn't currently implemented? Performance concerns? |
There's more information about it in #6529, but it wasn't implemented initially due to performance concerns yeah. |
Haven't heard back from you in awhile @nmattia so I'm gonna close this, but feel free to resubmit with comments addressed! |
I ended working around this and forgot to close. Thanks for the feedback! |
Fixes #7078.
When cargo registers information used later on to figure out whether or not to recompile a unit, the path to the source is tracked in the fingerprint. However this path is not canonicalized, meaning that e.g. symlinks aren't resolved before the source paths are added to the fingerprint.
See #7078 for a full description of the issue.