microsoft / microsoft/winget-cli

`winget upgrade <given app>` should not fail if already updated

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

Nobody has claimed this yet.

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

Description

Brief description of your issue

Previously this command would not fail (i.e. exit with a non 0 code), but since latest version of WinGet it does.

And I believe that's the correct behavior. That's how apt-get upgrade also works, and simplify things by a lot during scripting.

This unfortunately breaks one of my scripts too, which winget upgrade to ensure an app was up to date:

https://github.com/felipecrs/dotfiles/blob/master/home/dot_local/bin/executable_full-upgrade.tmpl#L79

Steps to reproduce
winget install Microsoft.VisualStudioCode

winget upgrade Microsoft.VisualStudioCode

echo $?

# will output False rather than True
Expected behavior

To not fail, as it used to be.

Actual behavior

Failing where it shouldn't.

Environment
~ ❯ winget --info                                                                                                                       00:29:16
Windows Package Manager (Preview) v1.6.2291-preview
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.2191
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.2291.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

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                        Enabled
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

Start by reproducing the winget upgrade Microsoft.VisualStudioCode flow from the issue and inspect the CLI handling of an app that is already up to date. Compare its exit status with the expected successful result and the existing behavior described in the report. Done means the command no longer returns a failure code when no upgrade is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.