[Top][All Lists]

[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: Sun, 09 May 2021 15:40:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Jim Porter <> writes:

Hi Jim,

>> Short update. Since I cannot find a file name quoting which satisfies
>> both pscp and MS Windows scp, I've decided to add a new user option
>> tramp-use-ms-dos-quote-argument. It's default value is nil, but users
>> can change it to non-nil. In that case, Tramp would apply the changed
>> file name quotation for scp arguments, i.e. replacing a double quote by
>> two double quotes, and putting everything into a start/stop double
>> quote.
> This sounds like the ideal solution to me. By making this opt-in,
> well-behaved programs (pscp, MSYS2 scp) should work without
> configuration, but it's still easy to get things working with Win32
> scp. Hopefully in the future, the Win32 port of scp will also behave
> correctly so it also works without configuring Tramp.

Finally, I've found out that pscp has *exactly* the same problem as
scp. It doesn't support a double-quote in the file name, for example:

--8<---------------cut here---------------start------------->8---
C:\Users\albinus>scp -T -q -r gandalf:/home/albinus/x""z .
scp: /home/albinus/xz: No such file or directory

C:\Users\albinus>pscp -scp -p -q -r gandalf:/home/albinus/x""z .
scp: /home/albinus/xz: No such file or directory
--8<---------------cut here---------------end--------------->8---

For sure, I have a file with the name /home/albinus/x"z on my remote
host. So I decided not to change anything; Tramp method scpx with MS
Windows OpenSSH isn't worse than Tramp method pscp.

(I haven't tested MSYS2 OpenSSH yet).

The following file names work w/o any problem with the Tramp test
tramp-test40-special-characters and both pscp and scpx methods:

--8<---------------cut here---------------start------------->8---
foo bar baz
--8<---------------cut here---------------end--------------->8---

(At least) the following special characters don't work for these
methods, see test function tramp--test-special-characters:

\t $ % ? * " | ! : < >

So be it.

UTF-8 tests are completely disabled in the test suite for scp and pscp
on MS Windows, I haven't checked further what to do. Likely, Tramp must
tell the start-process object (which calls scp or pscp) to use an UTF-8
codepage; I have no idea how to do this.

> Thus, I think the current Tramp behavior (disable
> `tramp-use-ssh-controlmaster-options' on MS Windows) is fine: it's
> either a no-op (for the MSYS2 ssh) or it causes a hang (for the Win32
> ssh).

Yep. I've added a phrase in the Tramp manual in order to document it.

> - Jim

Best regards, Michael.

reply via email to

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