williamboman / nvim-lsp-installer

Further development has moved to https://github.com/williamboman/mason.nvim!
https://github.com/williamboman/mason.nvim
Apache License 2.0
2k stars 123 forks source link

LspInstall clangd fails: Failed to promote the temporary installation directory #434

Open schrc3b6 opened 2 years ago

schrc3b6 commented 2 years ago

Problem description

I can't install clangd on a Debian 9 (stretch) mashine, that doesn't has clangd preinstalled.

Neovim version (>= 0.6)

NVIM v0.6.1 Build type: Release LuaJIT 2.1.0-beta3 Compiled by runner@fv-az87-780

Features: +acl +iconv +tui

Operating system/version

Linux zuse 4.9.0-17-amd64 #1 SMP Debian 4.9.290-1 (2021-12-12) x86_64 GNU/Linux

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

Affected language servers

clangd

Actual behavior

Failed to promote the temporary installation directory "/home/USER/.local/share/nvim/lsp_servers/clangd.tmp"

The LspInstall can't rename the tmp directory to the target(/home/USER/.local/share/nvim/lsp_servers/clangd) , because the target already exists. It creates the empty target directory a few code lines earlier in server.lua

    if platform.is_unix then
        -- Some Unix systems will raise an error when renaming a directory to a destination that does not already exist.
        fs.mkdir(self.root_dir)
    end

I don't know any Linux dirstributions on which mv succeeds if the target already exists. But maybe I'm overlooking something.

Expected behavior

Installation of clangd runs successfully by commenting out line 165 of server.lua.

LspInstallInfo output

...
          inflating: ./clangd_13.0.0/lib/clang/13.0.0/include/xtestintrin.h  
        Deleting "/home/USER/.local/share/nvim/lsp_servers/clangd.tmp/archive.zip"
        Failed to promote the temporary installation directory "/home/USER/.local/share/nvim/lsp_servers/clangd.tmp".

Installation log

[INFO  Tue 18 Jan 2022 01:21:40 PM CET] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:664: Starting install server_name="clangd", requested_version=""
[ERROR Tue 18 Jan 2022 01:21:40 PM CET] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:153: Failed to spawn process. cmd="gh", err="ENOENT: no such file or directory"
[ERROR Tue 18 Jan 2022 01:21:46 PM CET] ...art/nvim-lsp-installer/lua/nvim-lsp-installer/server.lua:170: Failed to rename. path="/home/USER/.local/share/nvim/lsp_servers/clangd.tmp" new_path="/home/USER/.local/share/nvim/lsp_servers/clangd" error="...r/start/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:36: EEXIST: file already exists: /home/USER/.local/share/nvim/lsp_servers/clangd.tmp -> /home/USER/.local/share/nvim/lsp_servers/clangd"
[INFO  Tue 18 Jan 2022 01:21:46 PM CET] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:683: Installation completed server_name="clangd", success=false

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Go**: not available
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - ERROR: **npm**: not available
  - ERROR: **node**: not available
  - OK: **sh**: `Ok`
  - OK: **bash**: `GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)`
  - OK: **tar**: `tar (GNU tar) 1.29`
  - OK: **gzip**: `gzip 1.6`
  - OK: **curl**: `curl 7.52.1 (x86_64-pc-linux-gnu) libcurl/7.52.1 OpenSSL/1.0.2u zlib/1.2.8 libidn2/0.16 libpsl/0.17.0 (+libidn2/0.16) libssh2/1.7.0 nghttp2/1.18.1 librtmp/2.3`
  - OK: **wget**: `GNU Wget 1.18 built on linux-gnu.`
  - OK: **python3**: `Python 3.5.3`
  - OK: **Ruby**: `ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]`
  - WARNING: **pip3**: not available
  - OK: **java**: `Ok`
  - OK: **RubyGem**: `2.5.2.1`
  - OK: **javac**: `Ok`

Screenshots

No response

williamboman commented 2 years ago

Hello @schrc3b6! I've been trying to get on a system where this is reproducible. We recently had similar issues with exactly this (see #412). I'll try to find the exact motivation I had behind creating the directory before renaming. The comment suggests -- Some Unix systems will raise an error when renaming a directory to a destination that does not already exist., but I can't remember in more details what "some Unix systems" is referring to haha.

