-
Notifications
You must be signed in to change notification settings - Fork 2.6k
cargo vendor is not consistent about paths and symbolic links on Windows vs. other platforms #14965
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
Comments
### What does this PR try to resolve? This adds a special case for checking source files are symlinks and have been modified when under a VCS control This is required because those paths may link to a file outside the current package root, but still under the git workdir, affecting the final packaged `.crate` file. ### How should we test and review this PR? Pretty similar to #14966, as a part of #14967. This may have potential performance issue. If a package contains thousands of symlinks, Cargo will fire `git status` for each of them. Not sure if we want to do anything proactively now. The introduction of the `PathEntry` struct gives us more room for storing file metadata to satisfiy use cases in the future. For instances, * Knowing a source file is a symlink and resolving it when packaging on Windows * #5664 * #14965 * Knowing more about a file's metadata (e.g. permission bits from Git) * #4413 * #8006 * Provide richer information for `cargo package --list`, for example JSON output mode * #11666 * #13331 * #13953
@glandium I had a hard time reproducing this. The repro seems to depend on a non-exact package version on crates.io. And even after I tried some recent versions, I didn't see |
Did crates.io repackage crates? I'm pretty sure I tested with crates.io back then, and I can't reproduce myself now. But this is reproducible with |
I am not aware of that. Even it really did, I'll go ahead and close this as a duplicate of #7051, as they are all git-dependency related. Thank you! |
Problem
About paths:
when a crate contains paths for e.g. dependencies in a workspace,
cargo vendor
uses / on Unices and \ on Windows, changing whatever the original path was.About symbolic links:
when a crate contains symbolic links to another file in a workspace,
cargo vendor
expands the content on Unices and replaces it with the path of the link target on Windows.Steps
cargo new foo
cd foo
cargo add libz-rs-sys
cargo vendor
On Linux or Mac, you end up with a proper
vendor/libz-rs-sys/LICENSE
file, andvendor/libz-rs-sys/Cargo.toml
hasdependencies.zlib-rs.path = "../zlib-rs"
.On Windows,
vendor/libz-rs-sys/LICENSE
literally contains../LICENSE
, andvendor/libz-rs-sys/Cargo.toml
hasdependencies.zlib-rs.path = "..\zlib-rs"
.Possible Solution(s)
cargo vendor should be consistent, wherever it's run.
Notes
No response
Version
The text was updated successfully, but these errors were encountered: