services: resolve owner from the registered service file - #23781
Merged
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
Contributor
There was a problem hiding this comment.
馃煝 Approval recommended
The ownership fix is covered by regression tests with no unresolved issues.
Pull request overview
Resolves macOS service ownership from the registered service file鈥檚 location before using legacy fallbacks.
Changes:
- Maps boot-path services to
rootand user-path services to the current user. - Adds regression tests for conflicting registrations.
File summaries
| File | Description |
|---|---|
Library/Homebrew/test/services/formula_wrapper_spec.rb |
Tests user and root ownership precedence. |
Library/Homebrew/services/formula_wrapper.rb |
Resolves ownership from the registered service path. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
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.
Follow-up to #23750.
FormulaWrapper#ownerfell through to the boot-path presence check whenever the registered plist had noUserName, so a user whose ownsh.brew.<formula>agent is registered under~/Library/LaunchAgentswas reported asrootas soon as a legacyhomebrew.mxcl.<formula>daemon also existed under/Library/LaunchDaemons. That wrong owner shows up inbrew services listandinfoand in the root-skipping filter behindstop --allandrestart --all.The owner now follows the registered service file: in the boot path it is
root, in the user path it is the current user, and only then does the presence-based fallback run. This also fixes a nil owner for package-provided plists whose label is not one of the formula's generated names, since the presence checks only look at those names. Linux and systemd behavior is unchanged.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code (Fable 5.1) drafted the implementation and tests; I reviewed the diff, verified the new tests fail without the change and pass with it, and ran
brew lgtm.