Moving this to ports,
On Sun, Apr 26 2020, Stuart Henderson <s...@spacehopper.org> wrote: > On 2020/04/26 14:29, Moises Simon wrote: >> Hi, >> >> after the mixerctl/sndioctl change in -current >> sndioctl doesn't work if mpd is playing music. >> >> Other music players like cmus work fine >> >> OpenBSD 6.7-beta (GENERIC.MP) #153: Fri Apr 24 07:15:21 MDT 2020 >> Information for inst:mpd-0.21.21 >> >> sirius$ sndioctl -v >> input[0].level=0.49 >> input[1].level=0.49 >> input[0].mute=0 >> input[1].mute=0 >> output[0].level=0.71 >> output[1].level=0.71 >> output[0].mute=0 >> output[1].mute=0 >> app/mpd0.level=1 >> sirius$ mpc play >> Héroes del Silencio - La chispa adecuada >> [playing] #18/62 3:51/5:01 (76%) >> volume:100% repeat: on random: on single: off consume: on >> sirius$ sndioctl -v >> default: can't open control device > > sndioctl first tries to connect to sndiod using ~/.sndio/cookie, > which I think in this case probably fails because mpd (running as a > different uid) has already connected to sndiod using its own cookie. > > When that fails it falls back to trying to connect to the kernel > interface (i.e. via the device node in /dev) which is no longer > permitted, triggering the "can't open control device" error. > > I'm not an mpd user but I think the fix for this situation is that mpd > needs a copy of your ~/.sndio/cookie so that both you and mpd can both > control the device. How to get there, I'm not sure, because the uid > running mpd has its home directory set as /var/empty, maybe that needs > changing to a real directory. That is something we discussed with chrisz@. One concern I had was that changing the home directory in the PLIST won't affect upgrades and more generally machines where the _mpd is present in master.passwd. And forcefully changing the home dir with usermod -d isn't nice to people who have already dealt with this problem. This is something we could document in a README, along with the special setup needed to share sndiod access. Diff below. > Or it _might_ be possible to workaround > by having mpd talk to sndiod over a TCP socket instead (like > https://undeadly.org/cgi?action=article;sid=20180410063454 but using > 127.0.0.1 instead of an external address). I'm afraid (not sure) that this won't address the cookie issue. So building up on the discussion with Christopher, here's a diff that changes _mpd's home dir to /var/spool/mpd and documents a bit what people need to do. Feedback and improvements welcome. No idea if I should leave @sample /var/spool/mpd in the PLIST, portcheck also warns about VARBASE... (Unrelated, drop the tremor FLAVOR from DESCR while here.) Index: Makefile =================================================================== RCS file: /cvs/ports/audio/mpd/Makefile,v retrieving revision 1.128 diff -u -p -r1.128 Makefile --- Makefile 20 Mar 2020 17:52:30 -0000 1.128 +++ Makefile 26 Apr 2020 18:08:32 -0000 @@ -3,6 +3,7 @@ BROKEN-hppa = no atomic ops COMMENT = Music Player Daemon VER = 0.21.21 +REVISION = 0 DISTNAME = mpd-${VER} EXTRACT_SUFX = .tar.xz CATEGORIES = audio Index: pkg/DESCR =================================================================== RCS file: /cvs/ports/audio/mpd/pkg/DESCR,v retrieving revision 1.5 diff -u -p -r1.5 DESCR --- pkg/DESCR 16 Apr 2012 09:50:17 -0000 1.5 +++ pkg/DESCR 26 Apr 2020 18:08:32 -0000 @@ -3,9 +3,3 @@ Ogg, FLAC, AAC, Mod and WAV files) and m designed for integrating a computer into a stereo system that provides control for music playback over a local network. It also makes a great desktop music player and has several frontend options. - -Flavors - -tremor: Use the tremor integer-only Vorbis decoder. This disables - the use of the FLAC codec within Ogg containers and the - network streaming functionality. Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/audio/mpd/pkg/PLIST,v retrieving revision 1.13 diff -u -p -r1.13 PLIST --- pkg/PLIST 15 Aug 2019 05:44:37 -0000 1.13 +++ pkg/PLIST 26 Apr 2020 18:08:32 -0000 @@ -1,7 +1,7 @@ @comment $OpenBSD: PLIST,v 1.13 2019/08/15 05:44:37 landry Exp $ @pkgpath audio/mpd,tremor @newgroup _mpd:560 -@newuser _mpd:560:560:daemon:Music Player Daemon:/var/empty:/sbin/nologin +@newuser _mpd:560:560:daemon:Music Player Daemon:/var/spool/mpd:/sbin/nologin @extraunexec rm -rf /var/log/mpd/* @extraunexec find /var/spool/mpd \! -name playlists -mindepth 1 -exec rm -rf "{}" \; @rcscript ${RCDIR}/mpd @@ -13,6 +13,7 @@ share/doc/mpd/AUTHORS share/doc/mpd/COPYING share/doc/mpd/NEWS share/doc/mpd/README.md +share/doc/pkg-readmes/${PKGSTEM} share/examples/mpd/ share/examples/mpd/mpd.conf @sample ${SYSCONFDIR}/mpd.conf Index: pkg/README =================================================================== RCS file: pkg/README diff -N pkg/README --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/README 26 Apr 2020 18:08:32 -0000 @@ -0,0 +1,17 @@ +$OpenBSD: README.template,v 1.7 2019/05/09 17:45:05 ajacoutot Exp $ + ++------------------------------------------------------------------------------- +| Running ${PKGSTEM} on OpenBSD ++------------------------------------------------------------------------------- + +sndiod(8) concurrent access by mpd(1) and other users +===================================================== + +sndiod(8) only allows access from a single user/hostname at a time, +unless a cookie is provided. See AUTHENTICATION in sndio(7) for +more details. If you want to share sndiod(8) access with mpd(1) running +as the default _mpd user, you may copy an existing cookie in +/var/spool/mpd/.sndio/cookie. + +If you previously had mpd installed on your system, make sure the home +directory of the _mpd user is actually /var/spool/mpd. -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE