vim / vim

The official Vim repository
https://www.vim.org
Vim License
36.81k stars 5.47k forks source link

Transfering using `scp` or `sftp` could be broken #11346

Open dmiraj opened 2 years ago

dmiraj commented 2 years ago

Steps to reproduce

  1. Open a local directory in a window. Then mark current directory as a target directory using mt
  2. Now remote to a machine :e scp://username@machine:port/dir/ or :e sftp://username@machine/dir/
  3. Now mark a file to be transfered to local machine. Use mf to mark file.
  4. Now transfer using mc.

Expected behaviour

The files would be copied to the locally marked target directory

Version of Vim

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 13 2022 09:35:02) Included patches: 1-3995, 4563, 4646, 4774, 4895, 4899, 4901, 4919

Environment

OS: Ubuntu Terminal: Konsole Shell: GNU bash, version 5.1.16

Logs and stack traces

Result using scp:

scp: unknown option --  
usage: scp [-346ABCOpqRrsTv] [-c cipher] [-D sftp_server_path] [-F ssh_config]
           [-i identity_file] [-J destination] [-l limit]
           [-o ssh_option] [-P port] [-S program] source ... target

shell returned 1

Result using sftp

Error detected while processing function <SNR>38_NetrwMarkFileCopy[131]..netrw#Obtain:                                                                                                                                                      
line  188:                                                                                                                                                                                                                                  
E691: Can only compare List with List                                                                                                                                                                                                       
line  193:                                                                                                                                                                                                                                  
E121: Undefined variable: localfile                                                                                                                                                                                                         
E116: Invalid arguments for function s:ShellEscape(localfile)." ".s:ShellEscape(tgtdir))                                                                                                                                                    
E116: Invalid arguments for function <SNR>38_NetrwExe                                                                                                                                                                                       
chrisbra commented 2 years ago

Hm, for the first case, it looks like your openssh client does not understand a particular argument. What version are you using? Also try :set verbose=5 and then run the scp command again, to get the complete scp command line output.

For the second, you may want to try to update netrw from here: http://www.drchip.org/astronaut/vim/index.html#NETRW this may also fix the first problem perhaps :)