Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest fields for custom uninstall arguments and return codes #1885

Open
jedieaston opened this issue Jan 31, 2022 · 6 comments
Open

Manifest fields for custom uninstall arguments and return codes #1885

jedieaston opened this issue Jan 31, 2022 · 6 comments
Labels
Area-Manifest This may require a change to the manifest Command-Uninstall Issue related to WinGet Uninstall Issue-Feature This is a feature request for the Windows Package Manager client.
Milestone

Comments

@jedieaston
Copy link
Contributor

jedieaston commented Jan 31, 2022

Description of the new feature / enhancement

We currently have a bunch of manifest fields for installing packages:

InstallerSwitches:
    Custom: /allthethings
    Silent:  /VERYSILENT
    SilentWithProgress: /somewhatsilent
InstallerSuccessCodes:
    - 12
    - 57
    - 99

But we don't have any for uninstalling packages. Many packages return funny error codes that still mean success after an uninstall, or require special arguments to make uninstall 100% silent. Currently, there isn't a way to tell winget to use these.

(I believe this will help with the Edge WebView2 issues, as it requires user interaction to uninstall and then it exits with a non-zero code, which halts the upgrade leaving the user with no WebView2).

Proposed technical implementation details

Some matching manifest keys that work similarly to the existing installer fields, per installer (I realize that it may be difficult to make a best guess at InstallerType if winget didn't install the package to begin with, but that will need to be implemented anyway at some point). Ideally, these switches should be ran on the local uninstall executable, presuming it still exists.

If a manifest isn't available for an app that a user wants to uninstall, then the current behavior should be preserved.

UninstallerSwitches:
    Custom: /uninstallallthethings
    Silent:  /VERYSILENT
    SilentWithProgress: /somewhatsilent
UninstallerSuccessCodes:
    - 12
    - 57
    - 99
@jedieaston jedieaston added the Issue-Feature This is a feature request for the Windows Package Manager client. label Jan 31, 2022
@ghost ghost added the Needs-Triage Issue need to be triaged label Jan 31, 2022
@denelon denelon added Area-Schema and removed Needs-Triage Issue need to be triaged labels Jan 31, 2022
@denelon denelon added Area-Manifest This may require a change to the manifest and removed Area-Schema labels Feb 3, 2022
@denelon denelon added this to the v1.3-Client milestone Feb 22, 2022
@denelon denelon modified the milestones: v1.3-Client, v1.4-Client Apr 14, 2022
@denelon denelon modified the milestones: v1.4-Client, v1.5-Client, v.Next-Client Aug 11, 2022
@koitsu
Copy link

koitsu commented May 14, 2023

Another one to add to the list as an example of where uninstaller exit codes are important: winget uninstall mirc. This one is amusing in itself, as it uses the NSIS (Nullsoft installer). The following occurs:

  • Uninstaller is run
    • Note that the uninstaller binary, uninstall.exe, is located in the same directory as the mIRC software itself, i.e. C:\Program Files\mIRC
    • Also note that the uninstaller is not run silently (i.e. is interactive), despite the installer being run silently
  • The uninstaller GUI reports that "not all files could be removed"
    • This is ironic, since the only file it could not remove is uninstall.exe located within that directory
    • If your reaction is "that's a bug in NSIS", then keep reading
  • After the uninstaller finishes the application uninstallation phase, it deletes itself and the underlying directory (i.e. C:\Program Files\mIRC)
  • The uninstaller exits with an exit code of 1223
  • WinGet complains about exit code 1223

It should be crystal clear to folks at Microsoft that not all uninstallers and software are created equal, and thus things like UninstallerSwitches and UninstallerSuccessCodes are important.

Refer to the Chocolatey project for proof of this, where the package maintainer can wrangle both install and uninstall scenarios using PowerShell. (Yes I know WinGet does not permit this, I'm just simply noting the importance of being able to handle both installer and uninstaller scenarios, and quite often install vs. uninstall vary.)

@solomoncyj
Copy link

Vencord is another one. to uninstall it you need to pass -uninstall to the installer

@sredna
Copy link
Contributor

sredna commented Jul 10, 2023

  • Also note that the uninstaller is not run silently (i.e. is interactive), despite the installer being run silently

I don't think how the installer was executed is relevant to how the uninstaller is executed.

Winget already knows that NSIS uses /S as the silent switch. If /S does not make it silent then you would have to take that up with the mIRC people, they are either overriding the silent switch in their un.onInit or forgot to make their Message boxes silent. That being said, I'm not sure if Winget will apply the /S to the uninstaller automatically. Ideally, mIRC should write a QuietUninstallString entry for Winget to use.

  • This is ironic, since the only file it could not remove is uninstall.exe located within that directory

NSIS uninstallers by default will copy and run themselves outside the installation directory because a running executable cannot delete itself. The installer author would have to code things differently on purpose to make it work differently.

The uninstaller exits with an exit code of 1223

The NSIS exit codes are 0 for success, 1 for user cancel and 2 for cancelled by script action. If a installer/uninstaller returns something else then the installer author made a deliberate choice to do so.

1223 is Windows error code ERROR_CANCELLED.

@koitsu
Copy link

koitsu commented Jul 10, 2023

The uninstaller exits with an exit code of 1223

The NSIS exit codes are 0 for success, 1 for user cancel and 2 for cancelled by script action. If a installer/uninstaller returns something else then the installer author made a deliberate choice to do so.

1223 is Windows error code ERROR_CANCELLED.

Please explain the following, all of which are NSIS-based. It is safe to say that all these software authors (all of whom are independent from one another) did not "make a deliberate choice to do so".

@sredna
Copy link
Contributor

sredna commented Jul 10, 2023

all of which are NSIS-based

Incorrect!

Please explain the following

  • Audacity: This is using Inno, not NSIS. All Inno standard exit codes are < 10. Their documentation also says "any non-zero exit code indicates that the uninstaller was not run to completion". (This also applies to the installer)
  • AutoHotKey: Not NSIS, some kind of custom thing?
  • Avidemux: NSIS. Uses a deprecated 3rd-party plug-in. Looks like it might return 1223 if the UAC elevation dialog is cancelled.
  • Everything: NSIS. Closed source but does not seem like it would return 1223.
  • Mendeley: Uses the same 3rd-party plug-in as above but I can't tell if it can return 1223 without the source.
  • Peazip: This is using Inno, not NSIS.
  • qbittorrent: NSIS. Uses a deprecated 3rd-party plug-in. Looks like it might return 1223 if the UAC elevation dialog is cancelled.
  • Tribler: NSIS. Uses some 3rd-party plug-ins, don't know if these can return 1223.
  • VLC: NSIS. Nothing pops out at me as something that would return 1223.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Manifest This may require a change to the manifest Command-Uninstall Issue related to WinGet Uninstall Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
Status: To Do
Development

No branches or pull requests

5 participants