-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCP server side does not return error info when the file does not exist on remote host #1284
Comments
@jborean93, we are solving on the escaping issue in a central place. this issue is part of the fix |
@bingbing8 thanks for the info, would you like me to close this issue and have it tracked in 1 central one? Is there a link to that issue? |
Let's leave it open so we are sure we fix and validate the scenario. if you are interested, this is the PR, it is not ready yet. |
Thanks |
@jborean93, this actually is not related with the double quotes escaping issue. the server side scp slip 'c:/temp/some folder/cafe.txt' to two parts: "'c:/temp/some" and "folder/cafe.txt'". I agree it return an some error. If you supplied -ddd to sshd.exe, you will see more information. If you update the command to, it will work. (I only test it from windows client)
|
@bingbing8 it's more these 2 issues I wanted to bring up
I've able to get this working when quoting the with double quotes, unfortunately a few linux tools use single quotes to safely escape values that come from an unknown source. I'm not sure whether this is something that would be supported by this port though. |
@jborean93, the second issue is the windows CRT rule limitation. Windows cmd does not escape single quotes. If you change the default shell to powershell, single quotes should be recognized. |
"OpenSSH for Windows" version
7.7.2.0
Server OperatingSystem
Windows Server 2016 Standard
Client OperatingSystem
MacOS
What is failing
Using scp from a host to another Windows host when the path has been escaped with
'
and not"
.Run the following command to create a file on the Windows host
One created, run the following scp command from another host
scp -o User=vagrant "[server2016.domain.local]:'/C:/temp/some folder/cafe.txt'" cafe.txt
.Expected output
At the very minimum I expect to get an error message saying that path was not found. I'm honestly not sure whether single quotes in the path as escape chars should be supported or not but I thought it best to ask anyway.
Actual output
No output on the client but the file isn't copied and scp exited with an rc of
1
. When running sshd.exe in debug I get the following outputIn the output we can see the following command running
"c:\\windows\\system32\\cmd.exe" /c ""C:\\Program Files\\OpenSSH-Win64\\scp.exe" -f '/C:/temp /some folder/cafe.txt'"
. This tells us that sshd.exe executes cmd.exe which then executes scp.exe and encloses the file in single quotes based on our input from the client as expected. Unfortunately single quotes are not interpreted in both cmd.exe andCreateProcess
as escape characters so it is looking for a file with the literal path'/C:\temp\some folder/cafe.txt'
.** Extra Notes **
Using double quotes for the path portion works just fine as expected as both cmd and
CreateProcess
use that as an escape character. The trouble I have is that I'm working with a Python application that is using shlex.quote to create a shell escaped string as the path is defined by the user input. If the value contains certain characters (like non-ascii chars) then it will automatically enclose the value with a single quote.I'm also wondering why sshd.exe calls cmd.exe which then calls scp.exe, seems like this should just call scp.exe and not have to deal with cmd altogether.
The text was updated successfully, but these errors were encountered: