Skip to content

Commit c934743

Browse files
committed
fix: suppress false 'upgrade failed' when binary hash matches target
The installer now writes a marker file when SHA256 hash comparison shows the binary is already at the target release. guide.sh checks this marker and reports success instead of warning about unchanged version strings. Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
1 parent e342c44 commit c934743

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

scripts/guide.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ process_tool() {
295295
# Re-audit with fresh collection for this specific tool
296296
CLI_AUDIT_JSON=1 CLI_AUDIT_COLLECT=1 CLI_AUDIT_MERGE=1 "$CLI" audit.py "$tool" >/dev/null 2>&1 || true
297297
reload_audit_json
298+
# Clean up any already-current marker left by installer
299+
rm -f "/tmp/.cli-audit/${catalog_tool}.already-current"
298300
return 0
299301
fi
300302

@@ -407,10 +409,20 @@ process_tool() {
407409

408410
# Check if upgrade succeeded by comparing versions
409411
local new_installed="$(json_field "$tool" installed)"
412+
# Check if installer flagged binary as already at target (hash match)
413+
local already_current_marker="/tmp/.cli-audit/${catalog_tool}.already-current"
414+
local binary_already_current=""
415+
if [ -f "$already_current_marker" ]; then
416+
binary_already_current="true"
417+
rm -f "$already_current_marker"
418+
fi
410419
if [ "$upgrade_success" = "0" ]; then
411420
# Install script failed
412421
printf "\n ⚠️ Upgrade failed (install script error)\n"
413422
prompt_pin_version "$tool" "$installed"
423+
elif [ -n "$binary_already_current" ]; then
424+
# Binary hash matches target release - upgrade succeeded despite version string
425+
printf "\n ✓ Binary already matches target release (upstream version string may be stale)\n"
414426
elif [ "$new_installed" = "$installed" ] && [ "$new_installed" != "$latest" ]; then
415427
# Version didn't change and not at target
416428
# BUT: if installed is a prefix of latest (e.g., 3.13 vs 3.13.11), consider it success
@@ -456,9 +468,18 @@ process_tool() {
456468

457469
# Check if upgrade succeeded
458470
local new_installed_a="$(json_field "$tool" installed)"
471+
# Check if installer flagged binary as already at target (hash match)
472+
local already_current_marker_a="/tmp/.cli-audit/${catalog_tool}.already-current"
473+
local binary_already_current_a=""
474+
if [ -f "$already_current_marker_a" ]; then
475+
binary_already_current_a="true"
476+
rm -f "$already_current_marker_a"
477+
fi
459478
if [ "$upgrade_success_a" = "0" ]; then
460479
printf "\n ⚠️ Upgrade failed (install script error)\n"
461480
printf " Auto-update is still enabled - will try again next time.\n"
481+
elif [ -n "$binary_already_current_a" ]; then
482+
printf " ✓ Auto-update enabled. Binary already matches target release.\n"
462483
elif [ "$new_installed_a" = "$installed" ] && [ "$new_installed_a" != "$latest" ]; then
463484
# Version didn't change - but check for prefix match (e.g., 3.13 vs 3.13.11)
464485
if [[ "$latest" == "$new_installed_a"* ]] || [[ "$new_installed_a" == "$latest"* ]]; then

scripts/installers/github_release_binary.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ printf "[%s] after: %s\n" "$TOOL" "${after:-<none>}"
281281
if [ -n "$path" ]; then printf "[%s] path: %s\n" "$TOOL" "$path"; fi
282282
if [ "$BINARY_ALREADY_CURRENT" = "true" ]; then
283283
printf "[%s] note: binary already matches target release %s (upstream version string may be stale)\n" "$TOOL" "$LATEST"
284+
# Signal already-current status to callers (e.g., guide.sh)
285+
mkdir -p /tmp/.cli-audit
286+
echo "$LATEST" > "/tmp/.cli-audit/${TOOL}.already-current"
284287
fi
285288

286289
# Refresh snapshot after successful installation

0 commit comments

Comments
 (0)