-
Notifications
You must be signed in to change notification settings - Fork 102
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
#1112: Version-prefix not working as expected #1137
#1112: Version-prefix not working as expected #1137
Conversation
…ion-prefix-not-working-as-expected
This PR is a bugfix PR, so we don't need to document this in the CHANGELOG? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Leosssss thanks for your PR. You figured out correct solutions to determine if the version_prefix
ends with a digit and also how to escape a .
to prevent it from matching any character. Great work that already works and solves the root problem described in the story 👍
Sorry, for being picky but could you do the escaping in both cases (I could still do JAVA_VERSION=17.0*
and even with your fix, this would also match a potential version 1720.0
- theoretical case but lets get this fixed once and forever)? And could you also avoid the redundancy by using a local variable that is either empty or [^0-9]
so you can reuse the same code without duplication?
@hohwille Thank you for your feedback, I still have a question, what should happen when JAVA_VERSION=17.0*? Should the regex return no results? |
…ion-prefix-not-working-as-expected
To demonstrate my point, I have copied your code into this script:
I added the versions
|
This is my final understanding of this issue: version-prefix is used to find the latest version STARTING with version-prefix. It should be noted that when e.g. version-prefix is "1.1*", only version numbers starting with "1.1.xxx" can be matched, while versions like "1.10.xxx" should not be matched. The version "1.10.xxx" is not the version that can be matched by "1.1*". To match "1.10.xxx", the version_prefix should be "1.10*"/"1.10.*"
For the build error, see the log:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Leosssss thanks for your rework. 👍 You got very close but after looking deeper, I still found some problems. I will better do a constructive review and change the code accordingly and merge it. I hope this was a good learning on how fiddly the bash syntax is and how important testing with the different given examples is in IT business.
bugfix: add a condition to check if the version_prefix end with a digit