microsoft / microsoft/winget-cli

Version Range not taking into account Package Versions without DisplayVersion

Open
#2,503 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Matching Issue-Bug
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the winget upgrade path and the version-range construction described for package manifests; compare handling of AppsAndFeaturesEntries::DisplayVersion with PackageVersion. Reproduce the issue with multiple versions, then verify that an installed latest version matching the control-panel version is no longer reported for upgrade when it falls outside the recorded range.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.