In addition to the unquoted "$quoted" that @peter-cordes mentioned, there's another bug in the _filedir() function:
--- /usr/share/bash-completion/bash_completion--OLD 2015-08-19 19:58:22.734667377 -0500
+++ /usr/share/bash-completion/bash_completion 2016-01-05 15:56:50.442988910 -0500
@@ -604,6 +604,8 @@
# 2>/dev/null for direct invocation, e.g. in the _filedir unit test compopt -o filenames 2>/dev/null COMPREPLY+=( "${toks[@]}" )
+ else
+ compopt -o bashdefault 2>/dev/null
fi
} # _filedir()
This lets you eat your cake and have it, too: you can keep your "shopt -s progcmp" bash_completion AND if that doesn't find a match, it will fall back to using bash's default glob-handling.
In addition to the unquoted "$quoted" that @peter-cordes mentioned, there's another bug in the _filedir() function:
--- /usr/share/ bash-completion /bash_completio n--OLD 2015-08-19 19:58:22.734667377 -0500 bash-completion /bash_completio n 2016-01-05 15:56:50.442988910 -0500
compopt -o filenames 2>/dev/null
COMPREPLY +=( "${toks[@]}" )
+++ /usr/share/
@@ -604,6 +604,8 @@
# 2>/dev/null for direct invocation, e.g. in the _filedir unit test
+ else
+ compopt -o bashdefault 2>/dev/null
fi
} # _filedir()
This lets you eat your cake and have it, too: you can keep your "shopt -s progcmp" bash_completion AND if that doesn't find a match, it will fall back to using bash's default glob-handling.
(This also solves Bug 1361404)