Open
Conversation
There was a problem with the vercomp function that caused it to echo more than once for some comparisons. This would appear to be a side effect of changing the stackoverflow function to echo instead of using return value. Comparing 1.2 and 1.3.1 is one of the cases that was echoing more than once. This then caused the test for `"$rtn" == "1"` to be false, which meant that it was trying to use the old source URL.
|
👏 (assuming it works! 😆) |
Author
|
@Solistra I can't reproduce that issue. It downloaded 1.0.3 for me correctly. Additionally, I extracted the function into this test script: #! /usr/bin/env bash
function vercomp () {
# http://stackoverflow.com/questions/4023830
# 0: '='
# 1: '>'
# 2: '<'
if [[ $1 == $2 ]]
then
echo 0
return
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
do
ver1[i]=0
done
for ((i=0; i<${#ver1[@]}; i++))
do
if [[ -z ${ver2[i]} ]]
then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]}))
then
echo 1
return
fi
if ((10#${ver1[i]} < 10#${ver2[i]}))
then
echo 2
return
fi
done
# echo 0
}
for ver in 1.0 1.0.3 1.1 1.1.1 1.2 1.2.1 1.3 1.3.1; do
echo "${ver} $(vercomp ${ver} 1.2)"
doneand it returned the values expected: |
alext
added a commit
to alphagov/packager
that referenced
this pull request
Sep 9, 2014
See wfarr/goenv#13 for details.
|
👍 any news on this @wfarr ? |
alext
added a commit
to alphagov/packager
that referenced
this pull request
Jan 24, 2015
This switches to my fork of goenv because the upstream doesn't seem to be active any more. Version 0.0.6 includes 2 fixes: * fix goenv install to work with the new download URLs for Go 1.3.1+ (wfarr/goenv#13) * update goenv exec to allow running any command on the PATH (wfarr/goenv#17)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There was a problem with the vercomp function that caused it to echo
more than once for some comparisons. This would appear to be a side
effect of changing the stackoverflow function to echo instead of using
return value.
Comparing 1.2 and 1.3.1 is one of the cases that was echoing more than
once. This then caused the test for
"$rtn" == "1"to be false, whichmeant that it was trying to use the old source URL.