Skip to content

pickRemoteProcess SSH command variable local expansion bug #2585

Closed

Description

While testing an attach type debugger configuration with SSH as pipeTransport on macOS/VSCode and remote target is Ubuntu Linux I found out that the pickRemoteProcess command will pick and expand the local $(uname) value instead of the remote one so the "if" statement will execute the "Darwin" "ps" command on the remote Linux target which will fail because of unsupported Linux ps command options

Command failed: "/usr/bin/ssh" "-i" "/Users/xxxx/.ssh/xxx_id_rsa" "xxx@xxxx" "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'"
error: can not use output modifiers with user-defined output

Usage:
ps [options]

Try 'ps --help <simple|list|output|threads|misc|all>'
or 'ps --help <s|l|o|t|m|a>'
for additional help text.

For more details see ps(1).

You just need to escape any variables inside the SSH command with a backslash "\"
so it's not expanded locally

"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'"
  • OS and Version: macOS 10.14
  • VS Code Version: 1.27.2
  • C/C++ Extension Version: 0.19.0

Activity

  1. ghost changed the title [-]pickRemoteProcess SSH $(uname) local expansion bug[/-] [+]pickRemoteProcess SSH command variable local expansion bug[/+] on Oct 1, 2018
  2. added a commit that references this issue on Oct 4, 2018
    ebb9a93
  3. added a commit that references this issue on Oct 4, 2018
    102ffc1
  4. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    on Oct 4, 2018
  5. added
    investigate: reproThis issue's repro steps needs to be investigated/confirmed
    and removed
    fixedCheck the Milestone for the release in which the fix is or will be available.
    on Nov 26, 2018
  6. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    and removed
    investigate: reproThis issue's repro steps needs to be investigated/confirmed
    on Mar 1, 2019
  7. sean-mcmanus commented on Mar 2, 2019

    @sean-mcmanus
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions