Skip to content

Fix Rocky Linux devcontainer OS_ID parsing in check-requirements-linux.sh#319026

Open
saitejabandaru-in wants to merge 2 commits into
microsoft:mainfrom
saitejabandaru-in:feature-fix-devcontainer-parsing
Open

Fix Rocky Linux devcontainer OS_ID parsing in check-requirements-linux.sh#319026
saitejabandaru-in wants to merge 2 commits into
microsoft:mainfrom
saitejabandaru-in:feature-fix-devcontainer-parsing

Conversation

@saitejabandaru-in
Copy link
Copy Markdown

Description

This PR resolves a known bug (issue #232159) where the remote devcontainer requirement checking script check-requirements-linux.sh fails on Linux distributions that use quotes in the /etc/os-release ID field (e.g. Rocky Linux 8.5 where ID="rocky").

Root Cause

The existing regex ID=([^\"]+) fails to match when ID= is immediately followed by a double quote, resulting in an empty OS_ID value.

Solution

Instead of utilizing complex and error-prone regex/sed parsing, this PR leverages standard shell-native sourcing:

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

Sourcing /etc/os-release in a POSIX-compliant subshell is extremely robust, fully supported across all Linux shells (bash, zsh, sh, ash, dash), and automatically strips surrounding quotes cleanly, regardless of whether they are present or not.

…x.sh

Corrects parsing of quoted ID values in /etc/os-release by sourcing it in a POSIX-compliant subshell rather than using custom regex.
Copilot AI review requested due to automatic review settings May 29, 2026 17:21
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.

3 participants