Skip to content

Improve /etc/os-release value unquoting (fixes #47)

This merge request has two goals:

  • Fix #47 (closed) by also looking for single quotes (') when unquoting /etc/os-release values.
  • Fix another issue I found during testing where values that weren't fully enclosed in quotes were getting partially unquoted.

Here are my results from testing. "Line" is a value in /etc/os-release. "Before" is how it displays in the current version. "After" is how it displays in my proposed version.

Line Before After
PRETTY_NAME=Testing Testing Testing
PRETTY_NAME='Testing 'Testing 'Testing
PRETTY_NAME="Testing Testing "Testing
PRETTY_NAME=Testing' Testing' Testing'
PRETTY_NAME=Testing" Testing Testing"
PRETTY_NAME='Testing' 'Testing' Testing
PRETTY_NAME="Testing' Testing' "Testing'
PRETTY_NAME='Testing" 'Testing 'Testing"
PRETTY_NAME="Testing" Testing Testing

If the "only unquote if both quotes are present" part of this change is unwanted, I can remove it and leave the part that fixes #47 (closed).

Merge request reports