Skip to content

Fix quoted ID parsing in check-requirements-linux.sh#312466

Open
XQZZZ13 wants to merge 2 commits intomicrosoft:mainfrom
XQZZZ13:fix/232159-os-release-quoted-id
Open

Fix quoted ID parsing in check-requirements-linux.sh#312466
XQZZZ13 wants to merge 2 commits intomicrosoft:mainfrom
XQZZZ13:fix/232159-os-release-quoted-id

Conversation

@XQZZZ13
Copy link
Copy Markdown

@XQZZZ13 XQZZZ13 commented Apr 25, 2026

Source /etc/os-release instead of extracting ID via grep+sed. The previous regex ID=([^"]+) fails on distributions where the ID value is double-quoted (e.g. ID="rocky" on Rocky Linux 8.5, RHEL, CentOS, openSUSE), because the [^"] character class cannot match any character after ID=.

Sourcing the file is the intended use per os-release(5) and correctly handles both quoted and unquoted values. The subshell created by the surrounding $(...) prevents the sourced variables from leaking into the script's environment.

Fixes #232159

Source /etc/os-release instead of extracting ID via grep+sed. The
previous regex `ID=([^"]+)` fails on distributions where the ID value
is double-quoted (e.g. `ID="rocky"` on Rocky Linux 8.5, RHEL, CentOS,
openSUSE), because the `[^"]` character class cannot match any
character after `ID=`.

Sourcing the file is the intended use per os-release(5) and correctly
handles both quoted and unquoted values. The subshell created by the
surrounding `$(...)` prevents the sourced variables from leaking into
the script's environment.

Fixes microsoft#232159
Copilot AI review requested due to automatic review settings April 25, 2026 00:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Devcontainer setup ad-hoc parsing fails on Rocky 8.5

3 participants