winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Version Range not taking into account Package Versions without DisplayVersion

Open Trenly opened this issue 3 years ago • 0 comments

Brief description of your issue

I was looking into #2502 to see what the root cause is. I opened a sandbox and did a clean install of AIMP.AIMP v5.03.2398.

After a clean install, running winget upgrade shows the package version as being greater than the version range recorded in the index

Name           Id             Version     Available     Source
--------------------------------------------------------------
AIMP           AIMP.AIMP      > 5.01.2358 5.03.2398     winget

This is failing to take into account that the installed version, while being greater than the version range, matches the latest available version in the index. This is because 5.01.2358 is the last version of AIMP.AIMP which needed

AppsAndFeaturesEntries: 
  - DisplayVersion:

Versions newer than 5.01.2358 do not need the key, because DisplayVersion == PackageVersion, and we have been given guidance that when the two are equal, the AppsAndFeaturesEntry for DisplayVersion should be ommited, as it causes extra mapping that causes load on the Winget services.

I believe that when the version range is created in the index, it only takes into account DisplayVersion from the AppsAndFeaturesEntries. However, when a package contains versions that do not have AppsAndFeaturesEntries::DisplayVersion in the manifests, it does not include the Package Version of those manifests in the version range

Steps to reproduce

  • Create a package, and ensure there are multiple versions (a minimum of 5 is recommended).
  • In the lower versions, but not the latest version, add AppsAndFeaturesEntries containing the DisplayVersion keys
  • Install the latest version. Be sure PackageVersion matches the DisplayVersion from control panel
  • Observe that the package will be reported for upgrade

Expected behavior

When the DisplayVersion in control panel matches the latest available, even if greater than the version range, the package will not be reported for upgrade.

I would expect that the version range would include all versions of the package, whether or not a DisplayVersion key is defined.

Actual behavior

When the latest available version is installed, the version falls outside of the version range and is reported for upgrade, causing an upgrade loop.

Environment

PS C:\Users\WDAGUtilityAccount\Desktop\winget-pkgs> winget --info
Windows Package Manager (Preview) v1.4.2161-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19041.1889
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.2161.0

-----
and
-----

PS C:\Users\WDAGUtilityAccount\Desktop\winget-pkgs> winget --info
Windows Package Manager v1.3.2091
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19041.1889
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.18.2091.0

Trenly avatar Sep 07 '22 22:09 Trenly