On 03/18/2014 09:17 PM, David Paleino wrote:
> forcemerge 739835 741479 741860 742071 742054 741903 740975
> retitle 739835 filename completion broken with bash 4.3
> severity 739835 important
> tags 739835 upstream confirmed
> thanks
> 
> Hello all,
> 
> (sorry for the long list of CC)
> 
> writing to you because you reported a bug within bash-completion, which is
> likely caused by the upgrade of bash to 4.3.
> 
> I've added Ville Skyttä in CC too -- I stopped actively developing
> bash-completion long ago, and I believe he's now the main upstream developer,
> so keeping him in the mail loop.
> 
> Please, from now on, refer to bug #739835 for further posts.
> 
> Ville: it seems like
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739835#15 contains a
> patch: have you had the chance to look at it? It seems to me that it doesn't
> solve the problems reported.
> 
> Thanks, and sorry for not being totally clueless,
> David
> 

Please find attached the patch we merged into ubuntu trusty, contains
some extra fixes above the one previously at this thread.

Cheers,
--JuanJo
------------------------------------------------------------
revno: 46
tags: 1:2.1-2ubuntu4
fixes bugs: https://launchpad.net/bugs/1288314 https://launchpad.net/bugs/1288031
author: JuanJo Ciarlante <j...@canonical.com>
committer: Package Import Robot <package-imp...@ubuntu.com>
branch nick: trusty-proposed
timestamp: Thu 2014-03-13 16:43:22 -0300
message:
  * 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)
diff:
=== modified file '.pc/applied-patches'
--- .pc/applied-patches	2014-03-09 17:38:14 +0000
+++ .pc/applied-patches	2014-03-13 19:43:22 +0000
@@ -3,3 +3,4 @@
 dpkg-deb-R-add.patch
 dpkg-ddeb.patch
 words_bad_array_subscript.patch
+quote_readline_by_ref_fixes.patch

=== added directory '.pc/quote_readline_by_ref_fixes.patch'
=== modified file 'bash_completion'
--- bash_completion	2014-03-09 17:38:14 +0000
+++ bash_completion	2014-03-13 19:43:22 +0000
@@ -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

=== modified file 'debian/changelog'
--- debian/changelog	2014-03-09 17:38:14 +0000
+++ debian/changelog	2014-03-13 19:43:22 +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 <j...@canonical.com>  Thu, 13 Mar 2014 19:43:22 -0300
+
 bash-completion (1:2.1-2ubuntu3) trusty; urgency=medium
 
   * debian/patches/words_bad_array_subscript.patch

=== added file 'debian/patches/quote_readline_by_ref_fixes.patch'
--- debian/patches/quote_readline_by_ref_fixes.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/quote_readline_by_ref_fixes.patch	2014-03-13 19:43:22 +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

=== modified file 'debian/patches/series'
--- debian/patches/series	2014-03-09 17:38:14 +0000
+++ debian/patches/series	2014-03-13 19:43:22 +0000
@@ -3,3 +3,4 @@
 dpkg-deb-R-add.patch
 dpkg-ddeb.patch
 words_bad_array_subscript.patch
+quote_readline_by_ref_fixes.patch
_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel

Reply via email to