Repository navigation
Remote process picking appears to be broken. #13791
Copy link
Copy link
Labels
bugdebuggerhelp wantedCan be fixed in the public (open source) repo.Can be fixed in the public (open source) repo.
Milestone
Description
Environment
- OS and version: Dev container: Ubuntu 24.04.1 LTS
- VS Code: 1.102.2
- C/C++ extension: 1.26.3
- OS and version of remote machine (if applicable): Application container also running Ubuntu 24.04.1 LTS
- GDB / LLDB version: GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
Bug Summary and Steps to Reproduce
Bug Summary:
remote-attach shows me the error "file name too long: unknown". See logs below.
It seems like it is quoted incorrectly and interpreting the entire string as the executable. I think it would work if the single quotes were removed from /bin/sh -c ...
Debugger Configurations
{
"name": "Remote Attach",
"type": "cppdbg",
"request": "attach",
"program": "/app/myapp",
"pipeTransport": {
"pipeProgram": "kubectl",
"pipeArgs": ["exec", "-i", "${input:pickPod}", "--"],
"debuggerPath": "/usr/bin/gdb"
}
}Debugger Logs
error: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "0288b51eedf9cbcb9fc25a591c73fa017d196be8409a7e2f91d201265106bf54": OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/sh -c \"uname && if [ $(uname -o) = \\\"Toybox\\\" ] ; then ps -A -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \\\"Linux\\\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \\\"Darwin\\\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi\"": stat /bin/sh -c "uname && if [ $(uname -o) = \"Toybox\" ] ; then ps -A -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \"Linux\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \"Darwin\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi": file name too long: unknown
Command failed: "kubectl" "exec" "-i" "myapp-cb4ddbd89-pkt2s" "--" '/bin/sh -c "uname && if [ $(uname -o) = \"Toybox\" ] ; then ps -A -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \"Linux\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \"Darwin\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi"'
error: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "0288b51eedf9cbcb9fc25a591c73fa017d196be8409a7e2f91d201265106bf54": OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/sh -c \"uname && if [ $(uname -o) = \\\"Toybox\\\" ] ; then ps -A -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \\\"Linux\\\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \\\"Darwin\\\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi\"": stat /bin/sh -c "uname && if [ $(uname -o) = \"Toybox\" ] ; then ps -A -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \"Linux\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \"Darwin\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi": file name too long: unknownOther Extensions
No response
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugdebuggerhelp wantedCan be fixed in the public (open source) repo.Can be fixed in the public (open source) repo.
Type
Projects
- StatusShow more project fieldsDone
Activity
sean-mcmanus commentedon Jul 30, 2025
Matt (@mjrist) Do you know if this is a regression starting with 1.26.3?
sean-mcmanus commentedon Jul 30, 2025
Matt (@mjrist) I don't see any recent change to this area of code: see https://github.com/microsoft/vscode-cpptools/blob/main/Extension/src/Debugger/attachToProcess.ts#L109 .
mjrist commentedon Jul 30, 2025
Doesn't seem like it. Same issue in 1.25.3. Also tried 1.21.6. Like you point out, no recent changes to that code.
If I just run the command from the terminal (bash) I get the same error.
If I remove the single quotes around the command passed to exec, it works (running in the terminal):
mjrist commentedon Jul 30, 2025
Alright, found a work around.
kubectl exec does not like the quoted string, but sh -c is fine with it. If I change my pipe args to
"pipeArgs": ["exec", "-i", "${input:pickPod}", "--", "/bin/sh", "-c"]then it is happy as the string gets passed tosh -cThis does mean that I get an extra process when debugging (not that it matters...)

Using straight kubectl exec it would just start gdb:

Also, I discovered that starting gdb with kubectl exec has the same problem with the quoted command. However using
"quoteArgs": "false"fixes this. It seems to me that if quoteArgs is false the process picker ought to also skip quoting the args. If that were the case, I could just use kubectl exec without additionally invoking sh.sean-mcmanus commentedon Aug 7, 2025
Matt (@mjrist) Your fix is in https://github.com/microsoft/vscode-cpptools/releases/tag/v1.27.0
mjrist commentedon Aug 7, 2025
Thank you!