tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tramp (2.4.3.27.1 nil/nil); error renaming to remote a file with spa


From: Michael Albinus
Subject: Re: tramp (2.4.3.27.1 nil/nil); error renaming to remote a file with spaces in name
Date: Sun, 17 Jul 2022 16:55:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Francesco Potortì <pot@gnu.org> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]