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

Need a way to avoid quoting 'debuggerPath' when using pipe transport #1318

Closed
weinand opened this issue Mar 13, 2017 · 5 comments
Closed

Need a way to avoid quoting 'debuggerPath' when using pipe transport #1318

weinand opened this issue Mar 13, 2017 · 5 comments
Assignees
Milestone

Comments

@weinand
Copy link

weinand commented Mar 13, 2017

From @tanaka-takayoshi on March 13, 2017 9:7

  • VSCode Version:
    1.11.0-insider
  • OS Version:
    RHEL 7.3

Steps to Reproduce:

  1. Generate launch.json to set up remote debug configuration.
{
  "version": "0.2.0",
  "configurations": [        
    {
        "name": ".NET Core Docker Remote Attach",
        "type": "coreclr",
        "request": "attach",
        "processId": "21",
        "pipeTransport": {
            "pipeProgram": "docler",
            "pipeArgs": [ "exec", "remotedebug-1-mispn"],
            "debuggerPath": "/opt/app-root/src/clrdbg/clrdbg",
            "pipeCwd": "${workspaceRoot}"
        },
        "sourceFileMap": {
            "/opt/app-root/src": "${workspaceRoot}"
        }
    }
  ]
}
  1. Start debug ".NET Core Docker Remote Attach"

  2. Failed to execute docker command. This is because VS Code escape the debuggerPath with parameters.

"docker" exec remotedebug-1-mispn "/opt/app-root/src/clrdbg/clrdbg --interpreter=mi"

The docker command recognizes "/opt/app-root/src/clrdbg/clrdbg --interpreter=mi" as one file path, then failed. I'm not sure which version, but the previous version (maybe 1.10.x-insider or 1.9.x-insider) VS Code didn't escape with option but not escaped like below.

"docker" exec remotedebug-1-mispn /opt/app-root/src/clrdbg/clrdbg --interpreter=mi

I submitted to StackOverflow as a question. But, I found this issue occurred with not only "oc (OpenShit CLI)" command but also "docker" command. So I decided to submit this issue as a bug.
http://stackoverflow.com/questions/42731558/how-not-to-escape-debuggerpath-of-pipetransport-in-launch-json

This issue prevents me from executing remote debug from VS Code to docker.

Copied from original issue: microsoft/vscode#22514

@weinand
Copy link
Author

weinand commented Mar 13, 2017

@tanaka-takayoshi please file .NET related issues against https://github.com/OmniSharp/omnisharp-vscode/issues

@gregg-miskelly
Copy link
Contributor

gregg-miskelly commented Mar 13, 2017

@tanaka-takayoshi this change was intentional as we had to deal with other transports that needed the other quoting behavior, and we wanted to be able to support scripts and pass though as many command line args as we needed.

That said, I can definitely see the need for this. So we will need some new syntax for dealing with pipe programs that don't want quotes. My immediate thought is to allow pipeArgs to also be a string (instead of an array of strings) so that one can fully specify any quotes (or lack of quotes) that one wants. Though if anyone has a better idea I am all ears.

To give some examples of my idea--

Docker (no quotes wanted):

    "pipeProgram": "docler",
    "pipeArgs": "exec remotedebug-1-mispn ${debuggerCommand}"

Case where a quoted debugger command is implicitly added:

    "pipeProgram": "ssh",
    "pipeArgs": "-T ExampleAccount@ExampleTargetComputer"

Equivalent to the previous example, but this time explicit

    "pipeProgram": "ssh",
    "pipeArgs": "-T ExampleAccount@ExampleTargetComputer \"${debuggerCommand}\""

@gregg-miskelly gregg-miskelly added this to the 1.9 milestone Mar 13, 2017
@gregg-miskelly gregg-miskelly changed the title Not to escape debuggerPath of pipeTransport in launch.json Need a way to avoid quoting 'debuggerPath' when using pipe transport Mar 13, 2017
@gregg-miskelly
Copy link
Contributor

gregg-miskelly commented Mar 13, 2017

@rajkumar42 had the alternate suggestion of adding a new Boolean property to disable all argument quoting. Something like: "quoteArgs":false.

@tanaka-takayoshi until we fix this, I believe you can work around the issue with --

    pipeProgram = "bash",
    pipeArgs = [ "-c", "docker exec -i remotedebug-1-mispn ${debuggerCommand}" ],

Or on Windows with:

            "pipeProgram": "C:\\windows\\system32\\cmd.exe",
            "pipeArgs": [ "/c", "docker.exe exec -i 3a8fd27f5878 ${debuggerCommand}"],

Note that in our testing, at least on Windows, we needed to also add -i (Keep STDIN open even if not attached) to the docker command line.

@tanaka-takayoshi
Copy link
Contributor

@gregg-miskelly Thanks for your workaround! It works well for me.

@gregg-miskelly
Copy link
Contributor

gregg-miskelly commented Mar 28, 2017

If anyone wants to try the fix, I have posted a new release of the C# extension that includes support for quoteArgs.

To try it -- use the use the Installing Beta Releases instructions to install v1.9.0-beta2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants