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

Devcontainer setup ad-hoc parsing fails on Rocky 8.5 #232159

Open
gunnihinn opened this issue Oct 24, 2024 · 3 comments · May be fixed by #236759
Open

Devcontainer setup ad-hoc parsing fails on Rocky 8.5 #232159

gunnihinn opened this issue Oct 24, 2024 · 3 comments · May be fixed by #236759
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug good first issue Issues identified as good for first-time contributors linux Issues with VS Code on Linux remote Remote system operations issues

Comments

@gunnihinn
Copy link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.92.0 (Commit: b1c0a14)
  • OS Version: Rocky Linux 8.5

The check-requirements-linux.sh script that runs as part of a devcontainer setup wants to parse the OS version from /etc/os-release.
That file "is a newline-separated list of environment-like shell-compatible variable assignments" (see man os-relase on Linux).
The script tries to parse the value it wants here, by running:

OS_ID="$(cat /etc/os-release | grep -Eo 'ID=([^"]+)' | sed -n '1s/ID=//p')"

This looks for a key-value pair of the form ID=value and strips out the ID= part.
It assumes the pair is not of the form ID="value", which appears to be permitted by the file format, and appears in the wild in Rocky 8.5 where the relevant line reads:

ID="rocky"

In that case the grep command will fail to match the line and the value of OS_ID will be empty, resulting in a non-zero exit code of 1.

This could be fixed by changing the variable assignment to:

OS_ID=$(source /etc/os-release && echo $ID)

This will run a subshell in which the values in the file get assigned to environment variables, which removes any surrounding " marks.
Since this runs in a subshell the current shell's environment will not pick up these variables.

Steps to Reproduce:

  1. Start a devcontainer built from Rocky 8.5.
Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.94.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@gunnihinn
Copy link
Author

In the issue text I link to the problematic line in HEAD on master, so the issue remains there.

@deepak1556
Copy link
Collaborator

Thanks for the report, feel free to send a PR.

@deepak1556 deepak1556 added bug Issue identified by VS Code Team member as probable bug linux Issues with VS Code on Linux remote Remote system operations issues good first issue Issues identified as good for first-time contributors labels Oct 25, 2024
@aslezar aslezar linked a pull request Dec 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug good first issue Issues identified as good for first-time contributors linux Issues with VS Code on Linux remote Remote system operations issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants