Rebuild the luv package with the patch at luvit/luv#598 applied. See PKGBUILD for an example.
Last active
May 11, 2022 03:35
-
-
Save nogweii/3abd5e6133ec766f0b31b79c03690246 to your computer and use it in GitHub Desktop.
neovim crashing (on linux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#0 0x00007f2d7e70134c in __pthread_kill_implementation () from /usr/lib/libc.so.6 | |
#1 0x00007f2d7e6b44b8 in raise () from /usr/lib/libc.so.6 | |
#2 0x00007f2d7e69e534 in abort () from /usr/lib/libc.so.6 | |
#3 0x00007f2d7e6f5397 in __libc_message () from /usr/lib/libc.so.6 | |
#4 0x00007f2d7e70b33c in malloc_printerr () from /usr/lib/libc.so.6 | |
#5 0x00007f2d7e70d65c in _int_free () from /usr/lib/libc.so.6 | |
#6 0x00007f2d7e70fbe3 in free () from /usr/lib/libc.so.6 | |
#7 0x00007f2d7ea6b050 in uv__free (ptr=ptr@entry=0x557a7ceaa000) at src/uv-common.c:88 | |
#8 0x00007f2d7ea71cd1 in uv__fs_closedir (req=<optimized out>) at src/unix/fs.c:647 | |
#9 uv__fs_work (w=<optimized out>) at src/unix/fs.c:1725 | |
#10 0x00007f2d7ea74308 in uv_fs_closedir (loop=<optimized out>, req=0x7f2d7cb02a98, dir=<optimized out>, cb=<optimized out>) | |
at src/unix/fs.c:2054 | |
#11 0x00007f2d7eaa76b5 in luv_fs_closedir (L=0x7f2d7eada380) at /usr/src/debug/luv-1.43.0-0/src/fs.c:940 | |
#12 0x00007f2d7e885f06 in lj_BC_FUNCC () at buildvm_x86.dasc:857 | |
#13 0x00007f2d7e89878a in lua_pcall (L=L@entry=0x7f2d7eada380, nargs=nargs@entry=0, nresults=nresults@entry=1, errfunc=errfunc@entry=-2) | |
at /build/luajit/src/luajit-2.0-3ee3c9c/src/lj_api.c:1116 | |
#14 0x0000557a7a391841 in nlua_pcall (lstate=0x7f2d7eada380, nargs=0, nresults=1) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/lua/executor.c:129 | |
#15 0x0000557a7a39f45b in nlua_typval_exec (lcmd=<optimized out>, lcmd_len=<optimized out>, name=<optimized out>, args=<optimized out>, | |
argcount=0, special=false, ret_tv=0x7ffe2e747ac0) at /usr/src/debug/neovim-0.7.0/src/nvim/lua/executor.c:1230 | |
#16 0x0000557a7a39fce3 in nlua_typval_exec (ret_tv=0x7ffe2e747ac0, special=false, argcount=0, args=0x7ffe2e747560, | |
name=0x557a7a553f11 "v:lua", lcmd_len=38, | |
lcmd=0x557a7a63c5e0 <IObuff> "return require'feline'.statusline(...)\"nvim-treesitter.fold\".get_fold_indic(1))))A))ur_job, line 4") | |
at /usr/src/debug/neovim-0.7.0/src/nvim/memory.c:122 | |
#17 nlua_typval_call (str=<optimized out>, len=26, args=0x7ffe2e747560, argcount=0, ret_tv=0x7ffe2e747ac0) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/lua/executor.c:1186 | |
#18 0x0000557a7a30f042 in call_func (funcname=funcname@entry=0x7ffe2e747e26 "require'feline'.statusline()", len=<optimized out>, | |
len@entry=26, rettv=rettv@entry=0x7ffe2e747ac0, argcount_in=argcount_in@entry=0, argvars_in=argvars_in@entry=0x7ffe2e747560, | |
funcexe=funcexe@entry=0x7ffe2e747710) at /usr/src/debug/neovim-0.7.0/src/nvim/eval/userfunc.c:1525 | |
#19 0x0000557a7a30f7dd in get_func_tv (name=0x7ffe2e747e26 "require'feline'.statusline()", len=26, rettv=0x7ffe2e747ac0, | |
arg=0x7ffe2e747a70, funcexe=0x7ffe2e747710) at /usr/src/debug/neovim-0.7.0/src/nvim/eval/userfunc.c:458 | |
#20 0x0000557a7a2cd9cf in call_func_rettv (arg=arg@entry=0x7ffe2e747a70, rettv=rettv@entry=0x7ffe2e747ac0, evaluate=evaluate@entry=true, | |
selfdict=selfdict@entry=0x0, basetv=basetv@entry=0x0, lua_funcname=lua_funcname@entry=0x7ffe2e747e26 "require'feline'.statusline()") | |
at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:4353 | |
#21 0x0000557a7a2d58c7 in handle_subscript (arg=<optimized out>, rettv=<optimized out>, evaluate=1, verbose=1, | |
start_leader=0x7ffe2e747e20 "v:lua.require'feline'.statusline()", end_leaderp=0x7ffe2e747878) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:8602 | |
#22 0x0000557a7a2c5bd6 in eval7 (arg=arg@entry=0x7ffe2e747a70, rettv=rettv@entry=0x7ffe2e747ac0, evaluate=evaluate@entry=1, | |
want_string=want_string@entry=0) at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:4250 | |
#23 0x0000557a7a2c6a34 in eval6 (arg=arg@entry=0x7ffe2e747a70, rettv=rettv@entry=0x7ffe2e747ac0, evaluate=evaluate@entry=1, | |
want_string=want_string@entry=0) at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:3912 | |
#24 0x0000557a7a2c6db4 in eval5 (evaluate=1, rettv=0x7ffe2e747ac0, arg=0x7ffe2e747a70) | |
--Type <RET> for more, q to quit, c to continue without paging-- | |
at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:3737 | |
#25 eval4 (evaluate=1, rettv=0x7ffe2e747ac0, arg=0x7ffe2e747a70) at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:3633 | |
#26 eval3 (arg=arg@entry=0x7ffe2e747a70, rettv=rettv@entry=0x7ffe2e747ac0, evaluate=evaluate@entry=1) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:3554 | |
#27 0x0000557a7a2c6fe5 in eval2 (evaluate=1, rettv=0x7ffe2e747ac0, arg=0x7ffe2e747a70) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:3485 | |
#28 eval1 (arg=arg@entry=0x7ffe2e747a70, rettv=rettv@entry=0x7ffe2e747ac0, evaluate=evaluate@entry=1) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:3411 | |
#29 0x0000557a7a2c9ed1 in eval0 (arg=0x7ffe2e747e20 "v:lua.require'feline'.statusline()", rettv=rettv@entry=0x7ffe2e747ac0, | |
nextcmd=0x7ffe2e747c68, evaluate=evaluate@entry=1) at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:3370 | |
#30 0x0000557a7a2cad7b in eval_to_string (arg=<optimized out>, nextcmd=<optimized out>, convert=convert@entry=false) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:884 | |
#31 0x0000557a7a2cb0d2 in eval_to_string_safe (arg=<optimized out>, nextcmd=<optimized out>, use_sandbox=<optimized out>) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/eval.c:924 | |
#32 0x0000557a7a28bdfc in build_stl_str_hl (wp=0x557a7ca85dc0, out=0x7ffe2e747e20 "v:lua.require'feline'.statusline()", outlen=4096, | |
fmt=0x557a7ce7ede0 "%{%v:lua.require'feline'.statusline()%}", use_sandbox=0, fillchar=32, maxwidth=<optimized out>, | |
hltab=0x7ffe2e747e18, tabtab=0x7ffe2e747e10) at /usr/src/debug/neovim-0.7.0/src/nvim/buffer.c:3928 | |
#33 0x0000557a7a4758ea in win_redr_custom (wp=wp@entry=0x557a7ca85dc0, draw_ruler=draw_ruler@entry=false) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/screen.c:5519 | |
#34 0x0000557a7a475d67 in redraw_custom_statusline (wp=0x557a7ca85dc0) at /usr/src/debug/neovim-0.7.0/src/nvim/screen.c:5265 | |
#35 0x0000557a7a478faa in showruler (always=<optimized out>) at /usr/src/debug/neovim-0.7.0/src/nvim/screen.c:7175 | |
#36 0x0000557a7a3df8d6 in normal_redraw (s=0x7ffe2e748f20) at /usr/src/debug/neovim-0.7.0/src/nvim/message.c:2491 | |
#37 normal_check (state=0x7ffe2e748f20) at /usr/src/debug/neovim-0.7.0/src/nvim/normal.c:1381 | |
#38 0x0000557a7a4bb0e0 in state_enter (s=0x7ffe2e748f20) at /usr/src/debug/neovim-0.7.0/src/nvim/state.c:31 | |
#39 0x0000557a7a3df390 in normal_enter (cmdwin=<optimized out>, noexmode=<optimized out>) | |
at /usr/src/debug/neovim-0.7.0/src/nvim/normal.c:463 | |
#40 0x0000557a7a239245 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/neovim-0.7.0/src/nvim/main.c:574 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NVIM v0.7.0 | |
Build type: Release | |
LuaJIT 2.1.0-beta3 | |
Compiled by builduser | |
Features: +acl +iconv +tui | |
See ":help feature-compile" | |
system vimrc file: "$VIM/sysinit.vim" | |
fall-back for $VIM: "/usr/share/nvim" | |
Run :checkhealth for more info | |
---- | |
Arch Linux | |
$TERM = alacritty | |
Running in alacritty | |
Installed via official package (`pacman -S neovim`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docs.md b/docs.md | |
index 75d54f6b..9a9a7208 100644 | |
--- a/docs.md | |
+++ b/docs.md | |
@@ -2975,14 +2975,14 @@ Copies a file from path to new_path. If the `flags` parameter is omitted, then t | |
- `path`: `string` | |
- `callback`: `callable` (async version) or `nil` (sync version) | |
- `err`: `nil` or `string` | |
- - `dir`: `uv_dir_t userdata` or `nil` | |
+ - `dir`: `luv_dir_t userdata` or `nil` | |
- `entries`: `integer` or `nil` | |
Opens path as a directory stream. Returns a handle that the user can pass to | |
`uv.fs_readdir()`. The `entries` parameter defines the maximum number of entries | |
that should be returned by each call to `uv.fs_readdir()`. | |
-**Returns (sync version):** `uv_dir_t userdata` or `fail` | |
+**Returns (sync version):** `luv_dir_t userdata` or `fail` | |
**Returns (async version):** `uv_fs_t userdata` | |
@@ -2991,12 +2991,12 @@ that should be returned by each call to `uv.fs_readdir()`. | |
> method form `dir:readdir([callback])` | |
**Parameters:** | |
-- `dir`: `uv_dir_t userdata` | |
+- `dir`: `luv_dir_t userdata` | |
- `callback`: `callable` (async version) or `nil` (sync version) | |
- `err`: `nil` or `string` | |
- `entries`: `table` or `nil` (see below) | |
-Iterates over the directory stream `uv_dir_t` returned by a successful | |
+Iterates over the directory stream `luv_dir_t` returned by a successful | |
`uv.fs_opendir()` call. A table of data tables is returned where the number | |
of entries `n` is equal to or less than the `entries` parameter used in | |
the associated `uv.fs_opendir()` call. | |
@@ -3013,7 +3013,7 @@ the associated `uv.fs_opendir()` call. | |
> method form `dir:closedir([callback])` | |
**Parameters:** | |
-- `dir`: `uv_dir_t userdata` | |
+- `dir`: `luv_dir_t userdata` | |
- `callback`: `callable` (async version) or `nil` (sync version) | |
- `err`: `nil` or `string` | |
- `success`: `boolean` or `nil` | |
diff --git a/src/fs.c b/src/fs.c | |
index 0c36dccd..c7c69923 100644 | |
--- a/src/fs.c | |
+++ b/src/fs.c | |
@@ -17,6 +17,13 @@ | |
#include "private.h" | |
+#if LUV_UV_VERSION_GEQ(1, 28, 0) | |
+typedef struct { | |
+ uv_dir_t* handle; | |
+ int dirents_ref; /* handle has been closed if this is LUA_NOREF */ | |
+} luv_dir_t; | |
+#endif | |
+ | |
static uv_fs_t* luv_check_fs(lua_State* L, int index) { | |
uv_fs_t* req = (uv_fs_t*)luaL_checkudata(L, index, "uv_req"); | |
luaL_argcheck(L, req->type == UV_FS && req->data, index, "Expected uv_fs_t"); | |
@@ -333,14 +340,15 @@ static int push_fs_result(lua_State* L, uv_fs_t* req) { | |
luaL_unref(L, LUA_REGISTRYINDEX, data->data_ref); | |
data->data_ref = LUA_NOREF; | |
- (*(void**)lua_newuserdata(L, sizeof(void*))) = dir; | |
- lua_pushfstring(L, "uv_dir:%p", dir); | |
- dir->dirents = lua_newuserdata(L, sizeof(uv_dirent_t)*nentries); | |
- dir->nentries = nentries; | |
- lua_rawset(L, LUA_REGISTRYINDEX); | |
+ luv_dir_t* luv_dir = lua_newuserdata(L, sizeof(*luv_dir)); | |
luaL_getmetatable(L, "uv_dir"); | |
lua_setmetatable(L, -2); | |
+ luv_dir->handle = dir; | |
+ luv_dir->handle->dirents = lua_newuserdata(L, sizeof(uv_dirent_t)*nentries); | |
+ luv_dir->dirents_ref = luaL_ref(L, LUA_REGISTRYINDEX); | |
+ luv_dir->handle->nentries = nentries; | |
+ | |
return 1; | |
} | |
case UV_FS_READDIR: { | |
@@ -888,8 +896,8 @@ static int luv_fs_copyfile(lua_State*L) { | |
#endif | |
#if LUV_UV_VERSION_GEQ(1, 28, 0) | |
-static uv_dir_t* luv_check_dir(lua_State* L, int idx) { | |
- uv_dir_t* dir = *(uv_dir_t**)luaL_checkudata(L, idx, "uv_dir"); | |
+static luv_dir_t* luv_check_dir(lua_State* L, int idx) { | |
+ luv_dir_t* dir = (luv_dir_t*)luaL_checkudata(L, idx, "uv_dir"); | |
return dir; | |
} | |
@@ -911,45 +919,44 @@ static int luv_fs_opendir(lua_State* L) { | |
static int luv_fs_readdir(lua_State* L) { | |
luv_ctx_t* ctx = luv_context(L); | |
uv_fs_t *req; | |
- uv_dir_t* dir = luv_check_dir(L, 1); | |
+ luv_dir_t* dir = luv_check_dir(L, 1); | |
int ref = luv_check_continuation(L, 2); | |
req = (uv_fs_t*)lua_newuserdata(L, uv_req_size(UV_FS)); | |
req->data = luv_setup_req(L, ctx, ref); | |
- FS_CALL(readdir, req, dir); | |
+ FS_CALL(readdir, req, dir->handle); | |
} | |
static int luv_fs_closedir(lua_State* L) { | |
luv_ctx_t* ctx = luv_context(L); | |
- uv_dir_t* dir = luv_check_dir(L, 1); | |
+ luv_dir_t* dir = luv_check_dir(L, 1); | |
int ref = luv_check_continuation(L, 2); | |
+ | |
+ luaL_unref(L, LUA_REGISTRYINDEX, dir->dirents_ref); | |
+ dir->dirents_ref = LUA_NOREF; | |
+ | |
uv_fs_t *req = (uv_fs_t*)lua_newuserdata(L, uv_req_size(UV_FS)); | |
req->data = luv_setup_req(L, ctx, ref); | |
- lua_pushfstring(L, "uv_dir:%p", dir); | |
- lua_pushnil(L); | |
- lua_rawset(L, LUA_REGISTRYINDEX); | |
- FS_CALL(closedir, req, dir); | |
+ FS_CALL(closedir, req, dir->handle); | |
} | |
static int luv_fs_dir_tostring(lua_State* L) { | |
- uv_dir_t* dir = luv_check_dir(L, 1); | |
+ luv_dir_t* dir = luv_check_dir(L, 1); | |
lua_pushfstring(L, "uv_dir_t: %p", dir); | |
return 1; | |
} | |
static int luv_fs_dir_gc(lua_State* L) { | |
- uv_dir_t* dir = luv_check_dir(L, 1); | |
- lua_pushfstring(L, "uv_dir:%p", dir); | |
- lua_rawget(L, LUA_REGISTRYINDEX); | |
- if (!lua_isnil(L, -1)) { | |
+ luv_dir_t* dir = luv_check_dir(L, 1); | |
+ if (dir->dirents_ref != LUA_NOREF) { | |
uv_fs_t req; | |
luv_ctx_t* ctx = luv_context(L); | |
- uv_fs_closedir(ctx->loop, &req, dir, NULL); | |
+ luaL_unref(L, LUA_REGISTRYINDEX, dir->dirents_ref); | |
+ dir->dirents_ref = LUA_NOREF; | |
+ | |
+ uv_fs_closedir(ctx->loop, &req, dir->handle, NULL); | |
uv_fs_req_cleanup(&req); | |
- lua_pushfstring(L, "uv_dir:%p", dir); | |
- lua_pushnil(L); | |
- lua_rawset(L, LUA_REGISTRYINDEX); | |
} | |
lua_pop(L, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Sven-Hendrik Haase <[email protected]> | |
# Contributor: Jurica Bradarić <[email protected]> | |
# Contributor: jprjr <[email protected]> | |
pkgname=('libluv' 'lua-luv' 'lua51-luv' 'lua52-luv' 'lua53-luv') | |
pkgbase=libluv | |
pkgver=1.43.0_0_nog | |
_pkgver=1.43.0-0 | |
pkgrel=2 | |
pkgdesc='Bare libuv bindings for lua (Patched for crashing)' | |
arch=('x86_64') | |
url='https://github.com/luvit/luv' | |
license=('APACHE') | |
depends=('libuv') | |
makedepends=('cmake' 'libuv' 'ninja' 'luajit' 'lua>=5.4.0' 'lua<5.5.0' 'lua51' 'lua52' 'lua53') | |
source=("https://github.com/luvit/luv/releases/download/${_pkgver}/luv-${_pkgver}.tar.gz" "opendir-race-condition-fix.diff") | |
sha256sums=('567a6f3dcdcf8a9b54ddc57ffef89d1e950d72832b85ee81c8c83a9d4e0e9de2' | |
'ee3cc69e88f7b502cf0c8c34091c768c5c5802792481f2614eb9695d4eadb094') | |
prepare() { | |
cd "luv-${_pkgver}/" | |
patch -p1 -i ../opendir-race-condition-fix.diff | |
} | |
build() { | |
# build per-lua versions | |
for ver in 5.1 5.2 5.3 5.4; do | |
incdir="/usr/include/lua${ver}" | |
if [ "$ver" = "5.4" ] ; then | |
incdir="/usr/include" | |
fi | |
cmake -GNinja \ | |
-Bbuild-lua${ver//./} \ | |
-DLUA=/usr/bin/lua${ver} \ | |
-DLUA_INCDIR=${incdir} \ | |
-DLUADIR=/usr/share/lua/${ver} \ | |
-DLIBDIR=/usr/lib/lua/${ver} \ | |
-DWITH_SHARED_LIBUV=ON \ | |
-DLUA_BUILD_TYPE=System \ | |
-DCMAKE_INSTALL_PREFIX=/usr \ | |
"luv-${_pkgver}" | |
ninja -C "build-lua${ver//./}" | |
done | |
# build shared library version | |
cmake -GNinja \ | |
-Bbuild \ | |
-DWITH_SHARED_LIBUV=ON \ | |
-DLUA_BUILD_TYPE=System \ | |
-DBUILD_MODULE=OFF \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DCMAKE_INSTALL_PREFIX=/usr \ | |
"luv-${_pkgver}" | |
ninja -C "build" | |
} | |
package_libluv() { | |
depends+=('luajit') | |
provides+=('libluv') | |
DESTDIR="${pkgdir}" ninja -C "build" install | |
} | |
package_lua-luv() { | |
pkgdesc+=' - Lua module' | |
depends+=('lua') | |
DESTDIR="${pkgdir}" ninja -C "build-lua54" install | |
} | |
package_lua51-luv() { | |
pkgdesc+=' - Lua 5.1 module' | |
depends+=('lua51') | |
DESTDIR="${pkgdir}" ninja -C "build-lua51" install | |
} | |
package_lua52-luv() { | |
pkgdesc+=' - Lua 5.2 module' | |
depends+=('lua52') | |
DESTDIR="${pkgdir}" ninja -C "build-lua52" install | |
} | |
package_lua53-luv() { | |
pkgdesc+=' - Lua 5.3 module' | |
depends+=('lua53') | |
DESTDIR="${pkgdir}" ninja -C "build-lua53" install | |
} | |
# vim:set ts=2 sw=2 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment