diff -Nru bash-completion-2.1/debian/changelog bash-completion-2.1/debian/changelog --- bash-completion-2.1/debian/changelog 2014-03-11 11:09:27.000000000 +0000 +++ bash-completion-2.1/debian/changelog 2014-03-13 23:57:41.000000000 +0000 @@ -1,3 +1,14 @@ +bash-completion (1:2.1-2ubuntu4) trusty; urgency=medium + + * fix _quote_readline_by_ref to: + - avoid escaping 1st '~' (lp: #1288314) + - avoid quoting if empty, else expansion without args only shows dirs + (lp: #1288031) + - replace double escaping to single (eg for completing file/paths with + spaces) + + -- JuanJo Ciarlante Thu, 13 Mar 2014 19:43:22 -0300 + bash-completion (1:2.1-2ubuntu3) trusty; urgency=medium * debian/patches/words_bad_array_subscript.patch diff -Nru bash-completion-2.1/debian/patches/quote_readline_by_ref_fixes.patch bash-completion-2.1/debian/patches/quote_readline_by_ref_fixes.patch --- bash-completion-2.1/debian/patches/quote_readline_by_ref_fixes.patch 1970-01-01 00:00:00.000000000 +0000 +++ bash-completion-2.1/debian/patches/quote_readline_by_ref_fixes.patch 2014-03-13 23:48:59.000000000 +0000 @@ -0,0 +1,29 @@ +Index: bash-completion/bash_completion +=================================================================== +--- bash-completion.orig/bash_completion 2014-03-13 19:40:27.329251000 -0300 ++++ bash-completion/bash_completion 2014-03-13 19:41:29.363721903 -0300 +@@ -536,13 +536,23 @@ + # @param $2 Name of variable to return result to + _quote_readline_by_ref() + { +- if [[ $1 == \'* ]]; then ++ if [ -z "$1" ]; then ++ # avoid quoting if empty ++ printf -v $2 %s "$1" ++ elif [[ $1 == \'* ]]; then + # Leave out first character + printf -v $2 %s "${1:1}" ++ elif [[ $1 == ~* ]]; then ++ # avoid escaping first ~ ++ printf -v $2 ~%q "${1:1}" + else + printf -v $2 %q "$1" + fi + ++ # 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 diff -Nru bash-completion-2.1/debian/patches/series bash-completion-2.1/debian/patches/series --- bash-completion-2.1/debian/patches/series 2014-03-11 11:09:27.000000000 +0000 +++ bash-completion-2.1/debian/patches/series 2014-03-13 23:48:59.000000000 +0000 @@ -3,3 +3,4 @@ dpkg-deb-R-add.patch dpkg-ddeb.patch words_bad_array_subscript.patch +quote_readline_by_ref_fixes.patch