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

[Issue/Discussion] rocks can't install packages with weird versions #387

Open
mrcjkb opened this issue Feb 2, 2025 · 2 comments
Open

[Issue/Discussion] rocks can't install packages with weird versions #387

mrcjkb opened this issue Feb 2, 2025 · 2 comments
Labels
bug Something isn't working discussion needs triage

Comments

@mrcjkb
Copy link
Member

mrcjkb commented Feb 2, 2025

Some packages have really strange versioning schemes:

Example:

  • lua-cjson: 2.1.0.10-1 has a 4th digit, and the patch version is always 0.

Currently, we fail to parse these versions.
We could try to put anything between the patch version and the specrev as a semver::Prerelease.
But the behaviour might be undefined.

luarocks.core.vers actually allows for an arbitrary number of digits and compares up to

math.max(#v1, #v2)

effectively appending zeros.

From the semver docs:

/// # Syntax
///
/// Pre-release strings are a series of dot separated identifiers immediately
/// following the patch version. Identifiers must comprise only ASCII
/// alphanumerics and hyphens: `0-9`, `A-Z`, `a-z`, `-`. Identifiers must not be
/// empty. Numeric identifiers must not include leading zeros.
///
/// # Total ordering
///
/// Pre-releases have a total order defined by the SemVer spec. It uses
/// lexicographic ordering of dot-separated components. Identifiers consisting
/// of only digits are compared numerically. Otherwise, identifiers are compared
/// in ASCII sort order. Any numeric identifier is always less than any
/// non-numeric identifier.

... we might have to do something hacky.

An alternative option would be to say we just don't support non-SemVer compliant versions.
If a package wants to be compatible with rocks, they have to support SemVer.
In the long run, that might make life easier for everyone.

@mrcjkb mrcjkb added bug Something isn't working discussion needs triage labels Feb 2, 2025
@mrcjkb
Copy link
Member Author

mrcjkb commented Feb 2, 2025

In any case, I think we currently don't parse prerelease or build metadata, which we probably should.

@mrcjkb
Copy link
Member Author

mrcjkb commented Feb 2, 2025

Damn... with arbitrary numbers of digits allowed in version requirements (e.g., > 1-1, < 1.2.0.10.15.200.1.0) - which is what you'll need if you want to install the latest lua-cjson "version", this is going to be a huge PITA.

Our current implementation removes all specrevs by splitting on -.
This also removes potential prerelease identifiers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion needs triage
Projects
None yet
Development

No branches or pull requests

1 participant