Homebrew-core: brew services ignores MPD's user configuration

Created on 1 Aug 2018  路  9Comments  路  Source: Homebrew/homebrew-core

  • [x] are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh
  • [x] have a problem with brew install (or upgrade, reinstall) a single, official formula (not cask)? If it's a general brew problem please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • [x] ran brew update and can still reproduce the problem?
  • [ ] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [x] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • [ ] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

What you were trying to do:
Use MPD via a service.

What happened:
MPD starts. MPD has lost all of the information about its state, does not have a database, does not have playlists, does not do anything that you'd expect out of a valid MPD installation.

Step-by-step:

brew install mpd
nano ~/.mpd/mpd.conf
brew services start mpd

MPD supports multiple locations for a configuration file. Those who want to run MPD on a system level would usually use/etc/mpd.conf in order to give all users the same exact configuration. However, those who are running MPD as a single user would preferably use $XDG_CONFIG_HOME/mpd/mpd.conf, ~/.mpdconf or ~/.mpd/mpd.conf, which are all automatically supported by MPD and are given a higher priority than /etc/mpd.conf. However, the Homebrew service is currently forcing MPD to use the global configuration, which does not make a lot of sense since the services are apparently ran under the logged in user and not root.

https://gist.github.com/Hamuko/1bcb01351c44222a0584c5068133bcd7

outdated

All 9 comments

it would try to use /usr/local/etc which _is_ changeable without root. But you have a good point. Do you know if there's a way to not specify the configuration?

Just running mpd without any configuration specifications works. At that point it will attempt multiple locations in order to find a valid configuration.

       mpd.conf - Music Player Daemon configuration file

DESCRIPTION
       mpd.conf  is  the  configuration  file for mpd(1).  If not specified on the command
       line, MPD first searches for it at $XDG_CONFIG_HOME/mpd/mpd.conf then at ~/.mpdconf
       then at ~/.mpd/mpd.conf and then in /etc/mpd.conf.

We'd review a PR changing the behavior of the plist.

I just upgraded MPD and it stopped working across all of my systems because the service has a config specified so it no longer reads the default ~/.mpd/mpd.config path 馃槩

I'm happy to work on a fix, but idk how to reconcile "works out of the box" with "don't ignore the default config search paths". The only thing I can think of at the moment is to use a startup script that checks the default paths ($XDG_CONFIG_HOME/mpd/mpd.conf then ~/.mpdconf then /etc/mpd.conf) and falls back to /usr/local/etc/mpd/mpd.conf.

That doesn't seem like a very clean solution though...

@jerryskye Would adding a caveat be a valid solution rather than breaking the default config paths?

Something like:

  def caveats; <<~EOS
    MPD requires a config file to start. Create the directory ~/.config/mpd and copy the default config:
      mkdir -p ~/.config/mpd
      cp #{etc}/mpd/mpd.conf ~/.config/mpd
  EOS
  end

but idk how to reconcile "works out of the box" with "don't ignore the default config search paths".

The thing is that MPD does not work out of the box. The configuration file hard-coded into the service doesn't define anything, so you still need to configure MPD yourself. The only difference is now that you have to make your configuration to a very specific file instead of any of the pre-defined options.

If the goal was to actually get MPD to working out of the box at least for some people, you'd have to start adding a lot more guess-work defaults in the configuration file.

@Hamuko I completely agree with you. I'll put together a pull request in the next couple days (unless someone beats me to it!) to revert it and we'll see how that goes...

@jerryskye 馃憦 Thanks for the revert and addition of a caveat! If I had a buck for every "whoops" PR I got merged in I'd be rich so you're in good company 馃槣

Thanks for your help guys 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Steffen911 picture Steffen911  路  3Comments

jakepetroules picture jakepetroules  路  3Comments

daviderestivo picture daviderestivo  路  4Comments

jyutzler picture jyutzler  路  4Comments

yuna9 picture yuna9  路  4Comments