Skip to content

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

Open

Description

@ChandraChaan

Platform: Linux · Plugin: device_info_plus · Version: 13.3.0 (also current main)

Steps to reproduce

  1. Run an app on Gentoo (or any distro whose /etc/os-release uses single quotes). Gentoo's file now looks like this:
    NAME='Gentoo'
    ID='gentoo'
    PRETTY_NAME='Gentoo Linux'
    VERSION='2.18'
    VERSION_ID='2.18'
    
  2. Call DeviceInfoPlugin().linuxInfo.

Expected: id == 'gentoo', name == 'Gentoo', prettyName == 'Gentoo Linux'.

Actual: the quotes are kept: id == "'gentoo'", name == "'Gentoo'", prettyName == "'Gentoo Linux'", so a check like info.id == 'gentoo' is false.

Cause: _Unquote.unquote() in device_info_plus_linux.dart strips only double quotes. os-release(5) allows values in double or single quotes, and Gentoo switched to single quotes this year (Ansible and Facter both had to patch their parsers for it).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions