diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2018-11-10 17:17:36 -0200 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2018-11-10 17:40:43 -0200 |
commit | bab51728186237e4204f30860387c2f7511f291c (patch) | |
tree | 685c6397dc35a69a31a146f141590b4274020ec3 | |
parent | f933650579234d1329f3b10de232ce802bbb772b (diff) | |
download | bash-completion-bab51728186237e4204f30860387c2f7511f291c.tar.gz |
Backport upstream patch that fixes wildcard completion
Upstream commit:
commit 6ffde95c7ea257ff60cb51a263a8d33f4bb0898b
Author: dmerge <25472575+dmerge@users.noreply.github.com>
Date: Fri Apr 20 22:14:08 2018 -0700
_filedir: Refactor to remove heredoc-dependent loop
refactors the function _filedir, and, perhaps accidentally, fixes
completion when wildcards are used.
The backport doesn't completely solve the problem of wildcard (`*')
completion, because wildcards never get expanded, even when a single
match is available, nor do options get listed when TAB is pressed twice.
To get that behaviour, the following patch would be needed:
$ diff -U4 /usr/share/bash-completion/bash_completion.BACKUP /usr/share/bash-completion/bash_completion
--- /usr/share/bash-completion/bash_completion.BACKUP 2018-11-10 17:34:08.432870898 -0200
+++ /usr/share/bash-completion/bash_completion 2018-11-10 17:34:12.304421632 -0200
@@ -587,8 +587,10 @@
if [[ ${#toks[@]} -ne 0 ]]; then
# 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()
Since this extra fix could cause unpredicted, undesired side-effects,
further discussion is required.
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | debian/patches/09-backport-to-fix-wildcard-completion.patch | 53 | ||||
-rw-r--r-- | debian/patches/series | 1 |
3 files changed, 55 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index f7de9575..ec6438bf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ bash-completion (1:2.8-3) UNRELEASED; urgency=medium [Gabriel F. T. Gomes <gabriel@inconstante.eti.br>] * Revert `Extra fix for man completion' (from version 1:2.8-2). + * Fix wildcard completion. (Closes: #891667). -- Gabriel F. T. Gomes <gabriel@inconstante.eti.br> Sun, 04 Nov 2018 18:48:03 -0200 diff --git a/debian/patches/09-backport-to-fix-wildcard-completion.patch b/debian/patches/09-backport-to-fix-wildcard-completion.patch new file mode 100644 index 00000000..8c1a4e54 --- /dev/null +++ b/debian/patches/09-backport-to-fix-wildcard-completion.patch @@ -0,0 +1,53 @@ +commit 6ffde95c7ea257ff60cb51a263a8d33f4bb0898b +Author: dmerge <25472575+dmerge@users.noreply.github.com> +Date: Fri Apr 20 22:14:08 2018 -0700 + + _filedir: Refactor to remove heredoc-dependent loop + +diff --git a/bash_completion b/bash_completion +index 98d277bd..48fe5987 100644 +--- a/bash_completion ++++ b/bash_completion +@@ -553,12 +553,11 @@ _filedir() + _tilde "$cur" || return + + local -a toks +- local x tmp ++ local x reset + +- x=$( compgen -d -- "$cur" ) && +- while read -r tmp; do +- toks+=( "$tmp" ) +- done <<< "$x" ++ reset=$(shopt -po noglob); set -o noglob ++ toks=( $( compgen -d -- "$cur" ) ) ++ eval $reset + + if [[ "$1" != -d ]]; then + local quoted +@@ -567,17 +566,16 @@ _filedir() + # Munge xspec to contain uppercase version too + # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306 + local xspec=${1:+"!*.@($1|${1^^})"} +- x=$( compgen -f -X "$xspec" -- $quoted ) && +- while read -r tmp; do +- toks+=( "$tmp" ) +- done <<< "$x" ++ reset=$(shopt -po noglob); set -o noglob ++ toks+=( $( compgen -f -X "$xspec" -- $quoted ) ) ++ eval $reset + + # Try without filter if it failed to produce anything and configured to +- [[ -n ${COMP_FILEDIR_FALLBACK:-} && -n "$1" && ${#toks[@]} -lt 1 ]] && \ +- x=$( compgen -f -- $quoted ) && +- while read -r tmp; do +- toks+=( "$tmp" ) +- done <<< "$x" ++ [[ -n ${COMP_FILEDIR_FALLBACK:-} && -n "$1" && ${#toks[@]} -lt 1 ]] && { ++ reset=$(shopt -po noglob); set -o noglob ++ toks+=( $( compgen -f -- $quoted ) ) ++ eval $reset ++ } + fi + + if [[ ${#toks[@]} -ne 0 ]]; then diff --git a/debian/patches/series b/debian/patches/series index cc09e7f1..c5cebc15 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,4 +7,5 @@ 06-xpdf_support_compressed_pdf.patch 07-dpkg_support_raw-extract_vextract.patch 08-completion-for-cvs-log.patch +09-backport-to-fix-wildcard-completion.patch 99-use-install-data-hook.patch |