Skip to content

fix: Linux installer keeps the live tree on a failed same-version reinstall; quote the pgrep pattern - #1024

Merged
sahil87 merged 2 commits into
mainfrom
fix/linux-desktop-installer-review-followups
Sep 17, 2026
Merged

sahil87 merged 2 commits into
mainfrom
fix/linux-desktop-installer-review-followups

Conversation

@sahil87

@sahil87 sahil87 commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1023 (merged before this commit landed on its branch). Findings from an independent code review of #1023:

Changes

  • Same-version --force reinstall no longer destroys the live tree first. It is set aside inside the staging dir (same filesystem, atomic rename) and put back by restoreLinuxSwap when promotion or the activation flip fails; rollback failures are reported as warnings instead of swallowed. Previously a failed flip left current dangling with nothing installed.
  • Temp activation symlink lives inside staging, so a failed flip cannot leave a stray current.tmp and the per-branch cleanup code is gone.
  • linuxProbePattern quotes the path for pgrep's ERE, so a --path containing regex metacharacters still matches the running app (the swap could otherwise proceed under a live app).
  • Uninstall drops a redundant filepath.Abs (the root is already absolute).
  • Records PR fix: Linux desktop installer hardening from the #1019 Copilot review #1023 on change 260917-ot32.

Tests

  • TestRestoreLinuxSwapPutsThePreviousTreeBack
  • TestInstallLinuxSameVersionForceReplacesLiveTree
  • pgrep-pattern expectations updated for the quoted form

Gates: go test ./internal/desktop/... ./cmd/rk/... green, go vet clean, gofmt-clean.

🤖 Generated with Claude Code

sahil87 and others added 2 commits September 17, 2026 16:53
Independent-review follow-ups on the Linux installer:

- A same-version `--force` reinstall used to RemoveAll the LIVE version dir
  before promoting the new tree, so a failed flip left `current` dangling.
  The live tree is now set aside inside staging and restored by
  restoreLinuxSwap when promotion or activation fails; rollback failures
  are reported as warnings instead of swallowed.
- The temp activation symlink lives inside staging (same filesystem, so the
  rename over `current` stays atomic), which removes the stale-tmp
  pre-clear and the per-branch cleanup.
- linuxProbePattern quotes the path for pgrep's ERE, so a --path with regex
  metacharacters still matches the running app.
- Uninstall drops its redundant filepath.Abs — effectiveInstallDir already
  returns an absolute root.
- Records PR #1023 on the 260917-ot32 change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sahil87
sahil87 merged commit 6a0e53f into main Sep 17, 2026
9 checks passed
@sahil87
sahil87 deleted the fix/linux-desktop-installer-review-followups branch September 17, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant