Control: reassign -1 bash-completion On Fri, 24 Jul 2009 20:38:23 +0200 Luk Claes <l...@debian.org> wrote: > # Automatically generated email from bts, devscripts version 2.10.25~bpo40+1 > # this seems like a bug introduced by the package split > reassign 525082 bash,bash-completion
When bash-completion is *not* installed, this bug cannot be reproduced, thus I'm removing bash from it. I have investigate what causes this problem and found out that it is due to bash_completion unsetting hostcomplete (shopt -u hostcomplete) before installing completions for finger, ssh, and others, but never restoring the original setting. This is done in the following lines: shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger (from https://github.com/scop/bash-completion/blob/78aa9236df56016ded1185f877b0ba1c656fc439/bash_completion#L1419) shopt -u hostcomplete && complete -F _sftp sftp (from https://github.com/scop/bash-completion/blob/78aa9236df56016ded1185f877b0ba1c656fc439/completions/ssh#L297) I have created a fix for it (see below), but it has unanticipated side-effects that cause a regression when trying to complete `@' as an array index: Unsufficient fix: diff --git a/bash_completion b/bash_completion index 546cc39b..b1f6a7c3 100644 --- a/bash_completion +++ b/bash_completion @@ -1426,7 +1426,9 @@ _user_at_host() compopt -o nospace fi } +shopt_reset=$( shopt -p hostcomplete ) shopt -u hostcomplete && complete -F _user_at_host talk ytalk finger +$shopt_reset # NOTE: Using this function as a helper function is deprecated. Use # `_known_hosts_real' instead. diff --git a/completions/ssh b/completions/ssh index 1335f302..2c68c676 100644 --- a/completions/ssh +++ b/completions/ssh @@ -273,7 +273,9 @@ _ssh() fi fi } && +shopt_reset=$( shopt -p hostcomplete ) shopt -u hostcomplete && complete -F _ssh ssh slogin autossh sidedoor +$shopt_reset # sftp(1) completion # @@ -329,7 +331,9 @@ _sftp() _known_hosts_real $ipvx -a -F "$configfile" -- "$cur" fi } && +shopt_reset=$( shopt -p hostcomplete ) shopt -u hostcomplete && complete -F _sftp sftp +$shopt_reset # things we want to backslash escape in scp paths _scp_path_esc='[][(){}<>",:;^&!$=?`|\\'"'"'[:space:]]' I'll ask for advice upstream.