microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23k stars 1.43k forks source link

Packages with the same ID and name in multiple repos break "winget show" and "winget install" #840

Open jedieaston opened 3 years ago

jedieaston commented 3 years ago

Brief description of your issue

Packages with the same ID and name in multiple repos break winget show and winget install

Steps to reproduce

  1. Add more than one repo to winget somehow (for example, the msstore repo that you can add via experimental).
  2. run winget show --exact --id Microsoft.WindowsTerminal
  3. Become confused when even though you passed --exact --id, there are still two results.

Expected behavior

WinGet should put the different repos in the returned table, and say "This package exists in multiple repos, specify which you want to show/install from with --source ".

Alternatively, it should just pick whichever one has the highest version (or the user's specified version if they pass -v), which is what other package managers do when faced with this problem (this probably makes a bit more sense in the long run, given that one of the major reasons people add additional repositories is to get access to newer versions of software that aren't ready for public consumption, like canary versions of browsers).

Actual behavior

WinGet tells me it found multiple results, but doesn't tell me why (since there are no repos in the table), making it extremely difficult to figure out why I can't install Windows Terminal.


PS C:\Users\Easton Pillay\projects\winget-pkgs> winget install Microsoft.WindowsTerminal
Multiple packages found matching input criteria. Please refine the input.
Name             Id
------------------------------------------
Windows Terminal Microsoft.WindowsTerminal
Windows Terminal Microsoft.WindowsTerminal
PS C:\Users\Easton Pillay\projects\winget-pkgs> winget install --exact --id Microsoft.WindowsTerminal
Multiple packages found matching input criteria. Please refine the input.
Name             Id
------------------------------------------
Windows Terminal Microsoft.WindowsTerminal
Windows Terminal Microsoft.WindowsTerminal
PS C:\Users\Easton Pillay\projects\winget-pkgs> # Uh-oh!

Environment

PS C:\Users\Easton Pillay\projects\winget-pkgs> winget --info
Windows Package Manager v0.2.10771 Preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19042.867
Package: Microsoft.DesktopAppInstaller v1.11.10771.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

Links
--------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
PS C:\Users\Easton Pillay\projects\winget-pkgs>
denelon commented 3 years ago

Great catch @jedieaston. We've been thinking about adding preferences to the settings that would allow a user to specify which source should be used when there are multiple matches. I like the idea of comparing which has the latest version. One of the challenges is the store source doesn't currently expose the version.

denelon commented 3 years ago

@deadundead, this happens when there are two identical package identifiers in two different sources.

You will need to specify the source to disambiguate.

winget install Microsoft.WindowsTerminal -e -s winget would use the "default" source.

It looks like we need to clarify the messaging, and display the sources in this case.

spragginsdesigns commented 2 years ago

@deadundead, this happens when there are two identical package identifiers in two different sources.

You will need to specify the source to disambiguate.

winget install Microsoft.WindowsTerminal -e -s winget would use the "default" source.

It looks like we need to clarify the messaging, and display the sources in this case.

This is literally happening to me right now. Look at this screenshot: image

tardis4500 commented 2 years ago

I don't think this is just a documentation issue. Consider the following:

PS C:\Users\gmhum> winget upgrade -e --id Microsoft.VC++2013Redist-x64 -s winget
Multiple installed packages found matching input criteria. Please refine the input.
Name                                                         Id
---------------------------------------------------------------------------------------------------
Microsoft Visual C++ 2013 Redistributable (x64)              Microsoft.VC++2013Redist-x64
Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501 {050d4fc8-5d48-4b8f-8972-47c82c46020f}
Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.40664 {9dff3540-fc85-4ed5-ac84-9e3c7fd8bece}
Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.30501 {f65db027-aff3-4070-886a-0d87064aabb1}
remontees commented 2 years ago

I don't think this is just a documentation issue. Consider the following:

PS C:\Users\gmhum> winget upgrade -e --id Microsoft.VC++2013Redist-x64 -s winget
Multiple installed packages found matching input criteria. Please refine the input.
Name                                                         Id
---------------------------------------------------------------------------------------------------
Microsoft Visual C++ 2013 Redistributable (x64)              Microsoft.VC++2013Redist-x64
Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501 {050d4fc8-5d48-4b8f-8972-47c82c46020f}
Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.40664 {9dff3540-fc85-4ed5-ac84-9e3c7fd8bece}
Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.30501 {f65db027-aff3-4070-886a-0d87064aabb1}

I experienced the same issue installing Oracle.JDK.17

Trenly commented 1 year ago

[Policy] Area-Matching