microsoft / microsoft/winget-cli

winget should not error when installing the exact version of a package that is already installed

Open
#4,262 7 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Brief description of your issue

When a package X of version Y is currently installed on the computer, attempting to install that exact package X in version Y again should not result in an error, because there is no operation that failed, it is simply a successful no-op.

The --force parameter exists to force a reinstall if the user desires.

Steps to reproduce
# I am very sorry for the german localized output and error messages, but this is just how winget behaves on my system sadly ....

Administrator in ~
❯ winget list -q GIMP.GIMP --source winget
Name           ID        Version Verfügbar
------------------------------------------
GIMP 2.10.34-2 GIMP.GIMP 2.10.34 2.10.36

Administrator in ~
❯ winget install --id 'GIMP.GIMP' --exact --version '2.10.34' --silent --source winget
Es wurde bereits ein vorhandenes Paket gefunden. Es wird versucht, das installierte Paket zu aktualisieren...
Kein verfügbares Upgrade gefunden.
In den konfigurierten Quellen sind keine neueren Paketversionen verfügbar.

Administrator in ~
❯ $LASTEXITCODE
-1978335189

Administrator in ~
❯
Expected behavior

Winget should exit with return code 0 for success (nothing to do, the desired state is equal to the current state).

Actual behavior

Winget exits with exit code -1978335189 and the message "No applicable update found" when there was no intention to perform an update of any kind.

Environment
# again, terribly sorry for the localized output,
# I know it's not helpful like this but I don't see how I can change wingets' language ...

Windows-Paket-Manager v1.7.10582
Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Windows: Windows.Desktop v10.0.19045.4046
Systemarchitektur: X64
Paket: Microsoft.DesktopAppInstaller v1.22.10582.0

WinGet-Verzeichnisse
-----------------------------------------------------------------------------------------------------------------------------------------
Protokolle                                   %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
Benutzereinstellungen                        %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Verzeichnis für portierbare Links (Benutzer) %LOCALAPPDATA%\Microsoft\WinGet\Links
Portables Linkverzeichnis (Computer)         C:\Program Files\WinGet\Links
Portierbarer Paketstamm (Benutzer)           %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portierbarer Paketstamm                      C:\Program Files\WinGet\Packages
Portierbares Paketstamm (x86)                C:\Program Files (x86)\WinGet\Packages
Installationsprogrammdownloads               %USERPROFILE%\Downloads

Links
-----------------------------------------------------------------------------------------
Datenschutzerklärung              https://aka.ms/winget-privacy
Lizenzvereinbarung                https://aka.ms/winget-license
Hinweise von Drittanbietern       https://aka.ms/winget-3rdPartyNotice
Startseite                        https://aka.ms/winget
Windows Store-Nutzungsbedingungen https://www.microsoft.com/en-us/storedocs/terms-of-sale

Administratoreinstellung                  Status
-----------------------------------------------------
LocalManifestFiles                        Deaktiviert
BypassCertificatePinningForMicrosoftStore Deaktiviert
InstallerHashOverride                     Deaktiviert
LocalArchiveMalwareScanOverride           Deaktiviert

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 install --id 'GIMP.GIMP' --exact --version '2.10.34' command with that exact version already installed, then trace the install path that reports "No applicable update found." Done means the command treats this state as a successful no-op and exits with return code 0, while preserving --force for reinstalls.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.