Skip to content

Make release delimiter matching case-insensitive in lsb_release#7

Open
yueyuankun wants to merge 1 commit intoLinuxStandardBase:masterfrom
yueyuankun:master
Open

Make release delimiter matching case-insensitive in lsb_release#7
yueyuankun wants to merge 1 commit intoLinuxStandardBase:masterfrom
yueyuankun:master

Conversation

@yueyuankun
Copy link
Copy Markdown

@yueyuankun yueyuankun commented Mar 30, 2026

The lsb_release script currently only matches lowercase release when parsing distribution description strings from /etc/*-release files. This causes it to fail on distributions that use Release with a capital R, resulting in n/a for Distributor ID, Release, and Codename fields.

For example, with a release file containing:
"Linux Advanced Server Release Hello (Hi)"

Before this fix:
Distributor ID: n/a
Release: n/a
Codename: n/a

After this fix:
Distributor ID: LinuxAdvancedServer
Release: Hello
Codename: Hi

This change adds the I (case-insensitive) flag to all sed commands that match DESCSTR_DELI, making the script more robust and compatible with both "release" and "Release" formats used by different distributions.

The modification maintains backward compatibility with existing distributions that use lowercase "release"
while also supporting those that use capitalized "Release".

Changes:

  • 6 sed commands updated with 'I' flag for case-insensitive matching
  • No functional changes for existing lowercase "release" formats
  • Improved compatibility with diverse distribution naming conventions

The lsb_release script currently only matches lowercase release when
parsing distribution description strings from /etc/*-release files.
This causes it to fail on distributions that use Release with a
capital R, resulting in n/a for Distributor ID, Release, and
Codename fields.

For example, with a release file containing:
  "Linux Advanced Server Release Hello (Hi)"

Before this fix:
  Distributor ID: n/a
  Release:        n/a
  Codename:       n/a

After this fix:
  Distributor ID: LinuxAdvancedServer
  Release:        Hello
  Codename:       Hi

This change adds the I (case-insensitive) flag to all sed commands
that match DESCSTR_DELI, making the script more robust and compatible
with both "release" and "Release" formats used by different distributions.

The modification maintains backward compatibility with existing
distributions that use lowercase "release"
while also supporting those that use capitalized "Release".
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.

1 participant