> deno -V
deno 1.0.0-rc3
> deno upgrade
Checking for latest version
Local deno version 1.0.0-rc3 is the most recent release
deno upgrade --version 1.0.0 works
A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal. Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.
but since rcs were called -rcX instead of -rc.X, that is my guess for the issue
If that's the case it must be a bug in semver_parser because 1.0.0-rc3 is still a valid pre-release of 1.0.0: https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions
I think technically 1.0.0-rc3 may not be valid semver. Correct notation would be 1.0.0-rc.3.
That still leaves the question open why the semver parser doesn't error but treats 1.0.0-rc3 and 1.0.0 as equivalent.
@piscisaureus rc3 isn't a valid alphanumeric pre-release identifier?
@piscisaureus
rc3isn't a valid alphanumeric pre-release identifier?
Actually, parsing out the BNF for this case:
<valid semver> ::= ... | <version core> "-" <pre-release>
<pre-release> ::= <dot-separated pre-release identifiers>
<dot-separated pre-release identifiers> ::= <pre-release identifier> | ...
<pre-release identifier> ::= <alphanumeric identifier> | ...
<alphanumeric identifier> ::= ... | <non-digit> <identifier characters> | ...
<identifier characters> ::= ... | <identifier character> <identifier characters>
<identifier character> ::= <digit> | <non-digit>
... it seems that -rc3 is indeed fine.
So doing some debugging:
current: Version { major: 1, minor: 0, patch: 0, pre: [AlphaNumeric("rc2")], build: [] }
latest: Version { major: 1, minor: 0, patch: 0, pre: [], build: [] }
current < latest: false
current == latest: false
current > latest: true
In other words, "1.0.0-rc2" compares higher than "1.0.0".
Looking at the source code, this doesn't seem all that surprising.
semver-parser adds #[derive(Ord, PartialOrd)] to the Version type, without any consideration for pre-release versions. It probably shouldn't because the output is wrong/surprising.
It does however come with actually correct semver comparison tools: https://docs.rs/semver-parser/0.9.0/semver_parser/range/enum.Op.html.
On Pop OS:
$ deno -V
deno 1.0.0-rc1
$ deno upgrade
Checking for latest version
Local deno version 1.0.0-rc1 is the most recent release
$ deno upgrade --version 1.0.0
error: Found argument '--version' which wasn't expected, or isn't valid in this context
USAGE:
deno upgrade [OPTIONS]
For more information try --help
that's weird, at least it should upgrade to rc3... and about the --version option, that was introduced in rc2
I am running it on Virtual Box, if it will help.
On PopOS, deno upgrade --force works to get it up to 1.0.0.
This is no longer an issue, right?
Most helpful comment
On PopOS,
deno upgrade --forceworks to get it up to 1.0.0.