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

rubygems is not semver #5

Closed
oliverchang opened this issue Jun 9, 2021 · 3 comments · Fixed by #14
Closed

rubygems is not semver #5

oliverchang opened this issue Jun 9, 2021 · 3 comments · Fixed by #14

Comments

@oliverchang
Copy link

e.g. rails: https://rubygems.org/gems/rails/versions/6.1.3.2

I see you try to coerce this into a semver:

https://github.com/nexB/univers/blob/63bd5aec16ec95b5b811ede638ac225f3ab1f6c6/src/univers/versions.py#L107

but this isn't correct, because it gets coerced to "6.1.3+2". and the "+2" part is not considered for ordering purposes per https://semver.org/spec/v2.0.0.html#spec-item-11

>>> SemverVersion('6.1.3.2') < SemverVersion('6.1.3.3')
False

See also https://snyk.io/blog/differences-in-version-handling-gems-and-npm/ for more issues with trying to handle ruby versions as semver.

Other ecosystems may have similar problems. E.g. composer recommends following semver, but it also doesn't enforce it: https://getcomposer.org/doc/articles/versions.md

@pombredanne
Copy link
Member

@oliverchang Thank you ++

@pombredanne
Copy link
Member

We may end up having many more version schemes and comparison all re-implemented, but that's OK, that's what is needed anyway. And when we attack the dependency resolution problem for aboutcode-org/dependency-inspector#1 we will at least have solved a key part. For dependencies, I am pretty sure that resolution is devilishly different for each package type and ecosystem, or worse because there are eventually multiple resolution algorithm and tools that can exists for any given package type in most cases (except may be for the most recent projects in the youngest ecosystems like Go or Rust)

@Hritik14 Hritik14 linked a pull request Nov 30, 2021 that will close this issue
pombredanne added a commit that referenced this issue Dec 7, 2021
Reference: #5
Reported-by: Oliver Chang @oliverchang
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
pombredanne added a commit that referenced this issue Dec 7, 2021
This is a vers wrapper on the gem.py Rubygems version implmentation.

Reference: #5
Reported-by: Oliver Chang @oliverchang
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@pombredanne
Copy link
Member

The PR #14 adds support for Rubygems version comparison using a proper port of Ruygems version.rb and requirement.rb and a full implementation of version range spec

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

Successfully merging a pull request may close this issue.

2 participants