tramp-devel
[Top][All Lists]
Advanced

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

Re: Shell-quoting issue for sshx/scpx on MS Windows


From: Michael Albinus
Subject: Re: Shell-quoting issue for sshx/scpx on MS Windows
Date: Thu, 06 May 2021 17:23:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jim Porter <jporterbugs@gmail.com> writes:

Hi Jim,

> I tested out Win32-OpenSSH v8.1, and the quoting issue hasn't been
> resolved. In fact, it's somewhat worse. I found that you can escape
> the spaces like so:
>
>   scp "server:~/'foo bar.txt'" dest.txt          (1)
>
> However, newer versions of OpenSSH have strict filename checking, and
> the single-quotes run afoul of that check. You can add `-T' to disable
> that, but older versions of OpenSSH don't support that flag, so you'd
> have to check the version in use to decide whether to add `-T'.

That's an option. Meanwhile, my Windows 10 has upgraded, so I can test.

--8<---------------cut here---------------start------------->8---
C:\Users\albinus>ssh -V
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
--8<---------------cut here---------------end--------------->8---

I've pushed a patch to the repositories, checking for "scp -T", which
seems to help. At least file names with spaces could be handled properly
by the scpx method now. Other special characters in file names, like
dollar, are not handled properly, this needs further investigation.

Could you pls check how it works in your environment?

> I think it would be a lot better if you could escape the space more
> like you would on a Linux system, something like:
>
>   scp "server:~/foo\ bar.txt" dest.txt          (2)
>
> Then the escaping logic in Tramp could look something like
> `(client-escape (remote-escape filename))', where `remote-escape'
> would use backslashes to escape special characters, and
> `client-escape' would then apply the usual shell-escaping logic for
> the local system. Since (as I understand it), Tramp requires the
> server side of the SSH connection to be POSIXy, that would be
> sufficient if Win32-OpenSSH worked correctly. Hopefully that explains
> things well enough; these escaping rules are a bit complicated.
>
> I filed an issue on the Win32-OpenSSH repo to request that scp accept
> the example (2) above:
> https://github.com/PowerShell/Win32-OpenSSH/issues/1790

Let's see how it goes.

> - Jim

Best regards, Michael.



reply via email to

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