Skip to content

{command:pickRemoteProcess} doesn't work if remote user's default shell is CShell #4015

@Helloimbob

Description

@Helloimbob

Type: Debugger
Input information below

Please review existing issues and our documentation at https://github.com/Microsoft/vscode-cpptools/tree/master/Documentation prior to filing an issue.

Describe the bug

  • OS and Version: Linux (RHEL 7.6)
  • VS Code Version: 1.36.1
  • C/C++ Extension Version: 0.24.1
  • Other extensions you installed (and if the issue persists after disabling them): It does
  • The Illegal Variable Name error is displayed when trying to pick a remote process on a host which has CShell as the default shell. This seems to stem from the fact that bash is the assumed shell and $(uname) isn't valid in cshell. (the equivalent would be `uname`)

Unfortunately it's not possible to change the default shell on the remote host to bash, since other processes rely on the default shell being CShell.

To Reproduce
Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:

  1. Configure launch.json to connect to a remote host with csh as default shell
  2. Attempt to connect
  3. Error appears:
    Command failed: "/usr/bin/ssh" "-i" "~/.ssh/private_key" "user@remote-host" 'sh -c "uname && if [ $(uname) = "Linux" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = "Darwin" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi"'
    Illegal variable name.

My launch.json (with some stuff genericised):

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "debug process remote_server",
            "type": "cppdbg",
            "request": "attach",
            "program": "${workspaceRoot}/debug64/bin/process",
            "processId": "${command:pickRemoteProcess}",
            "MIMode": "gdb",
            "pipeTransport": {
                "pipeCwd": "/usr/bin",
                "pipeProgram": "/usr/bin/ssh",
                "pipeArgs": ["-i", "~/.ssh/private_key", "user@remote_server"],
                "debuggerPath": "/usr/bin/gdb"
            },
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

Additional context
If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json
Add any other context about the problem here including log or error messages in your Debug Console or Output windows.

Metadata

Metadata

Assignees

Labels

debuggerfixedCheck the Milestone for the release in which the fix is or will be available.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions