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

Fix wrong Erlang/OTP version maint-x matched when requesting x #125

Merged
merged 1 commit into from
Aug 1, 2022
Merged

Fix wrong Erlang/OTP version maint-x matched when requesting x #125

merged 1 commit into from
Aug 1, 2022

Conversation

paulo-ferraz-oliveira
Copy link
Collaborator

Don't take maint- -prefixed versions into account unless they're asked for it specifically.
At the same time, while fetching versions, make sure we identify them better so that 25 does not end up pulling maint-25 instead of OTP-25.0, as it should.

Closes #120.

Don't take `maint-` -prefixed versions into account unless they're asked for it
specifically
At the same time, while fetching versions, make sure we identify them better so that
25 does not end up pulling maint-25 instead of OTP-25.0, as it should
@@ -6191,12 +6191,12 @@ async function maybeInstallRebar3(rebar3Spec) {

async function getOTPVersion(otpSpec0, osVersion) {
const otpVersions = await getOTPVersions(osVersion)
const otpSpec = otpSpec0.match(/^(OTP-)?([^ ]+)/)
const otpSpec = otpSpec0.match(/^(OTP-|maint-)?([^ ]+)/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should be case insensitive, thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which case do you expect this to change? I don't mind making it insensitive to case, but it's worked thus far...

let otpVersion
if (otpSpec[1] && !isStrictVersion()) {
throw new Error(
`Requested Erlang/OTP version (${otpSpec0}) ` +
"should not contain 'OTP-'",
"should not contain 'OTP-, or maint-'",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be sure I'm following along here, we're saying if the string you provided ends up matching two groups (OTP- or maint-) and version number, but you did not specify use strict versioning, we throw, is that all correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda, yes.

If the version string you (the consumer) provided:

  1. contains OTP- or maint-, and
  2. is not set for strict versioning,
    we throw.

What we're expecting is that a match can't go to a maint- (in this case, adding to the previous case) unless asked for, explicitly.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

I'm going ahead with merging this. We can maybe solve the details of your review in an upcoming release, if required.

@paulo-ferraz-oliveira paulo-ferraz-oliveira merged commit 69fb25b into erlef:main Aug 1, 2022
@paulo-ferraz-oliveira paulo-ferraz-oliveira deleted the fix/for-no-patch branch August 1, 2022 12:24
@paulo-ferraz-oliveira paulo-ferraz-oliveira changed the title Wrong Erlang/OTP version maint-x matched when requesting x Fix wrong Erlang/OTP version maint-x matched when requesting x Aug 1, 2022
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 this pull request may close these issues.

Wrong Erlang/OTP version maint-x matched when requesting x
2 participants