Skip to content

Upgrade flags --all and --unninstall-previous naively includes own running shell #5316

@marcosdly

Description

@marcosdly

Brief description of your issue

Running winget upgrade with flags --all and --uninstall-previous will include running shell's package, leaving it's own and any other instances to run out of RAM or crash. If shell can run out of RAM, programs like neovim which rely heavily on i/o feedback become unpredictable and unusable. winget upgrade is interrupted without notice.

Steps to reproduce

Using pwsh.exe.

Shell session 1

pwsh.exe  # shell that can run from RAM
nvim      # any i/o heavy program

Shell session 2

pwsh.exe  # open installed, out-of-date shell
winget upgrade  # assert at least 2 packages and Microsoft.Powershell is not last
winget upgrade --all --uninstall-previous # will remove own shell amid runtime

Then

  • Try interacting with shell session 1.
  • Try opening another pwsh.exe instance.
  • (lastly) Try interacting with shell session 2.

Expected behavior

Error, unskipable warning prompt, or unsafe flag to prevent or force explicit action.

Actual behavior

  • Uninstalls shell it is running in without question.
  • Process terminates/halts without notice.
  • Shell may crash or become unusable.
  • Scrambled/bad data at other sessions of same uninstalled shell.
  • No warnings are issued.
  • Package's executable is not compared with own shell's executable.

Environment

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

Windows: Windows.Desktop v10.0.19045.5608
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.25.340.0

Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
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
Installer Downloads                %USERPROFILE%\Downloads
Configuration Modules              %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules

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
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-FeatureThis is a feature request for the Windows Package Manager client.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions