brew: API installs do not handle `plist_name`

brew gist-logs <formula> link OR brew config AND brew doctor output

https://gist.github.com/jasonhemann/821e327dc2606424874915af244ceda7

Note that several of the `brew doctor` warnings are incorrect, including the ones about brew's `bin` and `sbin` not being on path.

Verification

  • My “brew doctor output” says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

dbus.rb installs the plist file as org.freedesktop.dbus-session.plist. Following the discussion at https://github.com/orgs/Homebrew/discussions/2318 , it should be homebrew.mxcl.dbus.plist.

Presently, executing brew services start dbus fails with an error message. After cp org.freedesktop.dbus-session.plist homebrew.mxcl.dbus.plist, and using sudo, services seems to start just fine.

What happened (include all command output)?

dbus seems to install just fine, but it looks like the plist doesn’t have the appropriate name https://github.com/orgs/Homebrew/discussions/2318

What did you expect to happen?

Truthfully, I expected to find the plist linked into ~/Library/LaunchAgents/ .

Step-by-step reproduction instructions (by running brew commands)

brew install dbus
brew services start dbus
cp $(brew --prefix dbus)/org.freedesktop.dbus-session.plist $(brew --prefix dbus)/homebrew.mxcl.dbus.plist
sudo brew services start dbus

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 19 (18 by maintainers)

Most upvoted comments

I feel like we should probably just add this to the service block and then it will get included with the API. The important thing is to make it backwards compatible in case someone outside of the core repo is using a similar pattern in their package definitions.

service do
  plist_name "name"
  service_name "name"
end

This would require some changes with how we check for commands before writing new service files since we shouldn’t actually do any of that without a run command defined in the service block. It also might require some changes to brew services for a similar reason. The point is that if we want to actually support this use case going forward we should give people a better API that is easier to use and also explicitly supported (remember the current use case is never mentioned in the docs).

We probably need to support something but that doesn’t mean it has to be in its current DSL form. If we’re embedding into the API then we cannot allow any dynamic elements (beyond OS/arch variations) so overriding a method makes less sense compared to a single line DSL. The current naming is perhaps confusing for some (service_name is Linux only).

Though we cope fine with the method model for caveats (albeit with some initial gotchas) so exact syntax probably doesn’t matter.

With that said, Homebrew/core should exclusively be public API so we should probably consider plist_name as public API at this point, particularly given its long-time use.

Something to keep in mind if planning to change the dbus or xinit formulae instead - changing plist name is a breaking change that would ideally be communicated in, e.g., the caveats, so best avoided unless that’s the direction we definitely want to take.

Maybe we could rename the plist during bottling?

If this works that’s fine, though if not then adding to the API JSON seems extremely trivial to do.