microsoft / microsoft/winget-cli

Package Versions with Alpha Characters Are Incorrectly Given Lower Version Priority

Open
#3,073 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

For a given package ID, packages with alpha characters in the version number are being given a lower priority than those with only numeric characters. This causes older packages to incorrectly get installed as upgrades when running with the recurse option. This also causes older packages to be listed as available upgrades when running "winget upgrade" to search for possible upgrades.

Steps to reproduce

This is just one example, but can be replicated with numerous others:

Install the latest version of CrystalDewWorld.CrystalDiskMark 8.0.4c with:

winget install CrystalDewWorld.CrystalDiskMark --version 8.0.4c

Run "winget upgrade":

PS C:\Users\Test> winget upgrade
Name                   Id                              Version Available Source
-------------------------------------------------------------------------------
CrystalDiskMark 8.0.4c CrystalDewWorld.CrystalDiskMark 8.0.4c  8.0.4     winget
1 upgrades available.
Expected behavior

Packages with alpha characters in the version number should not take precedence over those with only numeric characters in the version number especially if the release date of the alphanumeric version is newer than the release date of the package with only numeric characters.

Actual behavior

For a given package ID, packages with alpha characters in the version number are being given a lower priority than those with only numeric characters. This causes older packages to incorrectly get installed as upgrades when running with the recurse option. This also causes older packages to be listed as available upgrades when running "winget upgrade" to search for possible upgrades.

Environment
Windows Package Manager v1.4.10173
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19045.2673
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.10173.0

NOTE: Happens regardless of the OS: Win 10/Win 11/WS 2022

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 by reproducing the version-priority problem with CrystalDewWorld.CrystalDiskMark 8.0.4c and the documented winget install and upgrade commands. Trace how winget compares versions containing alphabetic characters against numeric-only versions. Done means newer alphanumeric versions are not reported or installed as upgrades over older versions, including with recurse, and the behavior is covered by tests.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.