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

[bug] Respect User's default Shell when initializing the ROS environment. #1163

Open
3 tasks done
machutaSICKAG opened this issue Oct 9, 2023 · 3 comments
Open
3 tasks done
Labels
bug Something isn't working help wanted Extra attention is needed Remote ROS2 Usability

Comments

@machutaSICKAG
Copy link

machutaSICKAG commented Oct 9, 2023

(Please add appropriate labels)

  • Windows: (21H2 (Build 19044.3448)
  • Linux: (WSL2, Ubuntu 22.04)
  • ROS 2: Dist

<Version of the plugin>
0.9.2

<Copy the Version information from the Help | About menu>
Version: 1.83.0 (user setup)
Commit: e7e037083ff4455cf320e344325dacb480062c3c
Date: 2023-10-03T16:12:16.321Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19044

what is the bug

<current behavior>
Currently, whenever I launch VSCode from WSL2 within a ROS2 workspace (either from the source folder or from the main workspace folder), the notification "ROS Extension Initializing" pops up and doesn't go. The ROS version is then not recognized.

When VSCode is launched from any other location outside of the workspace, the extension initialization goes without a problem, and a correct version of ROS2 is displayed in the status bar (Humble).

expected behavior

<what you would expect to happen>
Correct initialization of the extension in the ROS2 workspace.

additional context

<any additional information would be helpful for a better understanding>
My default shell is zsh. Whichever way I modify the settings.json, the output window of the ROS extension shows this:
Sourcing Environment using: bash --login -c "source '/opt/ros/humble/setup.bash' && env"

Within every settings. json for User, Remote, and Workspace, I added the following:
"ros.rosSetupScript": "/opt/ros/humble/setup.zsh && env",
"ros.isolateEnvironment": true

Yet, setup.bash is still sourced. Seems like a bug.

@machutaSICKAG machutaSICKAG added the bug Something isn't working label Oct 9, 2023
@ooeygui
Copy link
Member

ooeygui commented Jan 8, 2024

Thanks for the report. I appreciate that you added the zsh context.

Can you try the pre-release version of the extension? (just to rule it out, I've made major modifications to the startup)

@elkuno213
Copy link

elkuno213 commented Mar 29, 2024

I think this bug hasn't been fixed yet, even using the pre-release version. I found the ROS extension always ignores the option ros.rosSetupScript and sources setup.bash by default.

Reproduction

Here is how I reproduced the problem (my workspace is /workspaces/ros2-ws):

.vscode/settings.json

{
  "ros.distro": "iron",
  "ros.rosSetupScript": "${workspaceFolder}/install/local_setup.zsh",
}

The output shows that the ROS extension tries to source 3 times for each setup.bash:

Sourcing Environment using: bash --login -c "source '/opt/ros/iron/setup.bash' && env"
Sourcing Environment using: bash --login -c "source '/workspaces/ros2-ws/install/setup.bash' && env"
Sourcing Environment using: bash --login -c "source '/opt/ros/iron/setup.bash' && env"
Sourcing Environment using: bash --login -c "source '/workspaces/ros2-ws/install/setup.bash' && env"
Sourcing Environment using: bash --login -c "source '/opt/ros/iron/setup.bash' && env"
Sourcing Environment using: bash --login -c "source '/workspaces/ros2-ws/install/setup.bash' && env"

It doesn't matter the setup file is local_setup.zsh, setup.zsh or local_setup.bash, the extension forces to source setup.bash

Remarks

I found quite difficult to debug using this extension when creating new package because the setup script is not updated. My temporary solution is to try to comment the option ros.rosSetupScript or reload VSCode window ; so that the ROS extension restarts the sourcing action.

I suggest to have a command, so called updateSetupScript to make this process easier. :) Many thanks!

@ooeygui
Copy link
Member

ooeygui commented Mar 29, 2024

Thank you for reporting. This extension does expect the default shell to be bash; it needs to be updated to respect the user's shell.

@ooeygui ooeygui added the help wanted Extra attention is needed label Mar 29, 2024
@ooeygui ooeygui changed the title [bug] unable to initialize ROS extension when in a ROS2 workspace [bug] Respect User's default Shell when initializing the ROS environment. Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed Remote ROS2 Usability
Projects
None yet
Development

No branches or pull requests

3 participants