Michael, thank you for the thourough explanation and the workaround
>Francesco Potortì <[email protected]> writes: > >Hi Francesco, > >> The problem is that whenever I rename a local file whose name contains >> spaces to a remote scp directory, the "file name" becomes "file\\ name" >> on the remote, and tramp gives an error saying that it has not found >> "file name" on remote. Then, I need to rename "file\\ name" to >> file name" on remote to get a sane name. No problem renaming from remote to >> local. >> >> Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw3d >> scroll bars) >> of 2021-11-27, modified by Debian >> Package: tramp (2.4.3.27.1 nil/nil) > >I can reproduce the problem with Emacs 27.2 and 28.1. In Emacs 29.0.50 >(the development branch) it isn't reproducible. > >The reason is your local scp command, which belongs to the OpenSSH suite >(I guess). Since OpenSSH 8.6 (?), it uses internally the SFTP protocol, >instead of the SCP protocol. This has subtle changes for non-regular >file names. Read the scp(1) man page about the -O command line >argument. And read the OpenSSH Release Notes at ><https://www.openssh.com/releasenotes.html>. > >Tramp 2.6.0-pre (this is the version in Emacs 29) cares about. However, >it is not ready for release yet, and backporting this special -O >handling isn't trivial. > >In order to work around the problem, you might adapt the "scp" call in >Tramp. Add the "-O" command line argument in the tramp-methods "scp" >definition, parameter tramp-copy-args, like (untested) > >--8<---------------cut here---------------start------------->8--- > ("scp" > (tramp-login-program "ssh") > (tramp-login-args > (("-l" "%u") ("-p" "%p") ("%c") ("-e" "none") ("%h"))) > (tramp-async-args (("-q"))) > (tramp-remote-shell "/bin/sh") > (tramp-remote-shell-login ("-l")) > (tramp-remote-shell-args ("-c")) > (tramp-copy-program "scp") > (tramp-copy-args > (("-P" "%p") ("-p" "%k") ("-O") ("-q") ("-r") ("%c"))) > (tramp-copy-keep-date t) > (tramp-copy-recursive t)) >--8<---------------cut here---------------end--------------->8--- > >When Tramp 2.6 will be released, you might install it from GNU ELPA. It >is backwards compatible to Emacs 27. Alternatively, you can use the >recent Tramp from its git repo, of course. > >Best regards, Michael. >