alvinlee001 commented 2 years ago
  Pending servers (1) 
    ◍ jdtls (failed)
        Downloading file "https://download.eclipse.org/jdtls/snapshots/jdt-language-server-1.9.0-202202210521.tar.gz"...
        2022-02-22 15:34:28 URL:https://download.eclipse.org/jdtls/snapshots/jdt-language-server-1.9.0-202202210521.tar.gz [46563312/46563312] -> "archive.tar.gz" [1]
        plugins/
        features/
        config_mac/
        config_win/
        config_linux/
        config_ss_mac/
        config_ss_win/
        config_ss_linux/
        plugins/org.eclipse.xtext.xbase.lib_2.25.0.v20210301-0821.jar
        plugins/org.eclipse.core.net.linux_1.0.100.v20220111-1854.jar
        plugins/org.eclipse.core.runtime_3.24.100.v20220211-2001.jar
        plugins/org.eclipse.text_3.12.0.v20210512-1644.jar
        plugins/org.eclipse.equinox.frameworkadmin.equinox_1.2.100.v20210703-1540.jar
        plugins/org.hamcrest.core_1.3.0.v20180420-1519.jar
        plugins/org.eclipse.jdt.compiler.apt_1.4.50.v20210914-1429.jar
        plugins/org.apache.ant_1.10.12.v20211102-1452.jar
        plugins/org.eclipse.core.expressions_3.8.100.v20210910-0640.jar
        plugins/org.eclipse.jdt.core_3.29.0.v20220214-1307.jar
        plugins/javax.inject_1.0.0.v20091030.jar
        plugins/org.jboss.tools.maven.apt.core_1.5.4.202201260914.jar
        plugins/org.eclipse.equinox.registry_3.11.100.v20211021-1418.jar
        plugins/org.eclipse.ltk.core.refactoring_3.12.100.v20210926-1112.jar
        plugins/org.eclipse.m2e.logback.configuration_1.16.3.20211002-1029.jar
        plugins/com.google.guava_30.1.0.v20210127-2300.jar
        plugins/org.eclipse.equinox.common_3.16.0.v20220211-2322.jar
        plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.18.1.20211008-0657.jar
        plugins/org.eclipse.core.resources_3.16.100.v20220214-1012.jar
        plugins/org.eclipse.jdt.ls.core_1.9.0.202202210521.jar
        plugins/org.eclipse.equinox.security.linux_1.0.200.v20210616-0726.jar
        plugins/org.eclipse.jdt.debug_3.19.100.v20220212-1425.jar
        plugins/org.eclipse.m2e.archetype.common_1.18.1.20211011-2139.jar
        plugins/org.gradle.toolingapi_7.1.1.v20211108-1823-s.jar
        plugins/org.junit_4.13.2.v20211018-1956.jar
        plugins/org.eclipse.xtend.lib_2.25.0.v20210301-0821.jar
        plugins/org.eclipse.jdt.apt.pluggable.core_1.3.0.v20210618-1653.jar
        plugins/org.eclipse.m2e.lifecyclemapping.defaults_1.17.1.20210115-1536.jar
        plugins/org.eclipse.jdt.apt.core_3.7.50.v20210914-1429.jar
        plugins/org.eclipse.core.filesystem_1.9.300.v20220121-1426.jar
        plugins/org.apache.commons.lang3_3.1.0.v201403281430.jar
        plugins/ch.qos.logback.slf4j_1.2.3.v20200428-2012.jar
        plugins/org.eclipse.m2e.jdt_1.18.2.20211002-1029.jar
        plugins/org.eclipse.core.filebuffers_3.7.200.v20220202-1008.jar
        plugins/org.eclipse.buildship.core_3.1.6.v20211108-1823-s.jar
        plugins/ch.qos.logback.classic_1.2.3.v20200428-2012.jar
        plugins/org.eclipse.core.jobs_3.12.100.v20220120-1329.jar
        plugins/org.eclipse.equinox.simpleconfigurator_1.4.0.v20210315-2228.jar
        plugins/org.eclipse.equinox.security_1.3.900.v20220108-1321.jar
        plugins/org.eclipse.equinox.app_1.6.100.v20211021-1418.jar
        plugins/com.google.gson_2.8.9.v20220111-1409.jar
        plugins/org.slf4j.api_1.7.30.v20200204-2150.jar
        plugins/org.eclipse.ant.core_3.6.300.v20220214-2001.jar
        plugins/org.eclipse.jdt.junit.core_3.11.200.v20220204-2234.jar
        plugins/org.eclipse.osgi.util_3.6.100.v20210723-1119.jar
        plugins/org.eclipse.core.contenttype_3.8.100.v20210910-0640.jar
        plugins/org.eclipse.m2e.maven.indexer_1.18.1.20211011-2139.jar
        plugins/org.eclipse.jdt.core.manipulation_1.16.0.v20220214-0655.jar
        plugins/org.eclipse.equinox.simpleconfigurator.manipulator_2.2.0.v20210315-2228.jar
        plugins/org.eclipse.compare.core_3.6.1000.v20201020-1107.jar
        plugins/org.eclipse.core.commands_3.10.100.v20210722-1426.jar
        plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
        plugins/org.apache.felix.scr_2.1.24.v20200924-1939.jar
        plugins/org.eclipse.osgi.compatibility.state_1.2.600.v20220207-1403.jar
        plugins/org.eclipse.equinox.frameworkadmin_2.2.0.v20210315-2042.jar
        plugins/org.eclipse.core.variables_3.5.100.v20210721-1355.jar
        plugins/org.eclipse.core.net_1.3.1100.v20210424-0724.jar
        plugins/org.eclipse.m2e.workspace.cli_0.3.1.jar
        plugins/org.eclipse.m2e.core_1.18.2.20211011-2139.jar
        plugins/com.sun.jna_5.8.0.v20210503-0343.jar
        plugins/org.eclipse.equinox.preferences_3.9.100.v20211021-1418.jar
        plugins/ch.qos.logback.core_1.2.3.v20200428-2012.jar
        plugins/org.eclipse.osgi_3.17.200.v20220215-2237.jar
        plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.400.v20211117-0650.jar
        plugins/org.eclipse.jdt.launching_3.19.500.v20220125-2008.jar
        plugins/org.eclipse.jdt.compiler.tool_1.3.100.v20211201-1611.jar
        plugins/org.eclipse.osgi.services_3.10.200.v20210723-0643.jar
        plugins/org.eclipse.jdt.junit.runtime_3.6.100.v20210708-1502.jar
        plugins/org.eclipse.xtend.lib.macro_2.25.0.v20210301-0821.jar
        plugins/org.eclipse.lsp4j.jsonrpc_0.11.0.v20210319-1406.jar
        plugins/org.eclipse.buildship.compat_3.1.6.v20211108-1823-s.jar
        plugins/org.eclipse.debug.core_3.19.0.v20220125-2302.jar
        plugins/org.eclipse.m2e.maven.runtime_1.18.1.20211011-2139.jar
        plugins/org.eclipse.lsp4j_0.11.0.v20210319-1406.jar
        plugins/org.eclipse.equinox.security.win32.x86_64_1.1.300.v20211021-1418.jar
        plugins/org.eclipse.core.net.win32.x86_64_1.1.500.v20190925-1337.jar
        plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.400.v20211117-0650.jar
        plugins/org.eclipse.jdt.launching.macosx_3.4.800.v20210915-0906.jar
        plugins/org.eclipse.equinox.security.macosx_1.101.400.v20210427-1958.jar
        plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.2.400.v20211117-0650.jar
        features/org.eclipse.equinox.executable_3.8.1500.v20220210-1108.jar
        config_mac/config.ini
        config_win/config.ini
        config_linux/config.ini
        config_ss_mac/config.ini
        config_ss_win/config.ini
        config_ss_linux/config.ini
        Deleting "/home/alvinlee/.local/share/nvim/lsp_servers/jdtls.tmp/archive.tar.gz"
        Downloading file "https://projectlombok.org/downloads/lombok.jar"...
        2022-02-22 15:34:36 URL:https://projectlombok.org/downloads/lombok.jar [1950607/1950607] -> "lombok.jar" [1]
        Failed to promote the temporary installation directory "/home/alvinlee/.local/share/nvim/lsp_servers/jdtls.tmp".
alvinlee001 commented 2 years ago

This issue also happens to jdtls (java), from observation, it is able to create a $LSP_SERVER from $LSP_SERVER.tmp, but the $LSP_SERVER is empty

schrc3b6 commented 2 years ago

@williamboman I actually had some time today and tried to make this error reproducible. I couldn't... It only happens on this one old Debian stretch machine. I've tried to reproduce this error on clean Debian buster and bullseye images and couldn't...

@alvinlee001 could you provide some information on what machine you encountered this error.

alvinlee001 commented 2 years ago

I am using WSL2 Ubuntu in a windows computer, I was setting up my new desktop environment from fresh. I am using LunarVim, basically a Neovim with default functions, and do :LspInstall java. After that the error...

alvinlee001 commented 2 years ago

Other LSP servers are installed successfully

Nazeehe commented 2 years ago

I have the same issue with java above. Windows 11 PC.