[Bash-completion-devel] [bash-completion-Bugs][312190] __reassemble_comp_words_by_ref fix broke scp completion with bash 3

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Sat Dec 26 13:16:04 UTC 2009


Bugs item #312190, was opened at 2009-12-26 15:16 by Ville Skyttä 
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=312190&group_id=100114

Status: Open
Priority: 3
Submitted By: Ville Skyttä  (scop-guest)
Assigned to: Freddy Vulto (fvu-guest)
Summary: __reassemble_comp_words_by_ref fix broke scp completion with bash 3 
Distribution: None
Originally reported in: None
Milestone: None
Status: None
Original bug number: 


Initial Comment:
Commit b1e58b1a0e4fdd88df3d1a3feae9adea8cc4e350 ("Fix __reassemble_comp_words_by_ref()") broke scp completion when one of the args is a remote path.  This is at least with 3.2.25(1) on CentOS 5.4.

For example, "scp foo 127.0.0.1:<TAB>" ends up trying to ssh to "foo127.0.0.1" to get a remote file listing.  Another example is "scp 127.0.0.1:/foo /<TAB>" which ends up trying remote ssh "/foo/*" file completions whereas it should complete local files starting with /.  So somehow the spaces end up being lost.  The output below is with git rev 76383dd49d690569a03ba66d328e7d0fdbb7d4b1

set -x
scp foo 127.0.0.1:<TAB>
[...]
++ __reassemble_comp_words_by_ref : words cword                    
++ local exclude i j ref                                           
++ [[ -n : ]]                                                      
++ exclude=:                                                       
++ [[ -n : ]]                                                      
++ (( i=0, j=0 ))                                                  
++ (( i < 3 ))                                                     
++ [[ 0 -gt 0 ]]                                                   
++ ref='words[0]'                                                  
++ eval 'words[0]=${!ref}${COMP_WORDS[i]}'                         
+++ words[0]=scp                                                   
++ '[' 0 = 2 ']'                                                   
++ (( i++, j++ ))                                                  
++ (( i < 3 ))                                                     
++ [[ 1 -gt 0 ]]                                                   
++ [[ -n '' ]]                                                     
++ ref='words[1]'                                                  
++ eval 'words[1]=${!ref}${COMP_WORDS[i]}'                         
+++ words[1]=foo                                                   
++ '[' 1 = 2 ']'                                                   
++ (( i++, j++ ))                                                  
++ (( i < 3 ))                                                     
++ [[ 2 -gt 0 ]]                                                   
++ [[ -n : ]]                                                      
++ '[' 2 -ge 2 ']'                                                 
++ (( j-- ))                                                       
++ ref='words[1]'                                                  
++ eval 'words[1]=${!ref}${COMP_WORDS[i]}'                         
+++ words[1]=foo127.0.0.1:                                         
++ '[' 2 = 2 ']'                                                   
++ eval cword=1                                                    
+++ cword=1                                                        
++ ((  2 < 3 - 1 ))                                                
++ break 2                                                         
++ [[ -n '' ]]                                                     
++ [[ 13 -eq 0 ]]                                                  
++ [[ 18 == \1\8 ]]                                                
++ printf %s foo127.0.0.1:                                         
+ cur=foo127.0.0.1:                                                
[...]


----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=312190&group_id=100114



More information about the Bash-completion-devel mailing list