Skip Menu |

This queue is for tickets about the Audio-MPD CPAN distribution.

Report information
The Basics
Id: 99762
Status: resolved
Priority: 0/
Queue: Audio-MPD

People
Owner: Nobody in particular
Requestors: smcv [...] debian.org
Cc: gregoa [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.000
Fixed in: (no value)



Subject: [patch] please add support for mpd on a Unix socket
Since mpd 0.14 (2008) it has been possible for mpd to listen on an AF_UNIX socket. Access is controlled by Unix filesystem permissions, making a password unnecessary. The convention seems to be to set MPD_HOST to the absolute path to the socket, e.g. "/home/me/.cache/mpd.socket", ignoring MPD_PORT; and to recognise these connections via the leading "/". The attached patch adds support for this, and seems to be enough to enable mpd-dynamic to work in this configuration.
Subject: 0001-Recognise-MPD_HOST-.-as-a-Unix-socket.patch
From ffb8b89ca45ca1984b780e81ea77cf8957c308e8 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@debian.org> Date: Thu, 23 Oct 2014 21:32:19 +0100 Subject: [PATCH] Recognise MPD_HOST="/..." as a Unix socket --- lib/Audio/MPD.pm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/Audio/MPD.pm b/lib/Audio/MPD.pm index 530ef29..ffab9fc 100644 --- a/lib/Audio/MPD.pm +++ b/lib/Audio/MPD.pm @@ -38,7 +38,7 @@ has collection => ( ro, lazy_build, isa=>'Audio::MPD::Collection' ); has playlist => ( ro, lazy_build, isa=>'Audio::MPD::Playlist' ); has version => ( rw ); -has _socket => ( rw, isa=>'IO::Socket::IP' ); +has _socket => ( rw, isa=>'IO::Socket' ); #-- @@ -93,11 +93,21 @@ sub _connect_to_mpd_server { my ($self) = @_; # try to connect to mpd. - my $socket = IO::Socket::IP->new( - PeerAddr => $self->host, - PeerPort => $self->port, - ) - or die "Could not create socket: $!\n"; + my $socket; + + if ($self->host =~ m{^/}) { + eval q{use IO::Socket::UNIX qw(); 1} + or die "Could not load IO::Socket::UNIX: $@\n"; + $socket = IO::Socket::UNIX->new($self->host) + or die "Could not create socket: $!\n"; + } + else { + $socket = IO::Socket::IP->new( + PeerAddr => $self->host, + PeerPort => $self->port, + ) + or die "Could not create socket: $!\n"; + } # parse version information. my $line = $socket->getline; -- 2.1.1
On Thu Oct 23 16:39:47 2014, http://smcv.pseudorandom.co.uk/ wrote: Show quoted text
> Since mpd 0.14 (2008) it has been possible for mpd to listen on an > AF_UNIX socket. Access is controlled by Unix filesystem permissions, > making a password unnecessary.
do you have a patch against latest version please? thanks & sorry for the (loooong) delay in answering.
Subject: Re: [rt.cpan.org #99762] [patch] please add support for mpd on a Unix socket
Date: Fri, 29 Apr 2016 00:12:02 +0100
To: Jerome Quelin via RT <bug-Audio-MPD [...] rt.cpan.org>
From: Simon McVittie <smcv [...] debian.org>
On Thu, 28 Apr 2016 at 14:34:31 -0400, Jerome Quelin via RT wrote: Show quoted text
> On Thu Oct 23 16:39:47 2014, http://smcv.pseudorandom.co.uk/ wrote:
> > Since mpd 0.14 (2008) it has been possible for mpd to listen on an > > AF_UNIX socket. Access is controlled by Unix filesystem permissions, > > making a password unnecessary.
> > do you have a patch against latest version please? > thanks & sorry for the (loooong) delay in answering.
That patch was against 2.000, but I don't see anything in the 2.001 or 2.002 changes that would affect it. S
Now applied in V2.004 Thanks for the report, the patch & your patience :-)
Subject: Re: [rt.cpan.org #99762] [patch] please add support for mpd on a Unix socket
Date: Fri, 20 May 2016 15:23:23 +0200
To: Jerome Quelin via RT <bug-Audio-MPD [...] rt.cpan.org>
From: gregor herrmann <gregoa [...] debian.org>
On Fri, 20 May 2016 08:06:52 -0400, Jerome Quelin via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=99762 > > > Now applied in V2.004 > Thanks for the report, the patch & your patience :-)
Great, thanks. Uploaded to Debian/unstable. Cheers, gregor -- .''`. Homepage https://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `-
Download signature.asc
application/pgp-signature 949b

Message body not shown because it is not plain text.