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

Bug: ./agent-install.sh: line 1562: -1: substring expression < 0 #4072

Closed
ashutosrath opened this issue Jun 5, 2024 · 0 comments · Fixed by ashutosrath/anax#1 or #4073
Closed

Bug: ./agent-install.sh: line 1562: -1: substring expression < 0 #4072

ashutosrath opened this issue Jun 5, 2024 · 0 comments · Fixed by ashutosrath/anax#1 or #4073
Labels

Comments

@ashutosrath
Copy link
Contributor

ashutosrath commented Jun 5, 2024

Describe the bug.

Getting below error while running ./agent-install.sh in macosx bash shell

./agent-install.sh: line 1562: -1: substring expression < 0

Describe the steps to reproduce the behavior.

kubectl version -o json
{
  "clientVersion": {
    "major": "1",
    "minor": "27",
    "gitVersion": "v1.27.2",
    "gitCommit": "7f6f68fdabc4df88cfea2dcf9a19b2b830f1e647",
    "gitTreeState": "clean",
    "buildDate": "2023-05-17T14:20:07Z",
    "goVersion": "go1.20.4",
    "compiler": "gc",
    "platform": "darwin/amd64"
  },
  "kustomizeVersion": "v5.0.1",
  "serverVersion": {
    "major": "1",
    "minor": "29+",
    "gitVersion": "v1.29.4-eks-036c24b",
    "gitCommit": "9c0e57823b31865d0ee095997d9e7e721ffdc77f",
    "gitTreeState": "clean",
    "buildDate": "2024-04-30T23:53:58Z",
    "goVersion": "go1.21.9",
    "compiler": "gc",
    "platform": "linux/amd64"
  }
}
WARNING: version difference between client (1.27) and server (1.29) exceeds the supported minor version skew of +/-1

here the minor_version is calculated as

echo $minor_version
29+

MacOSX bash returns substring expression < 0 error if we calculate as

minor_version=${minor_version::-1}

Fix needs to be like below

minor_version=${minor_version::$((${#minor_version} - 1))}

Expected behavior.

the min_version should have properly calculated

Screenshots.

No response

Operating Environment

mac osx x86

Additional Information

No response

@ashutosrath ashutosrath added the bug label Jun 5, 2024
ashutosrath added a commit to ashutosrath/anax that referenced this issue Jun 5, 2024
fixed minor_version calculation of kubectl 

Fixes: open-horizon#4072

Signed-off-by: ASHUTOS RATH <[email protected]>
@ashutosrath ashutosrath reopened this Jun 5, 2024
LiilyZhang pushed a commit to ashutosrath/anax that referenced this issue Jul 19, 2024
fixed minor_version calculation of kubectl 

Fixes: open-horizon#4072

Signed-off-by: ASHUTOS RATH <[email protected]>
LiilyZhang added a commit that referenced this issue Jul 23, 2024
fix #4072 : minor_version of kubectl calculated by stripping '+' correctly
LiilyZhang pushed a commit to LiilyZhang/anax that referenced this issue Aug 1, 2024
fixed minor_version calculation of kubectl 

Fixes: open-horizon#4072

Signed-off-by: ASHUTOS RATH <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant