microsoft / microsoft/winget-cli

Cannot upgrade/uninstall nested portables coming from an older version of WinGet

Open
#3,279 4 comments 22 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Brief description of your issue

Nested portable applications where the executable is located inside of a subdirectory in the archive suffered from issue https://github.com/microsoft/winget-cli/issues/2909 that was patched in the preview version of WinGet in PR https://github.com/microsoft/winget-cli/pull/3002. Users can benefit from the patched behavior if they upgrade to the preview version and install these apps for the first time (no prior installation). However, users coming from WinGet 1.4 who already had the package installed need to first uninstall the existing installation or upgrade to a newer version if available to get the correct value in their PATH env variable. The issue is that users are not able to perform an uninstall/upgrade of these apps and the command gets stuck indefinitely.

Steps to reproduce
  1. Install WinGet version 1.4.10173
  2. Ensure developer mode is turned off to prevent symlink creation.
  3. Install apps like Gyan.FFmpeg, BurntSushi.ripgrep.GNU, Helm.Helm from a USER shell (again to prevent symlink creation). Install an older version to test upgrade scenario (e.g. winget install Gyan.ffmpeg --version 5.1.2). If you try to uninstall the apps at this stage, the command would succeed
  4. Upgrade to the preview release WinGet v1.5.1361
  5. Try to upgrade/uninstall the apps from a user/admin shell.
Expected behavior

Uninstall/Upgrade succeeds

Actual behavior

Command gets stuck indefinitely at Starting package uninstall... / Starting package install... (in upgrade scenario)

Interesting thing to note here is that in the upgrade scenario, the values are actually overwritten in the registry, but the archive isn't extracted properly inside the Packages directory. Here I was upgrading Gyan.FFmpeg from 5.1.2 to 6.0
image

Workaround

The workaround I found to remove these packages to unblock upgrade/uninstall scenario is:

  • Either downgrade to WinGet 1.4 and then uninstall the package
  • Or perform a manual uninstall which would mean:
    • Delete directory from %LOCALAPPDATA%\Microsoft\WinGet\Packages
    • Manually remove the value from PATH variable
    • Delete the relevant registry key from HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\
Logs

Logs generated after having to manually Ctrl-C the indefinitely stuck commands

WinGet-2023-05-27-17-03-08.610.log (stuck in upgrade command)
WinGet-2023-05-27-17-09-28.883.log (stuck in uninstall command)

Environment
Windows Package Manager (Preview) v1.5.1361-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.1702
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.20.1361.0

Winget Directories
-----------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages

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
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled

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

Reproduce the issue with WinGet 1.4.10173 and preview v1.5.1361 using the listed nested portable packages, then inspect the attached logs around “Starting package uninstall...” and “Starting package install...”. Trace the uninstall and upgrade entry points that handle %LOCALAPPDATA%\Microsoft\WinGet\Packages, PATH, and the per-user uninstall registry key. Done means affected packages can be upgraded and uninstalled without hanging or leaving incorrect package contents.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.