-
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
Allow having broken symlinks in the packaged cargo archive #11203
Comments
Thank you for the proposal! I totally understand what you're trying to solve. Also have no idea why Cargo implemented like this, as the logic dates back to Cargo v0.0.1-pre😆. However, I do have concerns on this being implemented. Cargo tries its best to make every If Cargo now switches the behaviour to align with git, some projects will start failing as they cannot find the actual contents during compiling. If we keep the current behaviour and only treat broken symlinks as you proposed, the inconsistency sounds even more confusing, at least to me. We may loose the restriction a bit, such like when Cargo.toml |
Hmmm… as you're saying, I guess silently changing the behavior or reusing Maybe introducing an |
Hmm… It could be a solution but not optimal in my opinion. There are some concerns around it.
Though I don't have any better idea than what you propose so far. 😞 |
Hmm you're right, but I don't see any better option that'd avoid backwards-compatibility hazards either :/ guess I'll leave this open hoping for other people to come in with ideas! |
Would you be open to a PR that mentions in the |
Yeah, I think that is appreciated! Perhaps adding one simple sentence to the second step of Just checked the implementation again. I believe cargo/src/cargo/ops/cargo_package.rs Lines 930 to 942 in 82c489f
I would personally avoid this kind of statement, as I may miss some details or there are workarounds to bypass how Cargo follows symlinks. |
docs: More information on what is and isn't included by cargo package <!-- homu-ignore:start --> <!-- Thanks for submitting a pull request 🎉! Here are some tips for you: * If this is your first contribution, read "Cargo Contribution Guide" first: https://doc.crates.io/contrib/ * Run `cargo fmt --all` to format your code changes. * Small commits and pull requests are always preferable and easy to review. * If your idea is large and needs feedback from the community, read how: https://doc.crates.io/contrib/process/#working-on-large-features * Cargo takes care of compatibility. Read our design principles: https://doc.crates.io/contrib/design.html * When changing help text of cargo commands, follow the steps to generate docs: https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages * If your PR is not finished, set it as "draft" PR or add "WIP" in its title. * It's ok to use the CI resources to test your PR, but please don't abuse them. --> ### What does this PR try to resolve? Add more detail to `cargo package` explaining what is and isn't included. This doesn't add the feature requested by #11203 (shipping symlinks) but it does at least make it more clear that it's not supported. ### How should we test and review this PR? Docs only change. I wrote this by reading [src/cargo/sources/path.rs](https://github.com/rust-lang/cargo/blob/82c489f1c612096c2dffc48a4091d21af4b8e046/src/cargo/sources/path.rs), in addition to my observations of cargo behavior, so it might be helpful for reviewers to check the new docs against the code.
Problem
In https://github.com/Ekleog/kannader/tree/main/smtp-queue-fs, I have a
res/
folder that intentionally contains a broken symlink. This folder is properly tracked by git, and used by tests to validate thatsmtp-queue-fs
behaves correctly when faced with a queue that has a broken symlinkProposed Solution
It would be nice if
cargo
were able to store the same types of files asgit
, so including broken symlinks. This would make it possible to upload this kind of crates with its tests on crates.ioNotes
I guess an alternative would be to not have the broken symlink be checked-in, and instead handle the test creation and validation differently. However, it makes it harder to just add tests, given that it means manual care needs to be given to each test that has a broken symlink.
I would understand if you think that'd be a non-feature and you didn't want to allow including broken symlinks in the crate on crates.io, but I thought it was worth opening this issue to gather feedback over whether it'd be of interest. Sorry if it has already been discussed elsewhere!
The text was updated successfully, but these errors were encountered: