Skip to content
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

Intended behavior for 1.*.1 #62

Closed
dtolnay opened this issue Apr 25, 2021 · 2 comments
Closed

Intended behavior for 1.*.1 #62

dtolnay opened this issue Apr 25, 2021 · 2 comments

Comments

@dtolnay
Copy link

dtolnay commented Apr 25, 2021

My expectation is that 1.*.1 is not a meaningful version req and should fail to parse. However I don't have a spec to point to so I just wanted to confirm whether semver-parser's current behavior on this case is intended.

fn main() {
    println!("{:#?}", "1.*.1".parse::<semver_parser::RangeSet>().unwrap());
}

As of the most recent release (0.10.2) semver-parser parses it as follows, i.e. >=1.0.0, <2.0.0.

RangeSet {
    ranges: [
        Range {
            comparator_set: [
                Comparator {
                    op: Gte,
                    major: 1,
                    minor: 0,
                    patch: 0,
                    pre: [],
                },
                Comparator {
                    op: Lt,
                    major: 2,
                    minor: 0,
                    patch: 0,
                    pre: [],
                },
            ],
            compat: Cargo,
        },
    ],
    compat: Cargo,
}
@steveklabnik
Copy link
Owner

It should fail to parse, yes. If there are existing packages with versions on crates.io that are incorrect, we could add them into https://github.com/steveklabnik/semver/blob/051c39c50d565c597be65c4496597c7d16a514d9/src/version_req.rs#L323-L332 to keep compatibility, but the intention isn't for this sort of version to parse properly.

semver/semver#584 is the spec I intend to follow once I get around to actually finally double checking everything and getting it in.

@dtolnay
Copy link
Author

dtolnay commented May 25, 2021

This is fixed in 1.0.0.

fn main() {
    println!("{}", semver::VersionReq::parse("1.*.1").unwrap_err());
}
unexpected character after wildcard in version req

@dtolnay dtolnay closed this as completed May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants