Your message dated Thu, 28 Feb 2013 23:36:49 +0100
with message-id <[email protected]>
and subject line Re: mpc: bash completion of ls fails if directories have spaces
has caused the Debian Bug report #552287,
regarding mpc: bash completion of ls fails if directories have spaces
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
552287: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=552287
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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)

--- End Message ---
--- Begin Message ---
Control: Fixed 552287 0.19-1                                                    
              

bash completion was completely rewritten in mpc 0.19, including some
support for paths with spaces (this is not perfect, but a lot more
useable than previously)

--- End Message ---

Reply via email to