Skip to content

fix: improve OS_ID parsing for quoted values in /etc/os-release#311212

Open
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee:fix-rocky-os-id-parsing
Open

fix: improve OS_ID parsing for quoted values in /etc/os-release#311212
Jah-yee wants to merge 1 commit intomicrosoft:mainfrom
Jah-yee:fix-rocky-os-id-parsing

Conversation

@Jah-yee
Copy link
Copy Markdown

@Jah-yee Jah-yee commented Apr 19, 2026

Good day

This PR fixes #232159 - Devcontainer setup ad-hoc parsing fails on Rocky 8.5.

Problem

The script incorrectly parsed the field from when the value is quoted.

The previous regex approach:

Failed on Rocky Linux 8.5 which uses (quoted), returning an empty string.

Solution

Changed to:

This properly handles quoted values by loading the file as shell variables, which removes any surrounding quotes.

Verification

Tested locally with a mock containing :

  • The new approach correctly extracts
  • Works for both quoted () and unquoted () formats

Checklist

Thank you for your attention. If there are any issues or suggestions, please leave a comment and I will address them promptly.

When /etc/os-release contains ID="rocky" (with quotes), the old grep
method fails to match and OS_ID becomes empty. This causes the
check-requirements-linux.sh script to fail on Rocky Linux 8.5.

The proposed fix sources /etc/os-release in a subshell, which properly
handles both quoted and unquoted ID values without additional parsing.

Fixes microsoft#232159
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

2 participants