Package: bash
Version: 4.3-2
Severity: normal

Dear Maintainer,

The completion of files that contain spaces is broken:
$ touch a\ b1 a\ b2
$ ls a\ b

Press TAB: nothing happen.
The bash-completion package verions
ii  bash-completion              1:2.1-2

It's working with bash version 4.3-1.
I check in the completion script and found that compgen (bash-completion
package) does not behave the same depending on bash version.

Version 4.3-1:
$ compgen -f -X '' -- 'a\\\ '
a b2
a b1
$

Version 4.3-2:
$ compgen -f -X '' -- 'a\\\ '
$

I wrote this patch and it seems to correct this issue but I do not know if
this is the right approach.
$ diff -u /usr/share/bash-completion/bash_completion.bak
/usr/share/bash-completion/bash_completion
--- /usr/share/bash-completion/bash_completion.bak    2014-03-06
20:11:58.580659112 +0100
+++ /usr/share/bash-completion/bash_completion    2014-03-06
20:12:36.824761849 +0100
@@ -563,10 +563,9 @@
     _tilde "$cur" || return 0

     local -a toks
-    local quoted x tmp
+    local x tmp

-    _quote_readline_by_ref "$cur" quoted
-    x=$( compgen -d -- "$quoted" ) &&
+    x=$( compgen -d -- "$cur" ) &&
     while read -r tmp; do
         toks+=( "$tmp" )
     done <<< "$x"
@@ -575,7 +574,7 @@
         # Munge xspec to contain uppercase version too
         #
http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306
         xspec=${1:+"!*.@($1|${1^^})"}
-        x=$( compgen -f -X "$xspec" -- $quoted ) &&
+        x=$( compgen -f -X "$xspec" -- "$cur" ) &&
         while read -r tmp; do
             toks+=( "$tmp" )
         done <<< "$x"
@@ -584,7 +583,7 @@
     # If the filter failed to produce anything, try without it if
configured to
     [[ -n ${COMP_FILEDIR_FALLBACK:-} && \
         -n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
-        x=$( compgen -f -- $quoted ) &&
+        x=$( compgen -f -- "$cur" ) &&
         while read -r tmp; do
             toks+=( "$tmp" )
         done <<< "$x"

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash depends on:
ii  base-files   7.2
ii  dash         0.5.7-4
ii  debianutils  4.4
ii  libc6        2.18-4
ii  libtinfo5    5.9+20140118-1

Versions of packages bash recommends:
ii  bash-completion  1:2.1-2

Versions of packages bash suggests:
pn  bash-doc  <none>

Reply via email to