[Bash-completion-devel] [PATCH] Check _rl_enabled expand-tilde before calling _expand
wonder.mice
wonder.mice at gmail.com
Sun Aug 26 10:18:09 UTC 2012
This patch is invalid, please ignore it. Sorry.
On 08/23/2012 01:25 AM, wonder.mice wrote:
> This patch will check
>
> _rl_enabled expand-tilde
>
> before calling _expand.
>
> This will fix issues like that:
> #489720 [m|Uâ~¹|=?] [bash-completion] bash-completion: Please do not
> expand leading tildes
> #521406 [m|Uâ~¹|=?] [bash-completion] bash-completion: leading tilde
> always expanded
> please do not expand leading tildes
> https://bugs.launchpad.net/bash-completion/+bug/324505
>
> Also this patch will not break scp and others, like described here:
> http://lists.alioth.debian.org/pipermail/bash-completion-devel/2009-February/000973.html
>
> The same change (replace "_expand || return 0" with "_rl_enabled
> expand-tilde && (_expand || return 0)") also must be done in following
> files in /etc/bash_completion.d:
>
> bash$ grep -rn " _expand" /etc/bash_completion.d/
> /etc/bash_completion.d/info:11: _expand || return 0
> /etc/bash_completion.d/lrzip:49: _expand || return 0
> /etc/bash_completion.d/povray:12: _expand || return 0
> /etc/bash_completion.d/man:21: _expand || return 0
> /etc/bash_completion.d/xz:53: _expand || return 0
> /etc/bash_completion.d/lzop:54: _expand || return 0
> /etc/bash_completion.d/rsync:12: _expand || return 0
> /etc/bash_completion.d/sshfs:11: _expand || return 0
> /etc/bash_completion.d/bzip2:37: _expand || return 0
> /etc/bash_completion.d/ssh:347: _expand || return 0
> /etc/bash_completion.d/lzma:32: _expand || return 0
> /etc/bash_completion.d/dd:25: _expand || return 0
> /etc/bash_completion.d/gcc:19: _expand || return 0
> /etc/bash_completion.d/findutils:70: _expand || return 0
> /etc/bash_completion.d/dpkg:29: _expand || return 0
> /etc/bash_completion.d/gzip:41: _expand || return 0
>
> If general idea is OK, I will provide full patch.
>
> --- /etc/bash_completion.original 2012-08-14 23:08:38.189654426 +0400
> +++ /etc/bash_completion 2012-08-23 01:12:13.313643700 +0400
> @@ -1596,7 +1596,7 @@
> COMPREPLY=()
> _get_comp_words_by_ref cur
>
> - _expand || return 0
> + _rl_enabled expand-tilde && (_expand || return 0)
>
> # get first exclusion compspec that matches this command
> xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print
> \$0; exit }" \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20120826/a64c0ebb/attachment.html>
More information about the Bash-completion-devel
mailing list