Compare commits

...

9 Commits

Author SHA1 Message Date
Max Kellermann
3bbcda917c release v0.19.21 2016-12-13 10:54:04 +01:00
Max Kellermann
7e43fb79af Makefile.am: fix mpd.socket path in EXTRA_DIST 2016-12-13 10:53:41 +01:00
Max Kellermann
eb2b567da6 NEWS: fix version number 2016-12-13 10:45:53 +01:00
Max Kellermann
ab332d7b2e systemd: add user unit
The user unit omits the "ProtectKernelModules" setting which fails
with modular kernels:

 Failed at step CAPABILITIES spawning /usr/bin/mpd: Operation not permitted

It is unfortunate that systemd (version 232) is unable to reduce its
own capabilities, because this requires us to split system and user
units.

 https://bugs.musicpd.org/view.php?id=4608
2016-12-13 10:24:10 +01:00
Max Kellermann
53e22b81ef systemd: add "system" sub directory 2016-12-13 10:24:10 +01:00
Max Kellermann
3fc9d50adb doc/user: fix --with-systemdsystemunitdir example 2016-12-13 10:24:10 +01:00
Max Kellermann
c2da6dd45b test/test_queue_priority: fix unit test failure after recent "setprio" change 2016-12-13 08:36:42 +01:00
Max Kellermann
7146f825b2 decoder/ffmpeg: fix double free bug
From the avformat_open_input() API documentation:

 "Note that a user-supplied AVFormatContext will be freed on failure."

https://bugs.musicpd.org/view.php?id=4607
2016-12-13 08:34:05 +01:00
Max Kellermann
f61a5f5200 configure.ac: prepare for 0.19.21 2016-12-13 08:31:21 +01:00
10 changed files with 92 additions and 24 deletions

2
.gitignore vendored

@@ -35,7 +35,7 @@ tags
/mkinstalldirs
/build
/src/mpd
/systemd/mpd.service
/systemd/system/mpd.service
/stamp-h1
/src/dsd2pcm/dsd2pcm

