Package: mpc
Version: 0.17-1
Severity: normal
When you try to complete a path that has spaces (which is quite common
with music collections). `mpc ls`'s completion will break the path by
spaces.
I attach a "works-for-me" patch. Basically I set IFS to just \n (I hope
that this character is not too common in file names). I also remove a
level or two of assignments, which may also help.
I should also note that the current functions uses many temporary
variables that are not declared local. This means the function may have
side effects.
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.30-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=he_IL.UTF-8, LC_CTYPE=he_IL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages mpc depends on:
ii libc6 2.9-25 GNU C Library: Shared libraries
mpc recommends no packages.
Versions of packages mpc suggests:
ii mpd 0.15.4-1 Music Player Daemon
-- no debconf information
--
Tzafrir Cohen | [email protected] | VIM is
http://tzafrir.org.il | | a Mutt's
[email protected] | | best
ICQ# 16849754 | | friend
--- /tmp/mpc/etc/bash_completion.d/mpc 2009-08-22 00:29:40.000000000 +0300
+++ /etc/bash_completion.d/mpc 2009-10-25 07:59:17.321512824 +0200
@@ -4,6 +4,11 @@
#export MPD_HOST="127.0.0.1"
#export MPD_PORT="6600"
+_mpadd_escape_filename ()
+{
+ sed -e 's/[][(){}<>",:;^&!$=?`|\ '\'']/\\&/g' -e 's/\n$/ /'
+}
+
_mpdadd_complete_func ()
{
cur="${COMP_WORDS[COMP_CWORD]}"
@@ -36,12 +41,12 @@
return 0
;;
ls)
+ local IFS=$'\n'
if [ "x$cur" = "x" ]; then
- hold=`mpc ls`;
+ COMPREPLY=($(mpc ls | _mpadd_escape_filename));
else
- hold=`mpc lstab ${cur}`;
+ COMPREPLY=($(mpc lstab ${cur} | _mpadd_escape_filename));
fi
- COMPREPLY=($(compgen -W "${hold}" | sed "$scrub"))
return 0
;;
search)