-
Notifications
You must be signed in to change notification settings - Fork 781
Mysterious quotes appearing when running non interactive command #1273
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
Comments
@bingbing8 - Could you please look into this. This might be related to the issue you are currently working. |
This is because for non-pty, we added double quotes for those cmdline before pass it to cmd.exe. The cmd.exe did not preserve the quotes well:
but the double quotes are required to execute other executable.
|
@bagajjal Could you give me a link to what this issue is? Found another weird situation that might be related:
|
@bingbing8 I'll try it out |
@masaeedu, #1082 and #1211 are the issue I am working one. If you are interested, this is the PR PowerShell/openssh-portable#349. |
Thanks @bingbing8. I changed the default shell to Powershell using:
which makes both However (and perhaps this belongs in a different issue), I then tried:
which produces:
Adding explicit quotes to the third argument (
|
My current need is to be able to take the name of an executable and a verbatim string of arguments and get ssh to start the executable with the specified argument string (without any extra processing). |
@masaeedu, since the default shell is powershell, powershell use ` to escape characters.
|
@bingbing8 Is that
|
since your remote shell is powershell instead of cmd. on remote, it runs
|
I see. I need to avoid interacting with the details of shell escaping and expansion, since the executable and argument list are read from a config file and are unknown up front. I can't rely on the fact that the default shell on a system will be Powershell and that it will expand Maybe I can write a different default shell that will take an argument string, split it as |
If I run |
@masaeedu, if your remote shell is cmd, this also works: |
@masaeedu, we do further escaping for quotes to preserve the quotes |
Since the appropriate escaping is dependent on the default shell application to which the arguments are going to be passed (different rules for cmd and powershell), is there a way we can simply disable this escaping and pass the values verbatim to a custom default shell? I wrote a little .NET console application to see exactly what sshd passes as the command line arguments to the default shell.
I compiled it to a file
Then I tried running the commands I've been having trouble with over SSH:
Leaving aside the executable's own name and the I want to entirely disable any shell processing and escaping, and simply start a process verbatim using the command line string sent through ssh. Ideally I'd be able to use something like https://github.com/cubiclesoft/createprocess-windows as the default shell, so that it's as close as possible to just calling the relevant |
@masaeedu, as you see I mentioned in in #1082 Here is the currently implementation:
|
"OpenSSH for Windows" version
7.7.2.0
Server OperatingSystem
Windows Server 2012 R2 Standard
Client OperatingSystem
Arch Linux
What is failing
Expected output
Actual output
Additional info
Things work correctly if I interactively run
cmd
and then runcmd /c echo foo
. They also work correctly if I just runecho foo
instead ofcmd /c echo foo
. Here's a transcript of various things I tried:The text was updated successfully, but these errors were encountered: