-
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
cargo can't install crates with a version string including the + character #9410
Comments
Note this is similar to rustwasm/wasm-pack#907. |
Hi! Sorry I'm a bit confused since the error seems correct to me. FWIW, everything after the |
For me, if I run this on Bash on Linux it tries to fetch the wrong version on a relatively clean Cargo environment, which makes it seem like the part after the However, if I then run the original command again the second time, it installs fine. It looks like it now works because a version of "0.8.0" is already cached locally.
|
Thanks for the clarification! I see the problem now. For me, it only fails after the first download of the index. (It might happen in other scenarios.) The reasons are complicated, but it boils down to a global cache in cargo (the package id cache). The The reason it gets populated without the metadata is that there is this code path which checks if the package is already installed without updating the index. Since the index doesn't exist, it hits this code path which checks if it is yanked. That particular code path uses a VerionReq to create a PackageId, which ends up poisoning the cache with an PackageId without metadata. Then, when it does download the index and try to actually install the package, it ends up with a PackageId missing the metadata, and then the download link is computed incorrectly. Whew... That will be tricky to fix, but I'll take a look at it. |
Ah I see, so the quoting in my test is just a red herring. I would be glad to see this fixed eventually, but if we need to run CI builds now on a fresh environment (let's say a docker container), is there a better workaround than running the |
Unfortunately I am unable to think of a better workaround for now. |
Problem
cargo
in Linux can't install crates likecargo-c
, whose versions include a+
character in them.Steps
cargo install cargo-c --version=0.8.0+cargo-0.51
Possible Solution(s)
A workaround in Linux is to quote the semver with double quotes. In Windows, this workaround errors out similarly to Linux.
Notes
Output of
cargo version
:cargo 1.51.0 (43b129a20 2021-03-16)
In Linux, the error is:
or alternatively (like in our CI):
In Mac and Windows, it succeeds without escaping. Escaping the version string on Windows returns:
The text was updated successfully, but these errors were encountered: