Skip to content

bug: Runtime path reset picks wrong lib path on some systems #2041

@Bossach

Description

@Bossach

Did you check docs and existing issues?

  • I have read all the lazy.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of lazy.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.4, Build type: Release

Operating system/version

Debian 13 (x86_64)

Describe the bug

The lazy.nvim during runtime path reset picks nonexistent /usr/lib64/nvim/ path. The real nvim lib path on stock debian (and possibly some other systems) is /usr/lib/nvim/ though.


It leads to nasty error when opening any .lua file or even any :help page (probably not limited to these two) and no highlights (all highlights are working with no lazy's setup() though). Treesitter couldn't find parsers (which really live under /usr/lib/nvim/parser) due to wrong "lib" path.

Error outputs (probably not important)

$ nvim lazy_conf.lua :

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:35: Error executing lua: /usr/share/nvim/runtime/file
type.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20]..script /
usr/share/nvim/runtime/ftplugin/lua.lua: Vim(runtime):E5113: Error while calling lua chunk: /usr/share/nvim/runtime/lua/
vim/treesitter/language.lua:107: no parser for 'lua' language, see :help treesitter-parsers
stack traceback:
        [C]: in function 'error'
        /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:107: in function 'add'
        /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:111: in function 'new'
        /usr/share/nvim/runtime/lua/vim/treesitter.lua:41: in function '_create_parser'
        /usr/share/nvim/runtime/lua/vim/treesitter.lua:108: in function 'get_parser'
        /usr/share/nvim/runtime/lua/vim/treesitter.lua:416: in function 'start'
        /usr/share/nvim/runtime/ftplugin/lua.lua:2: in main chunk
        [C]: in function 'nvim_cmd'
        /usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_cmd'
        /usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>

:help nvim :

Error detected while processing BufReadPost Autocommands for "*":                                             
Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:35: Error executing lua: /usr/share/nvim/runtime/file
type.lua:36: BufReadPost Autocommands for "*"..FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20]..script /
usr/share/nvim/runtime/ftplugin/help.lua: Vim(runtime):E5113: Error while calling lua chunk: /usr/share/nvim/runtime/lua
/vim/treesitter/language.lua:107: no parser for 'vimdoc' language, see :help treesitter-parsers                         
stack traceback:                                                                                                        
        [C]: in function 'error'                                                                                        
        /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:107: in function 'add'                                  
        /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:111: in function 'new'                              
        /usr/share/nvim/runtime/lua/vim/treesitter.lua:41: in function '_create_parser'                                 
        /usr/share/nvim/runtime/lua/vim/treesitter.lua:108: in function 'get_parser'                                    
        /usr/share/nvim/runtime/lua/vim/treesitter.lua:416: in function 'start'                                         
        /usr/share/nvim/runtime/ftplugin/help.lua:2: in main chunk                                                      
        [C]: in function 'nvim_cmd'                                                                                     
        /usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>                  
        [C]: in function 'nvim_buf_call'                                                                                
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>                  
stack traceback:                                                                                                        
        [C]: in function 'nvim_cmd'                                                                                     
        /usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35>                  
        [C]: in function 'nvim_buf_call'                                                                                
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10>                  
stack traceback:                                                                                                        
        [C]: in function 'nvim_buf_call'                                                                                
        /usr/share/nvim/runtime/filetype.lua:35: in function </usr/share/nvim/runtime/filetype.lua:10> 

( Seemingly same problem on Ubuntu )


Workaround over issue
require("lazy").setup({
  spec = {
     ...
  },
  ... 
  -- just turn runtimepath reset off
  performance = { rtp = { reset = false } },
})


The code causing it:
lazy/core/config.lua:301
It puts directory into runtimepath without checking whether it exist.


Probable solution is check whether .../lib64/nvim/ extist before put it into runtimepath. Maybe if there no .../lib64/nvim/ exists, fallback to .../lib/nvim/.

Steps To Reproduce

  1. Get Debian 13 system and neovim (or any system where nvim lib lives under lib, but lib64 also exists)
  2. require("lazy").setup(...) according to installation guide (no extra plugins/config needed)
  3. Open any :help page. (Or any .lua file. Or some other file types may probably fail too)
  4. Get nasty error and no syntax highlight

Expected Behavior

Real .../lib../nvim/ is reachable from runtime path.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    -- no extra plugins or config needed
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions