microsoft / winget-cli-restsource

This project aims to provide a reference implementation for creating a REST based package source for the winget client.
MIT License
242 stars 62 forks source link

Package installed from private repository is being listed as being installed from public repository #227

Open Smith8154 opened 10 months ago

Smith8154 commented 10 months ago

Brief description of your issue

When installing an application from our internal WinGet repository, WinGet is listing the package as being installed from the public WinGet repository.

Steps to reproduce

Upload a package to an internal WinGet repository, where the same package exists in the public WinGet repository. Install the package from the private repository. Export the list of installed packages. It will show the package as being installed from the public repository, not the private one.

Expected behavior

I would expect WinGet to show the package as being installed from the correct repository.

Actual behavior

WinGet shows the package as being installed from the wrong repository.

Environment

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

Windows: Windows.Desktop v10.0.19045.3803
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3482.0
Smith8154 commented 10 months ago

This doesn't seem to be an issue on every machine. I just pushed the package to 35 machine and it is reporting incorrectly on about half of them.

denelon commented 10 months ago

Was this application installed on any of the devices before the push?

It's possible an entry from the installed database showed winget as the source before the private source was added.

Possible work around: If you can test, try uninstalling the app and then reinstalling from the private source.

We don't have a notion of an order of preference for a source when the package is available in more than one source yet.

Smith8154 commented 10 months ago

Yes, the application was already installed. I tried to upgrade it to a newer version.

Unfortunately, uninstalling it and reinstalling did not work. I even updated the package to have the same ID as the public repository to see if that would help, but it did not. Oddly enough, this was not an issue with the previous version.

In doing this testing, I may have found why I am having issues. I am having trouble with the internal repository after I uploaded a new version of an (unrelated) application. It looks like that may be keeping WinGet from exporting packages from the private repository. This is the error I am seeing on the other repository:

2024-01-12 01:06:16.583 [REPO] Finding available package from installed package using system reference search: Query:[none] Include:ProductCode='sapgui'[Exact] Include:NormalizedNameAndPublisher='sapguiforwindows'+'sapse'[Exact] Include:NormalizedNameAndPublisher='sapguiforwindows(x86)'+'sapse'[Exact]
2024-01-12 01:06:16.586 [REPO] Sending http GET request to: https://internal-repo-url.net/api/packageManifests/Company.SAPGUI
2024-01-12 01:06:16.690 [REPO] Response status: 200
2024-01-12 01:06:16.691 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerSharedLib\Versions.cpp(573)\WindowsPackageManager.dll!00007FF888AF6324: (caller: 00007FF888AF8E05) Exception(1) tid(727c) 80070057 The parameter is incorrect.
denelon commented 10 months ago

@Smith8154 I'm going to transfer this issue to the winget-cli-restsource repository so we can look into troubleshooting what went wrong since it seems like it may be an issue with the REST implementation then.

Smith8154 commented 10 months ago

@denelon Is there anyone who can help me look into this?

Smith8154 commented 10 months ago

Below is the YAML for the manifest. I only started having this issue after I uploaded version 8.05 to the repository.

{
    "Data": {
        "PackageIdentifier": "Company.SAPGUI",
        "Versions": [
            {
                "PackageVersion": "8.03",
                "DefaultLocale": {
                    "PackageLocale": "en-US",
                    "Publisher": "SAP SE",
                    "PackageName": "SAP GUI",
                    "License": "Proprietary",
                    "ShortDescription": "SAP GUI"
                },
                "Installers": [
                    {
                        "InstallerIdentifier": "aa2ce3e7-aedc-426d-b208-48c382a25720",
                        "InstallerSha256": "9c56f0badee3c921721fdca9a5dda780646c9190defb34956184c237384fd96e",
                        "InstallerUrl": "https://internalwingetrepo.net/abunchofstuff",
                        "Architecture": "x86",
                        "InstallerLocale": "en-US",
                        "InstallerType": "exe",
                        "Scope": "machine",
                        "InstallModes": [
                            "silent"
                        ],
                        "InstallerSwitches": {
                            "Silent": "/silent",
                            "Custom": "/package=\"CompanySAPGUI8.032bit\""
                        },
                        "InstallerSuccessCodes": [
                            129
                        ],
                        "InstallerAbortsTerminal": false,
                        "ReleaseDate": "0001-01-01T00:00:00",
                        "InstallLocationRequired": false,
                        "RequireExplicitUpgrade": false,
                        "AppsAndFeaturesEntries": [
                            {
                                "DisplayName": "SAP GUI for Windows 8.00 32bit  Patch 3",
                                "Publisher": "SAP SE",
                                "DisplayVersion": "8.00 Compilation 1",
                                "ProductCode": "SAPGUI"
                            }
                        ],
                        "DisplayInstallWarnings": false
                    }
                ]
            },
            {
                "PackageVersion": "8.05",
                "DefaultLocale": {
                    "PackageLocale": "en-US",
                    "Publisher": "SAP SE",
                    "PackageName": "SAP GUI",
                    "License": "Proprietary",
                    "ShortDescription": "SAP GUI"
                },
                "Installers": [
                    {
                        "InstallerIdentifier": "a062c1f0-6520-4d10-9c1d-5ec2f580e392",
                        "InstallerSha256": "8b9c6aeb2e33ba7424e788d10ea41c2261f9eca91b108a6d2c944be75ca86643",
                        "InstallerUrl": "https://internalwingetrepo.net/abunchofstuff",
                        "Architecture": "x86",
                        "InstallerLocale": "en-US",
                        "InstallerType": "exe",
                        "Scope": "machine",
                        "InstallModes": [
                            "silent"
                        ],
                        "InstallerSwitches": {
                            "Silent": "/silent",
                            "Custom": "/package=\"CompanySAPGUI8.00_32bit\""
                        },
                        "InstallerSuccessCodes": [
                            129
                        ],
                        "InstallerAbortsTerminal": false,
                        "ReleaseDate": "0001-01-01T00:00:00",
                        "InstallLocationRequired": false,
                        "RequireExplicitUpgrade": false,
                        "AppsAndFeaturesEntries": [
                            {
                                "DisplayName": "SAP GUI for Windows 8.00 32bit  Patch 5",
                                "Publisher": "SAP SE",
                                "DisplayVersion": "8.00 Compilation 1",
                                "ProductCode": "SAPGUI"
                            }
                        ],
                        "DisplayInstallWarnings": false
                    }
                ]
            }
        ]
    },
    "UnsupportedQueryParameters": [],
    "RequiredQueryParameters": []
}