-
Notifications
You must be signed in to change notification settings - Fork 218
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
MIEngine can't start after setting PATH #979
Comments
@Smit-tay On my machine, |
Just a quesiton: Why does the path have to be hard-coded ? NOTE: This needs to be done before envFile sets up the environment for the debugger Also, it seems (to me anyway) that the generated MI command script include the hard-coded path to sh on the shebang line. ex:
This is not really the correct way to write a shebang line either But, if it must be hard-coded, at least use:
which works almost always |
@Smit-tay The problem is that the command we build there is passed to VS Code. It sounds like the bug isn't with the Can you clarify if not setting
We can make it more customizable in the future, but that would take more effort than I can do right now. |
@WardenGnaw to investigate providing an option for the shell path. |
This is not restricted to envFile using environment will cause the same problem - if PATH is modified to eliminate the path to sh e.g. "environment" : [{"name":"PATH","value":"NOT_THE_PATH_/usr/bin/sh"}], Now, this might seem like a stupid thing to do, but, actually, it's not that uncommon. |
Changing this should not affect it, as those values are used to set the environment for the debuggee, and not the debugger. These calls to The key/value pairs you add in the I think what you are running into is a modified path on your machine that you used to launch VS Code itself. To worka round it, we can make the change to |
Nevermind, I think you are right and theres actually a bug where we are passing the environment variables also to the RunInTerminalCommand which we shouldn't be. MIEngine/src/OpenDebugAD7/AD7DebugSession.cs Line 565 in 2a2d619
|
So, how do I get this - I am only running Linux - according to the readme this can only be built under Windows |
You would need to wait for an update to the extension. @WardenGnaw Can you update this thread with when an update will happen? |
Yep. We have a pending |
This should be fixed now with 0.27.0-insiders5: https://github.com/microsoft/vscode-cpptools/releases/tag/0.27.0-insiders5 |
Well, I am still experiencing a problem. I am running the insiders version: Attempting to use envFile Contents of "${workspaceFolder}/build/environment_run_linux.env" Launch the debugger with this setting also: WIthin the DebugConsole window: Execute debugger commands using "-exec ", for example "-exec info registers" will list registers in use (when GDB is the debugger) No indication of LD_LIBRARY_PATH being passed to gdb. |
If I set LD_LIBRARY_PATH via Then it is propogated to gdb correclty. |
Looking at MIDebugEngine/Engine.Impl/DebuggedProcess.cs#L856 It's pretty clear this is abug "of ommission" - in that the environment is only being taken from the "environment" setting, and not also from "envFile" It's important when this is fixed that those two settings are both processed. IOW, I may choose to use both envFile and environment to create a complete list of environment variables required for my debugee. In that case it's not entirely clear which should have precendence. I think the default should be to stomp envFIle with environment. IOW if envFile sets PATH=/a/path:/b/path, then environment sets PATH=/c/path, the end result is PATH=/c/path. Normally this is is handled gracefuly with syntax like: PATH="${PATH}:/c/path" In which case "environment" would be amending "envFIle" and the result would be PATH=/a/path:/b/path:/c/path |
@WardenGnaw Please investigate this issue as a VSCode extension issue. |
The Relevant code is in Extension/src/Debugger/ParsedEnvironmentFile.ts. |
Closing. Continuing investigation via C/C++ extension issue |
After loading an environment file via envFile (or presumably, also via setting PATH via "environment")
I have experienced this:
sh /tmp/Microsoft-MIEngine-Cmd-41jdiyf6.lf4
env: ‘sh’: No such file or directory
Which prevents the launcher from running the debugger (or doing anything useful)
The problem is that the environment file is intentionally removing normal PATH elements like /usr/bin/, etc... to ensure that the environment that is being executed is pristine.
MIEngine/src/MICore/Transports/RunInTerminalTransport.cs
line 157
cmdArgs.Add("sh");
This I guess must be also a launcher setting
"cmdInterpreter.shellPath" maybe ?
The text was updated successfully, but these errors were encountered: