-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fixes #3133: Properly handle release candidates in version comparison #3136
Conversation
cc @chriscool and @lgierth for review |
1d60491
to
544c577
Compare
…ison Deduplicate version checking code across scripts License: MIT Signed-off-by: Mateusz Naściszewski <matin1111@wp.pl>
544c577
to
1667212
Compare
} | ||
# Get path to the directory containing this file | ||
# If $0 has no slashes, uses "./" | ||
PREFIX=$(expr $0 : "\(.*\/\)") || PREFIX='./' |
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.
It might be safer to use expr "$0"
instead of expr $0
in case $0 contains spaces.
License: MIT Signed-off-by: Mateusz Naściszewski <matin1111@wp.pl>
major_number() { | ||
vers="$1" | ||
|
||
# Hack around 'expr' exiting with code 1 when it outputs 0 |
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.
wat. Thats dumb. (I just ran this in my shell)
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.
I agree, but that's from the original version checking code by chriscool.
The same goes for an empty string as output, hence the digit captured in both regex alternations at lines 39/52.
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.
@whyrusleeping and @mateon1 I am not sure what you think is dump.
My opinion is that expr
exiting with code 1 when it returns 0 is really dump indeed!
It looks like it comes from the fact that it can be used for arithmetics.
@chriscool Look good to you? |
@whyrusleeping yeah LGTM now! |
Thanks @mateon1! |
License: MIT
Signed-off-by: Mateusz Naściszewski matin1111@wp.pl