Package: libaudio-mpd-perl
Version: 2.000-1
Severity: wishlist
Tags: upstream patch
Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=99762
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. I already
submitted it upstream.
Regards,
S
-- System Information:
Debian Release: jessie/sid
APT prefers proposed-updates
APT policy: (500, 'proposed-updates'), (500, 'unstable'), (500, 'testing'),
(500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libaudio-mpd-perl depends on:
ii libaudio-mpd-common-perl 2.002-1
ii libgetopt-euclid-perl 0.4.5-1
ii libio-socket-ip-perl 0.32-1
ii libmoose-perl 2.1213-1
ii libmoosex-has-sugar-perl 1.000004-1
ii libmoosex-semiaffordanceaccessor-perl 0.10-1
ii libproc-daemon-perl 0.14-2
ii perl 5.20.1-2
ii perl-base [libio-socket-ip-perl] 5.20.1-2
libaudio-mpd-perl recommends no packages.
Versions of packages libaudio-mpd-perl suggests:
ii mpd 0.19.1-1
-- no debconf information
>From 576d58da0194aab9733846de39575239b42c3016 Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Sun, 9 Nov 2014 15:51:39 +0000
Subject: [PATCH] Add patch to allow a mpd Unix socket
---
debian/changelog | 3 ++
...001-Recognise-MPD_HOST-.-as-a-Unix-socket.patch | 48 ++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 52 insertions(+)
create mode 100644 debian/patches/0001-Recognise-MPD_HOST-.-as-a-Unix-socket.patch
create mode 100644 debian/patches/series
diff --git a/debian/changelog b/debian/changelog
index 5aeca83..3aa76ec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ libaudio-mpd-perl (2.000-2) UNRELEASED; urgency=medium
[ gregor herrmann ]
* debian/control: update {versioned,alternative} (build) dependencies.
+ [ Simon McVittie ]
+ * Add patch to allow a mpd Unix socket
+
-- Salvatore Bonaccorso <[email protected]> Sat, 16 Aug 2014 09:29:38 +0200
libaudio-mpd-perl (2.000-1) unstable; urgency=low
diff --git a/debian/patches/0001-Recognise-MPD_HOST-.-as-a-Unix-socket.patch b/debian/patches/0001-Recognise-MPD_HOST-.-as-a-Unix-socket.patch
new file mode 100644
index 0000000..37248ce
--- /dev/null
+++ b/debian/patches/0001-Recognise-MPD_HOST-.-as-a-Unix-socket.patch
@@ -0,0 +1,48 @@
+From: Simon McVittie <[email protected]>
+Date: Thu, 23 Oct 2014 21:32:19 +0100
+Subject: 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;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3f9f3b7
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Recognise-MPD_HOST-.-as-a-Unix-socket.patch
--
2.1.3