Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installed Package shows with 2 different ID's #5097

Open
alex-ds13 opened this issue Dec 24, 2024 · 1 comment
Open

Installed Package shows with 2 different ID's #5097

alex-ds13 opened this issue Dec 24, 2024 · 1 comment
Labels
Command-List Issue related to WinGet List Issue-Bug It either shouldn't be doing this or needs an investigation.

Comments

@alex-ds13
Copy link

alex-ds13 commented Dec 24, 2024

Brief description of your issue

This issue was noticed when installing package LGUG2Z.whkd. If we search for this package with command winget search --id lgug2z.whkd it shows the correct package. After installing the package it installs correctly and the app works fine, however there is something weird with the package ID.

Depending on the command used to list packages it shows a different ID, it shows an ID of another package from the same developer. If we then try to install that other package it fails saying it is already installed.

If after installing I run command winget list --id lgug2z.whkd it shows this (which is correct):

❯ winget list --id lgug2z.whkd
Name ID          Version Origin
-------------------------------
whkd LGUG2Z.whkd 0.2.2  winget

If instead I run the command winget list -q lgug2z or winget list --id lgug2z it shows this (which is not correct):

❯ winget list -q lgug2z
Name ID           Version Origin
--------------------------------
whkd LGUG2Z.masir 0.2.2  winget

There is another package from the same developer called masir which has the ID LGUG2Z.masir and somehow winget thinks that the whkd package has both IDs. So if we now try to install the masir package it won't be possible because it says that it is already installed (even though I've never installed it):

❯ winget install --id lgug2z.masir
Found an existing package already installed. Trying to upgrade the installed package...
No available upgrade found.
No newer package versions are available from the configured sources.

The packages' manifests seem to be fine, each one has a different ID and a different ProductCode, there was an issue on masir version 0.1.0 which had the same UpgradeCode as whkd had. Thinking that this could be the cause of the issue, a new version of masir (0.1.1) was released with a different UpgradeCode but the issue persists. Also from briefly looking at the code it doesn't seem that winget checks this upgrade code when it is searching for a single package so that shouldn't be an issue, it appears to check the ProductCode, ID, Name and Moniker which are all different between these two packages...

What else could be causing this confusion of IDs?

Steps to reproduce

winget install --id lgug2z.whkd
winget list --id lgug2z.whkd (shows correct ID)
winget list -q lgug2z (shows wrong ID)
winget install --id lgug2z.masir (fails because it thinks it is already installed)

Expected behavior

The ID should always be the one from the package manifest which in this case is LGUG2z.whkd. Winget shouldn't be changing or confusing this ID after install.

Actual behavior

Winget shows different IDs depending on the command used. So some part of code that searches for a package is matching the wrong package and returning the wrong ID.

Environment

Windows Package Manager v1.9.25200
Windows: Windows.Desktop v10.0.22631.4460
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.24.25200.0
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Dec 24, 2024
@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. Command-List Issue related to WinGet List and removed Needs-Triage Issue need to be triaged labels Dec 24, 2024
@alex-ds13
Copy link
Author

@denelon This doesn't seem to me to be specifically related to the Command-List. Since when trying to install the other package that it is confusing it with, using the command winget install --id LGUG2z.masir it is also saying that the package is already installed...

It seems to me that there might be something going wrong internally either with the way the installed packages are created or with how it is trying to get an installed package...

Maybe something over here

void GetInstalledPackageVersion(Execution::Context& context)
{
std::shared_ptr<IPackage> installed = context.Get<Execution::Data::Package>()->GetInstalled();

Since it is these workflows that recognize that other package as being installed (when in fact it isn't... it is just confusing it with another installed package...)

I couldn't quite understand where does that GetInstalled() comes from... But there must be some issue there which returns a package as being installed when in fact it isn't...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-List Issue related to WinGet List Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

2 participants