Merge lp:~jjo/bash-completion/quote_readline_by_ref_fixes into lp:ubuntu/trusty/bash-completion

Proposed by JuanJo Ciarlante
Status: Merged
Merge reported by: Luke Yelavich
Merged at revision: not available
Proposed branch: lp:~jjo/bash-completion/quote_readline_by_ref_fixes
Merge into: lp:ubuntu/trusty/bash-completion
Diff against target: 80 lines (+42/-1)
4 files modified
.pc/applied-patches (+1/-0)
bash_completion (+11/-1)
debian/patches/quote_readline_by_ref_fixes.patch (+29/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~jjo/bash-completion/quote_readline_by_ref_fixes
Reviewer Review Type Date Requested Status
Luke Yelavich (community) Needs Fixing
Review via email: mp+210930@code.launchpad.net

Commit message

[jjo, r=] 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)

To post a comment you must log in.
Revision history for this message
Luke Yelavich (themuso) wrote :

You forgot to include your patch file in your commit. I see quote_readline_by_ref_fixes.patch in debian/patches/series, but cannot find the file in the tree.

Please add the file.

Thanks for your work.

review: Needs Fixing
47. By JuanJo Ciarlante

actually add debian/patches/quote_readline_by_ref_fixes.patch

Revision history for this message
JuanJo Ciarlante (jjo) wrote :

> You forgot to include your patch file in your commit. I see
> quote_readline_by_ref_fixes.patch in debian/patches/series, but cannot find
> the file in the tree.
>
> Please add the file.
>
> Thanks for your work.

dOH! - added, thanks for the prompt review.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2014-03-09 17:38:14 +0000
+++ .pc/applied-patches 2014-03-13 23:26:44 +0000
@@ -3,3 +3,4 @@
3dpkg-deb-R-add.patch3dpkg-deb-R-add.patch
4dpkg-ddeb.patch4dpkg-ddeb.patch
5words_bad_array_subscript.patch5words_bad_array_subscript.patch
6quote_readline_by_ref_fixes.patch
67
=== modified file 'bash_completion'
--- bash_completion 2014-03-09 17:38:14 +0000
+++ bash_completion 2014-03-13 23:26:44 +0000
@@ -536,13 +536,23 @@
536# @param $2 Name of variable to return result to536# @param $2 Name of variable to return result to
537_quote_readline_by_ref()537_quote_readline_by_ref()
538{538{
539 if [[ $1 == \'* ]]; then539 if [ -z "$1" ]; then
540 # avoid quoting if empty
541 printf -v $2 %s "$1"
542 elif [[ $1 == \'* ]]; then
540 # Leave out first character543 # Leave out first character
541 printf -v $2 %s "${1:1}"544 printf -v $2 %s "${1:1}"
545 elif [[ $1 == ~* ]]; then
546 # avoid escaping first ~
547 printf -v $2 ~%q "${1:1}"
542 else548 else
543 printf -v $2 %q "$1"549 printf -v $2 %q "$1"
544 fi550 fi
545551
552 # Replace double escaping ( \\ ) by single ( \ )
553 # This happens always when argument is already escaped at cmdline,
554 # and passed to this function as e.g.: file\ with\ spaces
555 [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"
546 # If result becomes quoted like this: $'string', re-evaluate in order to556 # If result becomes quoted like this: $'string', re-evaluate in order to
547 # drop the additional quoting. See also: http://www.mail-archive.com/557 # drop the additional quoting. See also: http://www.mail-archive.com/
548 # bash-completion-devel@lists.alioth.debian.org/msg01942.html558 # bash-completion-devel@lists.alioth.debian.org/msg01942.html
549559
=== 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 23:26:44 +0000
@@ -0,0 +1,29 @@
1Index: bash-completion/bash_completion
2===================================================================
3--- bash-completion.orig/bash_completion 2014-03-13 19:40:27.329251000 -0300
4+++ bash-completion/bash_completion 2014-03-13 19:41:29.363721903 -0300
5@@ -536,13 +536,23 @@
6 # @param $2 Name of variable to return result to
7 _quote_readline_by_ref()
8 {
9- if [[ $1 == \'* ]]; then
10+ if [ -z "$1" ]; then
11+ # avoid quoting if empty
12+ printf -v $2 %s "$1"
13+ elif [[ $1 == \'* ]]; then
14 # Leave out first character
15 printf -v $2 %s "${1:1}"
16+ elif [[ $1 == ~* ]]; then
17+ # avoid escaping first ~
18+ printf -v $2 ~%q "${1:1}"
19 else
20 printf -v $2 %q "$1"
21 fi
22
23+ # Replace double escaping ( \\ ) by single ( \ )
24+ # This happens always when argument is already escaped at cmdline,
25+ # and passed to this function as e.g.: file\ with\ spaces
26+ [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}"
27 # If result becomes quoted like this: $'string', re-evaluate in order to
28 # drop the additional quoting. See also: http://www.mail-archive.com/
29 # bash-completion-devel@lists.alioth.debian.org/msg01942.html
030
=== modified file 'debian/patches/series'
--- debian/patches/series 2014-03-09 17:38:14 +0000
+++ debian/patches/series 2014-03-13 23:26:44 +0000
@@ -3,3 +3,4 @@
3dpkg-deb-R-add.patch3dpkg-deb-R-add.patch
4dpkg-ddeb.patch4dpkg-ddeb.patch
5words_bad_array_subscript.patch5words_bad_array_subscript.patch
6quote_readline_by_ref_fixes.patch

Subscribers

People subscribed via source and target branches