Repository navigation
fix: keep the service running the current binary after a Homebrew upgrade - #59
Merged
Merged
Conversation
…rade Install saved the symlink-resolved path of the running binary. Homebrew keeps each version in its own directory under Caskroom (casks, which this project ships) or Cellar (formulas) and removes the old one on upgrade, so after the first upgrade the service definition pointed at a binary that no longer existed. - When the resolved binary is in a Homebrew Caskroom or Cellar directory, the service records the <prefix>/bin link instead, which Homebrew repoints on upgrade, and only if it is the same file. - -start and -restart fail with a -reinstall hint when the recorded binary no longer exists and warn when it differs from the running binary; the installed definition is never rewritten implicitly. - -diag reports a missing installed binary as a failure and shares the path comparison with the lifecycle commands. - README documents the recorded path and the one-time reinstall for services installed by earlier versions. Closes #50. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request
Summary
-installsaved the symlink-resolved path of the running binary in the service definition. This project ships a Homebrew cask, which installs each version under<prefix>/Caskroom/ssh-agent-proxy/<version>/, links it into<prefix>/bin, and removes the old version on upgrade. After the firstbrew upgrade, the service therefore pointed at a binary that no longer existed and could not start until it was reinstalled. Formulas behave the same way under<prefix>/Cellar.CaskroomorCellardirectory, the service records the<prefix>/bin/<name>link instead, which Homebrew repoints on upgrade. The link is used only when it is verifiably the same file; otherwise the resolved path is kept as before.-startand-restartfail with a-reinstallhint when the recorded binary no longer exists, and print a warning when it differs from the binary being run. The installed definition, config path, and cache arguments are never rewritten implicitly;-reinstallremains the way to change them.-diagreports a missing installed binary as a failure with the same hint, and now shares the path comparison (service.SamePath,service.CurrentExecutable) with the lifecycle commands instead of keeping its own copy.brew upgradetakes effect at the next-restart, and the one-time-reinstallfor services installed by earlier versions.Closes #50.
User impact
New installs from Homebrew record
/opt/homebrew/bin/ssh-agent-proxy(or the equivalent prefix), so upgrades take effect at the next restart without reinstalling. Existing installs still record the versioned Caskroom path and need onessh-agent-proxy -reinstallfrom a build that includes this change. When the recorded binary is missing,-startand-restartnow explain how to fix it instead of failing inside launchd or systemd.Installations outside Homebrew are unchanged: they record the resolved binary path and need
-reinstallafter the binary is moved or replaced.Validation
binlink; a missing link, a link to a different version, and a non-Homebrew path keep the resolved path; the program check accepts present, uninstalled, and unknown programs and rejects a removed one with a-reinstallhint; path comparison follows the Homebrew link and distinguishes versions;-diagfails on a missing installed binary; the-start/-restartcheck rejects a removed binary./opt/homebrew/Caskroom/ssh-agent-proxy/0.99.2/ssh-agent-proxymaps to/opt/homebrew/bin/ssh-agent-proxy, and a removed version path yields the reinstall error. A realbrew upgradewas not run.SSH_AGENT_PROXY_REQUIRE_OPENSSH=1 go test -race ./....go vet ./...(alsoGOOS=linux), formatting,git diff --check, and CGO-disabled builds for darwin/linux × amd64/arm64.Checklist
go test -race ./...passes locally, or the reason it was not run is documented.🤖 Generated with Claude Code