Skip to content
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

Windows Remote-SSH install script has a character limit #4487

Open
roblourens opened this issue Feb 18, 2021 · 3 comments
Open

Windows Remote-SSH install script has a character limit #4487

roblourens opened this issue Feb 18, 2021 · 3 comments
Assignees
Labels
debt ssh Issue in vscode-remote SSH
Milestone

Comments

@roblourens
Copy link
Member

Windows has a limit on the length of command prompt commands of 8191 characters: https://docs.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation#:~:text=The%20maximum%20length%20of%20the,such%20as%20the%20PATH%20variable

The way that we run the vscode remote install script for Remote-SSH runs into this limit. The way we run the script over ssh looks essentially like this:

echo "echo hello" | ssh host powershell

Where "echo hello" is a long multiline script. The limit can be observed by changing "hello" to something longer than 8186 characters. Maybe strangely, this is the case whether the default ssh shell is cmd.exe or powershell. When remote.SSH.useLocalServer is enabled, the length limit is not a problem, although some users won't be able to use this mode with Windows for some time because of various issues.

I would like to investigate other approaches to getting the install script to the remote. A potential option - send a small script that listens on a port. Forward the port over SSH, send the script through the port, have the remote execute it. Can't accept just any script to execute, so the script on the remote would only accept a script with a particular hash. Not crazy about this however.

@roblourens roblourens added ssh Issue in vscode-remote SSH debt labels Feb 18, 2021
@roblourens roblourens added this to the February 2021 milestone Feb 18, 2021
@roblourens roblourens self-assigned this Feb 18, 2021
@roblourens
Copy link
Member Author

@bagajjal, I'm curious whether you have any creative ideas from the windows side about how to avoid this limit?

@roblourens
Copy link
Member Author

Discussing offline, @bagajjal said that this is not fixable for cmd but pointed out that there is a separate issue when trying this with powershell, giving us a 10238 character limit, and that is fixable. With that fix, it sounds like this would work even with cmd as the default ssh shell, in the case like echo "echo longscript" | ssh myhost powershell.

@ssainis-0131
Copy link

@roblourens - What is the install script that VSCode tries to run on the remote server? Do we need to really run this script over the CyberArk PSM?

I am able to connect to the remote server from within my VSCode terminal from the cmd line but I suspect that is because in that workflow - there is no install script being run over the CyberArk PSM. If there is a way to disable the install script when the VSCode "SSH Connect to Remote Host" menu is used.

(Sorry for the OT comment - I wanted to ask this in #4989 but the issue is closed for comments. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

2 participants