fix(upgrade): detect downgrades at minor and patch levels

version_lt kept the whole version as a single array element, so the
arithmetic comparison failed and the function always returned false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bertrand Gouny
2026-10-13 22:06:15 +02:00
co-authored by Claude Opus 5.5
parent 7ce0c43309
commit a762bda77d
@@ -14,7 +14,9 @@ extract_version() {
version_lt() {
local IFS=.
local -a v1=("$1") v2=("$2")
local -a v1 v2
read -ra v1 <<< "$1"
read -ra v2 <<< "$2"
for i in 0 1 2; do
local a=${v1[i]:-0} b=${v2[i]:-0}
(( 10#$a < 10#$b )) && return 0