You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Microsoft/OSInfo: version operators and codename don’t work on rolling-release distributions like Arch Linux #1777
Make sure you are able to repro it on the latest version
Search the existing issues.
Summary
Microsoft/OSInfo doesn't work correctly on ArchLinux since /etc/os-release is rolling and there is no versions or codenames.
Steps to reproduce
On Arch Linux (/etc/os-release has ID=arch, BUILD_ID=rolling, no VERSION_ID or VERSION_CODENAME), with DSC 3.3.0:
dsc resource get -r Microsoft/OSInfo
{"actualState":{"family":"Linux","version":"Rolling Release","bitness":64,"architecture":"x86_64"}}
Version operators:osinfo.tests.ps1 builds its "valid version constraints" cases from the current version, so on Arch it tests = Rolling Release, >= Rolling Release and so on. parse_version_constraint only recognises an operator if a digit follows it, so these are treated as literal strings and never match:
echo '{"version":">= Rolling Release"}' | dsc resource test -r Microsoft/OSInfo -f -
... "inDesiredState":false,"differingProperties":["version"]
The > and < cases only pass by accident, because the literal string doesn't match either.
Codename: Arch has no codename, so codename is missing from the actual state.
The test should be in desired state when codename matches actual sends {"codename": null}, which fails schema validation (null is not of type "string") with exit code 2.
should not be in desired state when codename does not match sends {"codename":"nonexistentcodename"}. perform_test skips properties the OS doesn't report, so the result contradicts itself:
- The version tests skip operator cases when the version isn't numeric, or the resource handles non-numeric versions. An `=` operator could at least match literally.- The codename tests are skipped when the OS has no codename.- A desired `codename` (or other property) that the OS doesn't have is not in the desired state, consistent with `differingProperties`.
Actual behavior
5 failures in `resources/osinfo/tests/osinfo.tests.ps1` on Arch Linux: 3 version constraints and both codename tests.
Error details
Environment data
DSC 3.3.0 (release/v3.3, ea572fa), built from source on Arch Linux x86_64
Name Value
---------
PSVersion 7.6.9
PSEdition Core
GitCommitId 7.6.9
OS Arch Linux
Platform Unix
PSCompatibleVersions {1.0,2.0,3.0,4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Activity