@@ -1449,8 +1449,13 @@ FILTER_LIBS = \
if HAVE_SYSTEMD
systemdsystemunit_DATA = \
systemd/mpd.socket \
systemd/mpd.service
systemd/system/mpd.socket \
systemd/system/mpd.service
endif
if HAVE_SYSTEMD_USER
systemduserunit_DATA = \
systemd/user/mpd.service
endif
@@ -2166,7 +2171,7 @@ EXTRA_DIST = $(doc_DATA) autogen.sh \
$(wildcard $(srcdir)/scripts/*.rb) \
$(man_MANS) $(DOCBOOK_FILES) doc/mpdconf.example doc/doxygen.conf \
$(wildcard $(srcdir)/doc/include/*.xml) \
systemd/mpd.socket \
systemd/system/mpd.socket \
android/AndroidManifest.xml \
android/build.py \
android/custom_rules.xml \

6
NEWS

@@ -1,3 +1,9 @@
ver 0.19.21 (2016/12/13)
* decoder
- ffmpeg: fix crash bug
* fix unit test failure after recent "setprio" change
* systemd: add user unit
ver 0.19.20 (2016/12/09)
* protocol
- "setprio" re-enqueues old song if priority has been raised

@@ -1,10 +1,10 @@
AC_PREREQ(2.60)
AC_INIT(mpd, 0.19.20, musicpd-dev-team@lists.sourceforge.net)
AC_INIT(mpd, 0.19.21, musicpd-dev-team@lists.sourceforge.net)
VERSION_MAJOR=0
VERSION_MINOR=19
VERSION_REVISION=20
VERSION_REVISION=21
VERSION_EXTRA=0
AC_CONFIG_SRCDIR([src/Main.cxx])
@@ -52,6 +52,22 @@ if test "x$with_systemdsystemunitdir" != xno; then
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
AC_ARG_WITH([systemduserunitdir],
AS_HELP_STRING([--with-systemduserunitdir=DIR], [Directory for systemd service files]),
[], [with_systemduserunitdir=no])
if test "x$with_systemduserunitdir" = xyes; then
AC_MSG_CHECKING(for systemd)
with_systemduserunitdir=$($PKG_CONFIG --variable=systemduserunitdir systemd)
if test -z "$with_systemduserunitdir"; then
AC_MSG_ERROR([Failed to detect systemd])
fi
AC_MSG_RESULT([$with_systemduserunitdir])
fi
if test "x$with_systemduserunitdir" != xno; then
AC_SUBST([systemduserunitdir], [$with_systemduserunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD_USER, [test -n "$with_systemduserunitdir" -a "x$with_systemduserunitdir" != xno ])
dnl ---------------------------------------------------------------------------
dnl Declare Variables
dnl ---------------------------------------------------------------------------
@@ -1905,7 +1921,8 @@ dnl Generate files
dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(doc/doxygen.conf)
AC_CONFIG_FILES(systemd/mpd.service)
AC_CONFIG_FILES(systemd/system/mpd.service)
AC_CONFIG_FILES(systemd/user/mpd.service)
AC_OUTPUT
echo 'MPD is ready for compilation, type "make" to begin.'

@@ -151,7 +151,7 @@ apt-get install g++ \
<application>systemd</application> unit files: a "service"
unit and a "socket" unit. These will only be installed when
<application>MPD</application> was configured with
<parameter>--with-systemdsystemunitdir=/lib/systemd</parameter>.
<parameter>--with-systemdsystemunitdir=/lib/systemd/system</parameter>.
</para>
<para>
@@ -167,6 +167,33 @@ systemctl start mpd.socket</programlisting>
<varname>port</varname> settings.
</para>
</section>
<section id="systemd_user">
<title><filename>systemd</filename> user unit</title>
<para>
You can launch <application>MPD</application> as a
<filename>systemd</filename> user unit. The service file will
only be installed when <application>MPD</application> was
configured with
<parameter>--with-systemduserunitdir=/usr/lib/systemd/user</parameter>
or
<parameter>--with-systemduserunitdir=$HOME/.local/share/systemd/user</parameter>.
</para>
<para>
Once the user unit is installed, you can start and stop
<application>MPD</application> like any other service:
</para>
<programlisting>systemctl --user start mpd</programlisting>
<para>
To auto-start <application>MPD</application> upon login, type:
</para>
<programlisting>systemctl --user enable mpd</programlisting>
</section>
</chapter>
<chapter id="config">

@@ -71,7 +71,6 @@ FfmpegOpenInput(AVIOContext *pb,
int err = avformat_open_input(&context, filename, fmt, nullptr);
if (err < 0) {
avformat_free_context(context);
SetFfmpegError(error, err, "avformat_open_input() failed");
return nullptr;
}

@@ -0,0 +1,29 @@
[Unit]
Description=Music Player Daemon
After=network.target sound.target
[Service]
ExecStart=@prefix@/bin/mpd --no-daemon
# allow MPD to use real-time priority 50
LimitRTPRIO=50
LimitRTTIME=infinity
# disallow writing to /usr, /bin, /sbin, ...
ProtectSystem=yes
# more paranoid security settings
NoNewPrivileges=yes
ProtectKernelTunables=yes
ProtectControlGroups=yes
# AF_NETLINK is required by libsmbclient, or it will exit() .. *sigh*
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
RestrictNamespaces=yes
# Note that "ProtectKernelModules=yes" is missing in the user unit
# because systemd 232 is unable to reduce its own capabilities
# ("Failed at step CAPABILITIES spawning /usr/bin/mpd: Operation not
# permitted")
[Install]
WantedBy=default.target

@@ -164,21 +164,6 @@ QueuePriorityTest::TestPriority()
check_descending_priority(&queue, current_order + 1);
/* priority=60 for the old prio50 item; must not be moved,
because it's before the current song, and it's status
hasn't changed (it was already higher before) */
unsigned c_order = 0;
unsigned c_position = queue.OrderToPosition(c_order);
CPPUNIT_ASSERT_EQUAL(50u, unsigned(queue.items[c_position].priority));
queue.SetPriority(c_position, 60, current_order);
current_order = queue.PositionToOrder(current_position);
CPPUNIT_ASSERT_EQUAL(3u, current_order);
c_order = queue.PositionToOrder(c_position);
CPPUNIT_ASSERT_EQUAL(0u, c_order);
/* move the prio=20 item back */
a_order = queue.PositionToOrder(a_position);