microsoft / winget-pkgs

The Microsoft community Windows Package Manager manifest repository
MIT License
8.69k stars 4.52k forks source link

[Package Issue]: Bitwarden.CLI #171477

Open johnburnett opened 2 months ago

johnburnett commented 2 months ago

Please confirm these before moving forward

Category of the issue

Installation issue.

Brief description of your issue

The Bitwarden CLI installer is causing a "Failed to extract the contents of the archive" error across a wide range of package versions, so I'm not sure if the package hasn't worked for a while, or if winget went off the rails (v1.8.1911), or if there's something wrong with my system. The steps below are using a pinned version of 2024.8.1 just for reproducibility, but it happens on other versions I've checked as well.

Steps to reproduce

$ winget install -q Bitwarden.CLI -v 2024.8.1
Found Bitwarden CLI [Bitwarden.CLI] Version 2024.8.1
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://github.com/bitwarden/clients/releases/download/cli-v2024.8.1/bw-windows-2024.8.1.zip
  ██████████████████████████████  28.3 MB / 28.3 MB
Successfully verified installer hash
Extracting archive...
Failed to extract the contents of the archive

Actual behavior

"Failed to extract the contents of the archive", and the log says:

2024-09-03 12:27:08.250 [CORE] DeliveryOptimization downloading from url: https://github.com/bitwarden/clients/releases/download/cli-v2024.8.1/bw-windows-2024.8.1.zip
2024-09-03 12:27:12.688 [CORE] Download completed.
2024-09-03 12:27:12.902 [CORE] Started applying motw to $user\AppData\Local\Temp\WinGet\Bitwarden.CLI.2024.8.1\7dc84e91255cc0213f41c54a3bf183e67c80417310b59212d86e44d24056e62d with zone: 3
2024-09-03 12:27:12.903 [CORE] Finished applying motw
2024-09-03 12:27:12.904 [CLI ] Installer hash verified
2024-09-03 12:27:12.904 [CORE] Started applying motw to $user\AppData\Local\Temp\WinGet\Bitwarden.CLI.2024.8.1\7dc84e91255cc0213f41c54a3bf183e67c80417310b59212d86e44d24056e62d with zone: 2
2024-09-03 12:27:12.906 [CORE] Finished applying motw
2024-09-03 12:27:12.906 [CLI ] Successfully renamed downloaded installer. Path: $user\AppData\Local\Temp\WinGet\Bitwarden.CLI.2024.8.1\bw-windows-2024.8.1.zip
2024-09-03 12:27:13.021 [CLI ] Extracting archive to: $user\AppData\Local\Temp\WinGet\Bitwarden.CLI.2024.8.1\extracted
2024-09-03 12:27:13.049 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerCommonCore\Archive.cpp(30)\WindowsPackageManager.dll!00007FFDE61A4397: (caller: 00007FFDE60FA17C) ReturnHr(1) tid(615c) 80004005 Unspecified error

2024-09-03 12:27:13.049 [CLI ] Failed to extract archive with code -2147467259
2024-09-03 12:27:13.050 [CLI ] Terminating context: 0x8a15005c at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\ArchiveFlow.cpp:4a

I can open the archive bw-windows-2024.8.1.zip in the above temp dir and extract it manually by hand just fine using 7-zip, so I'm not sure what the issue is.

Expected behavior

A successfully installed package

Environment

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

Windows: Windows.Desktop v10.0.22631.4112
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.23.1911.0

Screenshots and Logs

No response

Utesgui commented 2 months ago

Hi @johnburnett Works on my machine (which does not have to mean anything) image image

Is anybody else facing this issue?

Edit: double-check on another system with other winget version: image

Dragon1573 commented 2 months ago

Verified in Windows 11 amd64 Sandbox instance.

image

a-mnich commented 2 months ago

Successfully verified on a Windows 11 Sandbox Instance: image

stephengillie commented 2 months ago

Hi @johnburnett,

Does this happen with other packages? Would it be possible to try uninstalling the package manager and reinstalling - possibly through the MS Store?

johnburnett commented 2 months ago

I dug into this a bit more this morning, and in the end it's user error, but explaining for search results. In src\AppInstallerCommonCore\Archive.cpp, line 30:

wil::com_ptr<IShellFolder> pArchiveShellFolder;
HRESULT res = SHBindToObject(NULL, pidlFull.get(), NULL, IID_PPV_ARGS(&pArchiveShellFolder));

SHBindToObject was returning E_FAIL. I forget how to dig into COM failures to get more details about the error. However, not being able to create a shell object for a zip archive triggered a memory: I've previously followed the instructions at https://www.sevenforums.com/tutorials/13619-zip-folders-enable-disable-windows-explorer-view.html to disable Explorer's insistence of treating zip files as folders (personal annoyance of mine). The wisdom of following the advice in the link above is certainly debatable. My memory is that the linked .reg files basically do something like:

Remove-Item -Force -Recurse -Path 'Registry::HKEY_CLASSES_ROOT\CompressedFolder\CLSID'
Remove-Item -Force -Recurse -Path 'Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\.zip\CLSID'
Remove-Item -Force -Recurse -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ArchiveFolder'

That all said, I'm willing to bet if I somehow re-registered the above classes, it would fix the issue. I'm not sure how to do that though, and am not super motivated to do so, so I might be out of luck for using winget now. Relying on the shell's archive handler feels a bit wonky (?), but I'm sure there's reasons to do so.

demoergo commented 1 week ago

This fixed the issue for me. If it helps anyone here are the .reg files I used for enabling/disabling zip folders.


Disable_ZIP_Compressed_Folders.reg:

Windows Registry Editor Version 5.00 ; Created by: Shawn Brink ; http://www.sevenforums.com ; Tutorial: http://www.sevenforums.com/tutorials/13619-zip-folders-enable-disable-windows-explorer-view.html [-HKEY_CLASSES_ROOT\CompressedFolder\CLSID] [-HKEY_CLASSES_ROOT\SystemFileAssociations.zip\CLSID]


Enable_ZIP_Compressed_Folders.reg:

Windows Registry Editor Version 5.00 ; Created by: Shawn Brink ; http://www.sevenforums.com ; Tutorial: http://www.sevenforums.com/tutorials/13619-zip-folders-enable-disable-windows-explorer-view.html [HKEY_CLASSES_ROOT\CompressedFolder\CLSID] @="{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}" [HKEY_CLASSES_ROOT\SystemFileAssociations.zip\CLSID] @="{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}"