puremourning / vimspector

vimspector - A multi-language debugging system for Vim
http://puremourning.github.io/vimspector-web
Apache License 2.0
4.1k stars 173 forks source link

I can install many gadgets but vscode-cpptools in Windows 10. #875

Closed ubaldot closed 2 months ago

ubaldot commented 2 months ago

Description

When running :VimspectorInstall vscode-cpptools I get the following error:

Installing vscode-cpptools@1.17.5...
Checksum doesn't match for C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5\cpptools-win32.vsix, removing it
Removing existing C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5\cpptools-win32.vsix
Downloading https://github.com/Microsoft/vscode-cpptools/releases/download/v1.17.5/cpptools-win32.vsix to C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5/cpptools-win32.vsix
 - FAILED installing vscode-cpptools: IncompleteRead(15679488 bytes read, 64132851 more expected)

Other gadgets, such as debugpy, etc are correctly installed.

Is it reproducible in vim?

Reproducible in Vim

Works with clean config?

Yes

Sample project works?

No sample project for this filetype

Minimal Reproduction

List of steps to reproduce:

  1. Run vim ---clean Nu /path/to/vimspector/support/minimal_vimrc
  2. in Vim run :VimspectorInstall vscode-cpptools

Expected Behaviour

The mentioned gadget is installed.

Actual Behaviour

The mentioned gadget fails to install.

Additional information

No response

Installation Type

Plugin Manager (git clone)

Vimspector version

0b04cd0e9295c508d0ca6f54c480937619815926

Debug Info

Vimspector not connected, start a debug session first

Log file

Not applicable for Windows as per CONTRIBUTING.md.

Vim version

9.1.675

Python version

No response

Neovim diagnostics

No response

Operating System

Windows 10

Declaration

puremourning commented 2 months ago

Can you download that file manually like from your browser?

ubaldot commented 2 months ago

https://github.com/Microsoft/vscode-cpptools/releases/download/v1.17.5/cpptools-win32.vsix

Yes. I can download it manually.

EDIT: FWIW: I just noticed that the latest version is 1.21.6.

puremourning commented 2 months ago

if you put the downloaded file in the location that it's trying to download to, then run again it will work so long as your downloaded file matches the expected SHA.

The problem seems to be that your connection is flaky, or you are behind a flaky firewall.

FWIW: I just noticed that the latest version is 1.21.6.

contributions welcome. https://github.com/puremourning/vimspector/tree/master/support/gadget_upgrade

ubaldot commented 2 months ago

if you put the downloaded file in the location that it's trying to download to, then run again it will work so long as your >downloaded file matches the expected SHA.

I tried but the file is first removed and then a new download attempt begins.

EDIT: I tried to manually download the file, to compute the checksum with ./vimspector/support/gadget_upgrade/checksum.pyand update the ./vimspector/python3/vimspector/gadgets.py with the newly computed checksum and when I try to install again I get the following error:

- FAILED installing vscode-cpptools: File is not a zip file

The problem seems to be that your connection is flaky, or you are behind a flaky firewall.

It could be. Pretty much the majority of the companies are protected by firewalls and there is nothing to do for that.

contributions welcome. https://github.com/puremourning/vimspector/tree/master/support/gadget_upgrade

I wish I could, but at the moment cannot contribute if I cannot at least test locally.

puremourning commented 2 months ago

Can you please include the verbose output in both cases (:VimspectorInstall! --verbose vscode-cpptools)?

If it is removing the file, it's probably for the same reason: your download is corrupt, or does not match the expected checksum. There's really nothing I can do to fix your ability to download the file :/

the majority of the companies are protected by firewalls

Yes, but not flaky ones. If you can't download the file successfully without corruption, I can't really fix that.

ubaldot commented 2 months ago

Can you please include the verbose output in both cases (:VimspectorInstall! --verbose vscode-cpptools)?

Installing vscode-cpptools@1.17.5...
Checksum doesn't match for C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5\cpptools-win32.vsix, removing it
Removing existing C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5\cpptools-win32.vsix
Downloading https://github.com/Microsoft/vscode-cpptools/releases/download/v1.17.5/cpptools-win32.vsix to C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5/cpptools-win32.vsix
 - FAILED installing vscode-cpptools: Checksum for C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5\cpptools-win32.vsix (2c0004c3c828030df1d4c53f4e421d2e03d86b47f96fa1efe0691e88f4d56dd6) does not match expected d1e29ba0858e23ae28280f37839f6da4da0fe207a5f78940c811bb1ab27ba725
