Skip to content

fix: Linux desktop installer hardening from the #1019 Copilot review - #1023

Merged
sahil-noon merged 1 commit into
mainfrom
fix/linux-desktop-installer-hardening
Sep 17, 2026
Merged

sahil-noon merged 1 commit into
mainfrom
fix/linux-desktop-installer-hardening

Conversation

@sahil87

@sahil87 sahil87 commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1019 (already merged), addressing the three inline findings Copilot posted on it after the merge.

Changes

  • effectiveInstallDir normalizes a user-supplied --path to an absolute path, so the desktop entry Exec, the ~/.local/bin/run-kit-desktop symlink, and the running-app probe all name the same launchable path regardless of the CWD a relative --path was typed from.
  • A failed activation flip (temp symlink creation or the rename over current) now removes the promoted version dir and the temp symlink, leaving the previous install exactly as it was.
  • validateExtractedTree requires AppRun to be executable, since the desktop entry and the relaunch both exec it.

Tests

  • TestEffectiveInstallDirRelativePathIsAbsolute
  • TestInstallLinuxFlipFailureLeavesNothingBehind (a non-empty directory at current forces the rename to fail)
  • TestInstallLinuxInvalidTreeRefused gains the non-executable AppRun case

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

Also finishes the review-pr stage of change 260917-ot32 (its review findings are processed here).

🤖 Generated with Claude Code

Three follow-ups to the Linux AppImage installer:

- effectiveInstallDir normalizes a user-supplied --path to an absolute
  path, so the desktop entry Exec, the ~/.local/bin symlink, and the
  running-app probe all name the same launchable path regardless of the
  CWD a relative --path was typed from.
- A failed activation flip (temp symlink or rename over current) removes
  the promoted version dir and the temp symlink, leaving the previous
  install exactly as it was.
- validateExtractedTree requires AppRun to be executable, since the
  desktop entry and the relaunch both exec it.

Also closes the review-pr stage of 260917-ot32 (its findings land here).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sahil-noon
sahil-noon merged commit fcad439 into main Sep 17, 2026
8 checks passed
sahil87 added a commit that referenced this pull request Sep 17, 2026
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>
sahil87 added a commit that referenced this pull request Sep 17, 2026
…nstall; quote the pgrep pattern (#1024)

* fix: same-version reinstall keeps the live tree; quote the pgrep pattern

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>

* chore: record PR #1024 on change 260917-ot32

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.

2 participants