microsoft / winget-pkgs

The Microsoft community Windows Package Manager manifest repository
MIT License
8.33k stars 4.26k forks source link

[Package Issue]: MSYS2.MSYS2 #127282

Open HunterZ opened 7 months ago

HunterZ commented 7 months ago

Please confirm these before moving forward

Category of the issue

Installation issue.

Brief description of your issue

Upgrade from 20230718 to 20231026 fails silently with exit code 1.

Is MSYS2 not meant to be upgraded in this way, since it has an internal pacman-based updater?

Steps to reproduce

Install 20230718. Attempt to upgrade to 20231026.

Actual behavior

Upgrade fails with exit code 1 and no additional info.

Expected behavior

Successful update, or not listed as an available update if this is not a supported means of updating an existing MSYS2 installation.

Environment

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

Windows: Windows.Desktop v10.0.22621.2715
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3133.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                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled

Screenshots and Logs

InstallationLog.txt says:

TargetDirectoryInUse : Error : The directory you selected already exists and contains an installation. Choose a different target for installation.

SpecterShell commented 7 months ago

Is MSYS2 not meant to be upgraded in this way, since it has an internal pacman-based updater?

Right

I tried to prevent it from being updated by WinGet by setting RequireExplicitUpgrade: true in the manifest but sometimes it doesn't work. You can try winget pin add MSYS2.MSYS2 to pin the package.

tillig commented 7 months ago

Just ran into this myself. Is exit code 1 unique to the "the directory already exists and contains an installation" error? I wonder if the fileInUse expected error code tied to exit code 1 might provide something slightly more user friendly. It currently just fails and doesn't provide a pointer to the install log or anything.

 pwsh> winget upgrade --all
Name  Id          Version  Available Source
-------------------------------------------
MSYS2 MSYS2.MSYS2 20230526 20231026  winget
1 upgrades available.

Installing dependencies:
(1/1) Found MSYS2 [MSYS2.MSYS2] Version 20231026
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Installer failed with exit code: 1

 pwsh> 
SpecterShell commented 7 months ago

Just ran into this myself. Is exit code 1 unique to the "the directory already exists and contains an installation" error? I wonder if the fileInUse expected error code tied to exit code 1 might provide something slightly more user friendly. It currently just fails and doesn't provide a pointer to the install log or anything.

 pwsh> winget upgrade --all
Name  Id          Version  Available Source
-------------------------------------------
MSYS2 MSYS2.MSYS2 20230526 20231026  winget
1 upgrades available.

Installing dependencies:
(1/1) Found MSYS2 [MSYS2.MSYS2] Version 20231026
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Installer failed with exit code: 1

 pwsh> 

No. The exit code 1 indicates a general installation failure instead of a specific one, according to the manual of Qt Installer Framework, the installer technology used by MSYS2 installer.

There is no switch to force the Qt Installer Framework installer to log into a specific file so WinGet doesn't know where the installer log to, and currently WinGet doesn't support capture the console output from the installer.

bfcns commented 5 months ago

I think MSYS2 does not need upgrades as an installer. You can upgrade it via pacman -Suy inside its shell.

So does it mean we don't need this as a winget application?

bfcns commented 5 months ago

This confirms winget is unnecessary for this package: https://github.com/msys2/setup-msys2/issues/359

SpecterShell commented 5 months ago

I think MSYS2 does not need upgrades as an installer. You can upgrade it via pacman -Suy inside its shell.

So does it mean we don't need this as a winget application?

You can still do first-time install, or even install another copy of MSYS2 in a different directory if needed. 🤔

bfcns commented 5 months ago

You can still do first-time install, or even install another copy of MSYS2 in a different directory if needed. 🤔

Then you have a nagging winget upgrade notifier in your hand, which doesn't work.

SpecterShell commented 5 months ago

You can still do first-time install, or even install another copy of MSYS2 in a different directory if needed. 🤔

Then you have a nagging winget upgrade notifier in your hand, which doesn't work.

Not THEN. WinGet will always notify you as long as it detects a copy of MSYS2 from the registry.

I am thinking about modifying the package so it can still install new copies but never detect and update them. Currently I am using RequireExplicitUpgrade: true but it appears to be working only when it was installed through WinGet, and WinGet will still try to update them if it is installed by downloading and running the installer manually.

(AFAIK the counterpart on Chocolatey upgrades by invoking pacman directly, which can not be implemented here at the moment)

bfcns commented 5 months ago

You can also install/extract MSYS2 from tar file.

SpecterShell commented 5 months ago

You can also install/extract MSYS2 from tar file.

Currently WinGet doesn't support extracting tar file (as it doesn't rely on 7z for extracting archives). See https://github.com/microsoft/winget-cli/issues/2899

The counterpart on Scoop installs in this way though but I don't know how they tackle the upgrading issue as it persists only the home directory.

mdanish-kh commented 5 months ago

I am thinking about modifying the package so it can still install new copies but never detect and update them. Currently I am using RequireExplicitUpgrade: true but it appears to be working only when it was installed through WinGet, and WinGet will still try to update them if it is installed by downloading and running the installer manually.

When we have the 1.6.0 schema out, maybe UpgradeBehavior: deny can help with this one... :eyes:

Aalivexy commented 5 months ago

any update?