From: JuanJo Ciarlante <jjo@canonical.com>
Subject: fix _quote_readline_by_ref to:
- avoid escaping 1st '~' (lp: #1288314)
- avoid quoting if empty, else expansion without args only shows dirs
- replace double escaping to single (eg for completing file/paths with
Origin: vendor, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739835
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739835
Forwarded: yes, <5328F418.100@canonical.com>
bash_completion | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
@@ -526,13 +526,24 @@ __ltrim_colon_completions()
# @param $2 Name of variable to return result to
- if [[ $1 == \'* ]]; then
+ # avoid quoting if empty
+ elif [[ $1 == \'* ]]; then
# Leave out first character
+ elif [[ $1 == ~* ]]; then
+ # avoid escaping first ~
+ printf -v $2 ~%q "${1:1}"
+ # Replace double escaping ( \\ ) by single ( \ )
+ # This happens always when argument is already escaped at cmdline,
+ # and passed to this function as e.g.: file\ with\ spaces
+ [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"
# If result becomes quoted like this: $'string', re-evaluate in order to
# drop the additional quoting. See also: http://www.mail-archive.com/
# bash-completion-devel@lists.alioth.debian.org/msg01942.html