-
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
Panic due to "0.*.*" wildcard version number in Cargo.toml #3202
Comments
These are definitely invalid versions, but cargo should certainly do better than panic! On Oct 16, 2016, 16:43 -0400, CensoredUsername notifications@github.com, wrote:
|
Whoops, looks like markdown accidentally ate my version wildcards. The problematic version number was "0..". |
@steveklabnik it looks like this may be a semver bug? The stack trace looks like:
That is, this looks like it's in |
Ah interesting... it does look like that. I will investigate tomorrow. |
Can confirm, something is amiss in
Here, if we have a wildcard on the patch version, we assume that we have a number for the minor version. But because this requirement is parsed incorrectly, it does not. @alexcrichton , should I fold these kinds of versions back into our new "parse but indicate that they're deprecated" list? I think that's the approach I'd prefer here. |
Actually, it looks like these versions should be okay. Nevermind. |
We improperly assumed that if we had a wildcard patch version, we must have a non-wildcard minor version. This is actually incorrect.
Thanks for the fix @steveklabnik! |
@CensoredUsername for my own knowledge... is this an older project that just started to panic? Or something new where you added it. Given that, while the version parser has changed a lot, this code didn't change at all, I'm interested in if this is a regression rather than something new. |
(Doing some of my own testing, it seems like this was in So this leads me to believe that this isn't a regression, was just always a bug in semver. |
Okay, this is very strange now. While that semver version doesn't work, using @alexcrichton , does/did Cargo do any pre-processing to semver versions like this? I have a hunch that this was never passed through to semver in the first place, and it'd be nice to confirm why this bug was happening before we put a band-aid on it, only to find out later it wasn't the right one. |
That may be the case, although I thought we parsed everything... Perhaps this was added "accidentally" in the update semver PR? |
Some gdb logs for https://github.com/steveklabnik/cargo/blob/464e6a96fb599049761a8842c89118bde1683edd/src/cargo/core/dependency.rs#L111 when trying to parse a dependency of 'stable' cargo:
nightly cargo:
It looks like they produce the exact same |
And from within old
new
|
I figured it out!
I'll merge that fix in and cut a new release, sorry about the spam here! |
We improperly assumed that if we had a wildcard patch version, we must have a non-wildcard minor version. This is actually incorrect. This bug has been present in semver since at least the 0.2 series, but `cargo build` never happend to invoke Display for Predicate. The bug manifested in newer Cargos because in 0.5, we do call Display for Predicate.
@steveklabnik Just for the record, it was on a project I was actively working on, and the last time I ran rustup update should only have been a few weeks ago. I didn't change the version numbers in between. |
@CensoredUsername thanks! Unfortunately fixing this bug has exposed another. I am trying to track it down, but will stop spamming this issue, as the root cause has been found, at least from Cargo's perspective. |
@steveklabnik no problem, and good luck chasing down the bugs. |
bump semver to 0.5.1 Fixes #3202 I've verified locally that this works, and have a test for it within semver. Two, actually. @CensoredUsername if you could give this a shot to double check that it fixes your exact bug, that'd be cool.
On recent nightlies, my cargo started panicing when trying to do any operation that involved the registry. The panic message was as following:
The panic message disappeared after changing a version number in Cargo.toml from "0.." to "0.0.". It was confirmed by another person that changing a version number to "0..*" caused his cargo to panic as well.
The text was updated successfully, but these errors were encountered: