Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 872668 - media-sound/mpd-0.23.9-r1 write logs into /var/lib/mpd directory instead of FHS dedicated /var/log/
Summary: media-sound/mpd-0.23.9-r1 write logs into /var/lib/mpd directory instead of F...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Adrian Schollmeyer
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2022-09-24 15:59 UTC by Sergey S. Starikoff
Modified: 2024-02-05 15:13 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey S. Starikoff 2022-09-24 15:59:53 UTC
[I] media-sound/mpd (0.23.9-r1@21.09.2022): The Music Player Daemon (mpd)

/etc/mpd.conf:
…
# These settings are the locations for the daemon log files for the daemon.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog.
#
# If you use systemd, do not configure a log_file.  With systemd, MPD
# defaults to the systemd journal, which is fine.
#
log_file "/var/lib/mpd/log"
…

On commonly used systemd builds log file doesn't matter.
But Gentoo default is non-systemd profile (that is excellent!).

So, I think we should follow FHS reglamentations.
And fix log_file into config and logrotate script in ebuild, together with reporting upstream.
To something like:
> log_file "/var/log/mpd/log"


P.S. Also:
pid_file "/var/lib/mpd/pid"
looks suspicios.
AFAIR accodring FHS pid files should be located in /var/run/
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-27 21:21:00 UTC
This is from the sed block in the ebuild so it seems deliberate, but I've no idea why:
```
         sed -i \
                -e 's:^#filesystem_charset.*$:filesystem_charset "UTF-8":' \
                -e 's:^#user.*$:user "mpd":' \
                -e 's:^#bind_to_address.*any.*$:bind_to_address "localhost":' \
                -e 's:^#bind_to_address.*$:bind_to_address "/var/lib/mpd/socket":' \
                -e 's:^#music_directory.*$:music_directory "/var/lib/mpd/music":' \
                -e 's:^#playlist_directory.*$:playlist_directory "/var/lib/mpd/playlists":' \
                -e 's:^#db_file.*$:db_file "/var/lib/mpd/database":' \
                -e 's:^#log_file.*$:log_file "/var/lib/mpd/log":' \
                -e 's:^#pid_file.*$:pid_file "/var/lib/mpd/pid":' \
                -e 's:^#state_file.*$:state_file "/var/lib/mpd/state":' \
                doc/mpdconf.example || die
```
Comment 2 Adrian Schollmeyer 2023-01-23 11:44:24 UTC
mpd is a bit misbehaving in that it creates the PID file after switching the user. Thus, if the "user" config directive is set in the config, MPD creates the PID file with that user as owner and thus can't write to /run. This could explain the switch to /var/lib/mpd/pid as default.

While creating the PID file as non-root user is a bad practice, I wouldn't consider this a problem of the ebuild itself. One could potentially ask upstream to resolve the matter. A quick search in GitHub yielded no results about PID file permissions.
Comment 3 Larry the Git Cow gentoo-dev 2024-02-05 15:13:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e052555c5ead5ea46c5b8d5ebc61f9e89a4d5fa8

commit e052555c5ead5ea46c5b8d5ebc61f9e89a4d5fa8
Author:     Adrian Schollmeyer <nex+b-g-o@nexadn.de>
AuthorDate: 2023-11-12 21:11:27 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2024-02-05 15:13:55 +0000

    media-sound/mpd: add 0.23.15
    
    The new version removes unnecessary modifications to the default
    configuration and adds default values for creating the PID file and log
    file in FHS directories.
    
    Co-Authored-By: Jeroen Roovers <jer@xs4all.nl>
    Closes: https://bugs.gentoo.org/872668
    Closes: https://bugs.gentoo.org/918421
    Closes: https://bugs.gentoo.org/919577
    Signed-off-by: Adrian Schollmeyer <nex+b-g-o@nexadn.de>
    Closes: https://github.com/gentoo/gentoo/pull/34469
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 media-sound/mpd/Manifest                    |   1 +
 media-sound/mpd/files/mpd-0.23.15.init      |  61 ++++++
 media-sound/mpd/files/mpd-0.23.15.logrotate |   9 +
 media-sound/mpd/mpd-0.23.15.ebuild          | 284 ++++++++++++++++++++++++++++
 4 files changed, 355 insertions(+)