yardnsm / tmux-1password

:key: Access your 1Password login items within tmux!
MIT License
256 stars 24 forks source link

Ensure semver gets parsed correctly #31

Closed tapayne88 closed 2 years ago

tapayne88 commented 2 years ago

I'm getting some errors from the semver parser when running

./utils/semver.sh: line 31: ((: 10#2.0.2 > 10#2.0.0: syntax error: invalid arithmetic operator (error token is ".0.2 > 10#2.0.0")
./utils/semver.sh: line 35: ((: 10#2.0.2 < 10#2.0.0: syntax error: invalid arithmetic operator (error token is ".0.2 < 10#2.0.0")

From a little debugging it seems the versions aren't getting split by the IFS value and the length of both values is 1. Looking at the original source it seems the parentheses are important to get the values to split.

local i ver1=($1) ver2=($2)

However, according to the shellcheck language server the safer way to parse the values is to use read https://github.com/koalaman/shellcheck/wiki/SC2206

Happy to swap back to the original implementation if you prefer though as both seem to work!

tapayne88 commented 2 years ago

Bit of context

❯ op --version
2.0.2
delucca commented 2 years ago

@yardnsm can you merge this please? I've manually applied this solution and it works.

yardnsm commented 2 years ago

Sorry about the delay!