jdhitsolutions / WingetTools

A set of PowerShell tools for working with the winget package manager.
MIT License
157 stars 16 forks source link

[Bug]: False positive due to version numbers #20

Closed zbalkan closed 1 year ago

zbalkan commented 1 year ago

Describe the problem

Comparing versions of software using semver schema is always hard. Here we came across a false positive. It is not a big issue other than an inconvenience and the effort might not worth it.

Prequisite

Have Wireshark installed.

Steps

  1. Run Get-WGUpgrade | Out-GridView -OutputMode Multiple | Invoke-WGUpgrade
  2. You will see the result below:

image

  1. Check the source of Get-WinGetUpgrade.ps1, and find the line which enumerates and checks updates
  2. Try the code separately.
    # $list = Get-WGInstalled | Where-Object {$_.Update -And ($_.InstalledVersion)}
    # $list.OnlineVersion
    4.0.2.0
    # $list.InstalledVersion
    4.0.2
  3. See that the code cannot handle semver version numbers.

Expectation

Should return no updates.

Additional Information

winget version: v1.3.2691 WingetTools version: 1.7.0

PowerShell version

7.2

Platform

Windows 10 Pro or Enterprise

Additional Checks

jdhitsolutions commented 1 year ago

I've seen this as well. Another limitation of trying to parse text from Winget's output. This is especially difficult when you get a version number like 1.2.0.1165.gabf054ab.

jdhitsolutions commented 1 year ago

Parsing strings consistently is a non-starter. The microsoft.winget.client module from Microsoft will eventually replace this module.