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

Unhandled error when scan finds directory without read permissions #95

Open
mikehaertl opened this issue Nov 25, 2023 · 0 comments
Open

Comments

@mikehaertl
Copy link

Describe the bug

It seems the scan process scans all files in ~/.local/shared for some reason.

The scan process seems to hang when it finds a directory without read permissions and leads to errors in other plugins that depend on LSP and run into a timeout.

In my case this happened because Steam on Linux creates directories with root permissions somewhere in my ~/.local directory:

$ l -d '/home/mike/.local/share/Steam/steamapps/compatdata/0/pfx/dosdevices/z:/root'
drwx------ 23 root root 4,0K Sep  4 09:22 /home/mike/.local/share/Steam/steamapps/compatdata/0/pfx/dosdevices/z:/root

To Reproduce
Steps to reproduce the behavior:

  1. Create a directory with root perms:
    sudo mkdir ~/.local/shared/x
    sudo chmod 700 ~/.local/shared/x
  2. Start editing a .vim file that uses LSP

I can maybe provide a minimal vimrc.vim but it also requires to create a read-only directory somewhere in your home.

Expected behavior

The server should skip directories without read permissions.

Maybe an alternative is to restrict which directories are scanned.

Desktop

  • OS: Linux Mint 21.2
  • Neovim: 0.9.4
  • Relevant plugins: nvim-lspconfig, Mason

Log:

[START][2023-11-25 11:02:35] LSP logging initiated
[ERROR][2023-11-25 11:02:35] .../vim/lsp/rpc.lua:734	"rpc"	"/tmp/plugged/mason/bin/vim-language-server"	"stderr"	"node:events:491\n      throw er; // Unhandled 'error' event\n      ^\n\nError: EACCES: permission denied, scandir '/home/mike/.local/share/Steam/steamapps/compatdata/0/pfx/dosdevices/z:/root'\nEmitted 'error' event at:\n    at AsyncReader._handleError (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/scan.js:22829:23)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/scan.js:22808:22\n    at worked (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/scan.js:23378:14)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/scan.js:22815:24\n    at callFailureCallback (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/scan.js:22974:5)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/scan.js:22905:20\n    at node:fs:192:23\n    at FSReqCallback.req.oncomplete (node:fs:1412:9) {\n  errno: -13,\n  code: 'EACCES',\n  syscall: 'scandir',\n  path: '/home/mike/.local/share/Steam/steamapps/compatdata/0/pfx/dosdevices/z:/root'\n}\n"
[WARN][2023-11-25 11:02:36] ...lsp/handlers.lua:537	"parser: Send error: Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed\n    at new NodeError (node:internal/errors:387:5)\n    at ChildProcess.target.send (node:internal/child_process:749:16)\n    at send (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27718:17)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27893:62\n    at new Promise (<anonymous>)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27891:62\n    at step (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27674:23)\n    at Object.next (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27655:53)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27649:71\n    at new Promise (<anonymous>)"
[WARN][2023-11-25 11:02:36] ...lsp/handlers.lua:537	"parser: Send error: Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed\n    at new NodeError (node:internal/errors:387:5)\n    at ChildProcess.target.send (node:internal/child_process:749:16)\n    at send (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27718:17)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27893:62\n    at new Promise (<anonymous>)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27891:62\n    at step (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27674:23)\n    at Object.next (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27655:53)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27649:71\n    at new Promise (<anonymous>)"
[WARN][2023-11-25 11:02:36] ...lsp/handlers.lua:537	"parser: Send error: Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed\n    at new NodeError (node:internal/errors:387:5)\n    at ChildProcess.target.send (node:internal/child_process:749:16)\n    at send (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27718:17)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27893:62\n    at new Promise (<anonymous>)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27891:62\n    at step (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27674:23)\n    at Object.next (/tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27655:53)\n    at /tmp/plugged/mason/packages/vim-language-server/node_modules/vim-language-server/out/index.js:27649:71\n    at new Promise (<anonymous>)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant