bug: ffi is broken due to the change in nvim nightly
XXiaoA opened this issue · comments
Did you check docs and existing issues?
- I have read all the noice.nvim docs
- I have searched the existing issues of noice.nvim
- I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
NVIM v0.10.0-dev-3067+g7b14eb543
Operating system/version
Archlinux
Describe the bug
Recently, in this commit
neovim/neovim@7b14eb5 , nvim refactor the setcursor_mayforce
function. Unfortunately, this effects noice.nvim's FFI in
noice.nvim/lua/noice/util/ffi.lua
Line 20 in f4decbc
Therefore, if we use the nightly version of nvim and noice.nvim, nvim will crash accidently
Steps To Reproduce
just use the lastest nvim and noice
Expected Behavior
nvim won't crash
Repro
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
"folke/noice.nvim",
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
Yeah nvim crash randomly.
Does this give an error message? I'm not sure if I'm experiencing the same bug or not. Using nvim -D
, I can get the error:
nvim: ./src/nvim/message.c:2403: msg_scroll_flush: Assertion `to_scroll >= 0' failed.
This happens immediately after startup. The expected result of the for
loop in my minimal config does show up in the output of nvim -V
, but Neovim crashes before I can see it without -V
Here is a stacktrace, the result of 2>&1 coredumpctl -1 gdb | tee -a bt.txt
(following https://neovim.io/doc/user/dev_tools.html#dev-tools-backtrace): bt.txt
I first encountered this bug a few days back in my full Neovim config, but I've managed to narrow down to noice.nvim
(though I'm not sure it's the cause, could always be something else).
Fresh install of Ubuntu Server 24.04 in a Qemu virtual machine (KVM acceleration, x86_64 for both host & guest), accessed through SSH. Installed neovim
(through the nightly PPA), g++
, cmake
, ninja-build
, unzip
, openjdk-21-jdk
, ripgrep
, fswatch
, neofetch
, and eza
. Also installed node.js v20.12.2 through nvm
and Cargo 1.78.0 through their install script (https://sh.rustup.rs).
This is the minimal init.lua
that I used to replicate my crash:
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
},
{
"folke/noice.nvim",
event = "VeryLazy",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
}
},
})
require("nvim-treesitter.configs").setup({
ensure_installed = {
"c", "lua", "vim", "vimdoc", "query", "regex", "markdown_inline"
},
})
require("noice").setup()
local tbl = { 1, 2, 3 }
for k, v in ipairs(tbl) do vim.notify(tostring(v)) end -- causes the crash (does not occur without noice.nvim)
But this minimal.lua
(used with nvim -u minimal.lua
) based on the docs also causes the crash, and the crash is solved by commenting out require("noice").setup()
.
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
"folke/tokyonight.nvim",
{
"folke/noice.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
"rcarriga/nvim-notify",
},
},
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
-- add anything else here
vim.opt.termguicolors = true
vim.cmd([[colorscheme tokyonight]])
require("noice").setup()
local tbl = { 1, 2, 3 }
for k, v in ipairs(tbl) do vim.notify(tostring(v)) end -- causes the crash (does not occur without noice.nvim)
Do let me know if more information is necessary, or if this would be best suited to its own issue. Many thanks.
This was already fixed in noice. Make sure your Neovim nightly version is up to date