Skip to content

fix(device_info_plus): handle single-quoted values in os-release on Linux - #4012

Open
ChandraChaan wants to merge 1 commit into
fluttercommunity:mainfrom
ChandraChaan:fix/device-info-linux-single-quotes
Open

ChandraChaan wants to merge 1 commit into
fluttercommunity:mainfrom
ChandraChaan:fix/device-info-linux-single-quotes

Conversation

@ChandraChaan

Copy link
Copy Markdown

Description

The Linux implementation reads /etc/os-release and strips quotes from each value, but only double quotes. The os-release format allows values in single quotes too, and Gentoo now writes its file that way (NAME='Gentoo', ID='gentoo', ...). So on Gentoo linuxInfo.id is 'gentoo' with the quotes included, and checks like id == 'gentoo' fail.

unquote() now strips single quotes when the value starts with one, and otherwise behaves as before. Double-quoted and unquoted values are unchanged.

Added a test that uses Gentoo's actual os-release contents.

Related Issues

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (flutter analyze) does not report any problems on my PR.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

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.

[Bug]: device_info_plus on Linux keeps the single quotes from os-release (Gentoo)

1 participant