I'm not quite sure, if this issue comes from packer.nvim itself or the latest neovim version (compiled from source). I tried to update the plugins today and got the following error, after all updates were finished:
Error executing vim.schedule lua callback: .../pack/packer/opt/packer.nvim/lua/packer/plugin_utils.lua:56: bad argument
#1 to 'max' (number expected, got no value)
I does seem like, that txts or tags is sometimes empty, which in return does cause the issue above, because math.max is called with an empty table. I tried to check, if this was plugin related, by putting some print statements into plugin_utils.lua:
/home/okan/.local/share/nvim/site/pack/packer/start/vim-fugitive/doc
txts { "/home/okan/.local/share/nvim/site/pack/packer/start/vim-fugitive/doc/fugitive.txt" }
txts_after_extend { "/home/okan/.local/share/nvim/site/pack/packer/start/vim-fugitive/doc/fugitive.txt" }
tags { "/home/okan/.local/share/nvim/site/pack/packer/start/vim-fugitive/doc/tags" }
tags_after_extend { "/home/okan/.local/share/nvim/site/pack/packer/start/vim-fugitive/doc/tags" }
/home/okan/.local/share/nvim/site/pack/packer/start/vim-repeat/doc
txts {}
txts_after_extend {}
tags {}
tags_after_extend {}
In this case, it happened for vim-repeat, so I tried to run it again:
/home/okan/.local/share/nvim/site/pack/packer/start/indentLine/doc
txts { "/home/okan/.local/share/nvim/site/pack/packer/start/indentLine/doc/indentLine.txt" }
txts_after_extend { "/home/okan/.local/share/nvim/site/pack/packer/start/indentLine/doc/indentLine.txt" }
tags { "/home/okan/.local/share/nvim/site/pack/packer/start/indentLine/doc/tags" }
tags_after_extend { "/home/okan/.local/share/nvim/site/pack/packer/start/indentLine/doc/tags" }
/home/okan/.local/share/nvim/site/pack/packer/start/vimspector/doc
txts {}
txts_after_extend {}
tags {}
tags_after_extend {}
And this time, it happened for vimspector.
So I tried to check, why txts and tags is sometimes an empty table, first by printing the result of util.join_paths:
/home/okan/.local/share/nvim/site/pack/packer/start/targets.vim/doc
txts_join_paths /home/okan/.local/share/nvim/site/pack/packer/start/targets.vim/doc/*.txt
txts { "/home/okan/.local/share/nvim/site/pack/packer/start/targets.vim/doc/targets.txt" }
txts_after_extend { "/home/okan/.local/share/nvim/site/pack/packer/start/targets.vim/doc/targets.txt" }
tags_join_paths /home/okan/.local/share/nvim/site/pack/packer/start/targets.vim/doc/tags
tags { "/home/okan/.local/share/nvim/site/pack/packer/start/targets.vim/doc/tags" }
tags_after_extend { "/home/okan/.local/share/nvim/site/pack/packer/start/targets.vim/doc/tags" }
/home/okan/.local/share/nvim/site/pack/packer/start/vim-snippets/doc
txts_join_paths /home/okan/.local/share/nvim/site/pack/packer/start/vim-snippets/doc/*.txt
txts {}
txts_after_extend {}
tags_join_paths /home/okan/.local/share/nvim/site/pack/packer/start/vim-snippets/doc/tags
tags {}
tags_after_extend {}
No issues, so it seems like vim.fn.glob(..., true, true) is sometimes returning and empty set, even though the path looks correct.
It's not obvious to me, why this fails randomly. I can try to bisect the specific commit, if this is related to neovim and not a packer.nvim issue, if it helps.
Code used for printing the values as a reference:
plugin_utils.helptags_stale = function(dir)
-- Adapted directly from minpac.vim
print(dir)
local txts = vim.fn.glob(util.join_paths(dir, '*.txt'), true, true)
print("txts_join_paths", util.join_paths(dir, '*.txt'))
print("txts", vim.inspect(txts))
vim.list_extend(txts, vim.fn.glob(util.join_paths(dir, '*.[a-z][a-z]x'), true, true))
print("txts_after_extend", vim.inspect(txts))
local tags = vim.fn.glob(util.join_paths(dir, 'tags'), true, true)
print("tags_join_paths", util.join_paths(dir, 'tags'))
print("tags", vim.inspect(tags))
vim.list_extend(tags, vim.fn.glob(util.join_paths(dir, 'tags-[a-z][a-z]'), true, true))
print("tags_after_extend", vim.inspect(tags))
local txt_newest = math.max(unpack(util.map(vim.fn.getftime, txts)))
local tag_oldest = math.min(unpack(util.map(vim.fn.getftime, tags)))
return txt_newest > tag_oldest
end
neovim version:
:version
NVIM v0.5.0-dev+944-g82100a6bd
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wsh
adow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-
color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_
LOG_LEVEL=3 -I.../neovim/build/config -I.../neovim/src -I.../neovim/.deps/usr
/include -I/usr/include -I.../neovim/build/src/nvim/auto -I.../neovim/build/include
Compiled by okan@XXX
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"
Run :checkhealth for more info
This is related to this issue #103
Ah yes, I'm going to close this in favour of #103.
Most helpful comment
Ah yes, I'm going to close this in favour of #103.