Installing CodeLLDB@v1.10.0...
Traceback (most recent call last):
  File "C:\Users\yt75534\vimfiles\plugins\vimspector\python3\vimspector\installer.py", line 537, in InstallGadget
    file_path = DownloadFileTo(
                ^^^^^^^^^^^^^^^
  File "C:\Users\yt75534\vimfiles\plugins\vimspector\python3\vimspector\installer.py", line 682, in DownloadFileTo
    raise RuntimeError(
RuntimeError: Checksum for C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5\cpptools-win32.vsix (2c0004c3c828030df1d4c53f4e421d2e03d86b47f96fa1efe0691e88f4d56dd6) does not match expected d1e29ba0858e23ae28280f37839f6da4da0fe207a5f78940c811bb1ab27ba725
Checksum matches for C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\CodeLLDB\v1.10.0\codelldb-x86_64-windows.vsix, using it
Extracting C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\CodeLLDB\v1.10.0\codelldb-x86_64-windows.vsix to C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\CodeLLDB\v1.10.0\root
Removing dir C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\CodeLLDB\v1.10.0\root
Removed file C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\CodeLLDB
Junction created for C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\CodeLLDB <<===>> C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\CodeLLDB\v1.10.0\root\extension
 - Done installing CodeLLDB
Done
The following adapters were installed successfully:
 - CodeLLDB
Failed to install adapters:
 * vscode-cpptools

If it is removing the file, it's probably for the same reason: your download is corrupt, or does not match the expected >checksum. There's really nothing I can do to fix your ability to download the file :/

as said:

EDIT: I tried to manually download the file, to compute the checksum with ./vimspector/support/gadget_upgrade/checksum.py >and update the ./vimspector/python3/vimspector/gadgets.py with the newly computed checksum and when I try to install >again I get the following error:

  • FAILED installing vscode-cpptools: File is not a zip file

Yes, but not flaky ones.

Most of them are flaky. Especially those of large companies.

If you can't download the file successfully without corruption, I can't really fix that.

I download the file manually without corruption and I update the checksum. But then it complained that the file is not a zip file, see above.

puremourning commented 2 months ago

You realise that by changing the checksum you are admitting that your download is corrupted

puremourning commented 2 months ago

Most of them are flaky. Especially those of large companies.

This is simply not true. And even if it were not something that I can possibly fix.

ubaldot commented 2 months ago

You realise that by changing the checksum you are admitting that your download is corrupted.

You must update the guide then. I even download manually another version and followed that guide and it still does not work, this time complaining that the downloaded file is not a .zip file.

If you cannot fix it is absolutely fine, no need to gas-light. VSCode works fine with that gadget, vimspectors does not. That is what matters at the end of the day.

puremourning commented 2 months ago

Sorry perhaps I misunderstood. I thought you meant you downloaded the existing version and had to change the checksum. That's what I was thinking meant corruption.

If you download the file vimspector expects, and run with verbose does it say that the checksum matches?

puremourning commented 2 months ago

Yeah right.

Checksum doesn't match for C:\Users\yt75534\vimfiles\plugins\vimspector\gadgets\windows\download\vscode-cpptools\1.17.5\cpptools-win32.vsix, removing it

Suggests bad download to me.

I wonder if your corp firewall has quarantined the download and retuning some like error page or something ?

ubaldot commented 2 months ago

I managed to install it.

I manually downloaded this file and compute the checksum.

Then, inspection of .\vimspector\python3\vimspector\gadgets.py suggested me to add the following (around line 101):

    "windows_x64": {
        "file_name": "cpptools-windows-x64.vsix",
        "checksum": "c198dab997a1c4a1db8998907329dcad0aede0046b877f9a59bd36b0595df2c5",
    },

other than updating the version to 1.26.6. But for some obscure reason VimspectorInstalltried to download the version specified at line 78:

    'windows': {
      'file_name': 'cpptools-win32.vsix',
      'checksum':
        '2c0004c3c828030df1d4c53f4e421d2e03d86b47f96fa1efe0691e88f4d56dd6',

That is very confusing as there are other keys such as "windows_arm64" and I naturally add a key "windows_x64". Yet, Vimspector try to pick what is specified in the value of the key "windows".

Hence, I changed the value of the key "windows" with the following:

    "windows": {
        "file_name": "cpptools-windows-x64.vsix",
        "checksum": "c198dab997a1c4a1db8998907329dcad0aede0046b877f9a59bd36b0595df2c5",

and run again VimspectorInstall vscode-cpptools and it went through. It is a very convoluted and unintuitive way of proceeding.

I cannot test now if it works or not.

puremourning commented 2 months ago

I'm sorry to hear that the project doesn't live up to your quality expectations. The installer is a best effort and always has been. Vimspector js after all a DAP CLIENT not a package manager.

The gadget installer is completely optional. Feel free to use the documentation to configure cpptools to be launched from any location on your computer.

But I would request to keep the passive aggressive swipes at the code to yourself as it really reduces my motivation to help.

ubaldot commented 2 months ago

I tested it right now and it works. I had to set cpptools anyway because I had to connect the gdb client to an openocd server through telnet connection for embedded applications. I also crated an additional command :VimspectorLaunch in my config - among other things. So far, so good.