xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 65d450fb9ae96ed058d10e7de8e1ca2f0ccffdb4

Fix abort on running Lua handler in -DNDEBUG build
A non-debug code was run in an assert() leading to the handler not being
extracted at all. This in turn resulted in erroneous use of Lua values
ending up in an abort.

Thanks to Michał Majchrowicz and Marcin Wyczechowski.
Author: xaizek
Author date (UTC): 2026-05-16 15:04
Committer name: xaizek
Committer date (UTC): 2026-05-16 15:04
Parent(s): cf626290b6ec2265af5ee6709dbb3b4437373639
Signing key: 99DC5E4DB05F6BE2
Tree: d3199851653570ad1254ab9a5502ced867df05f9
File Lines added Lines deleted
ChangeLog.LuaAPI 3 0
src/lua/vifm_handlers.c 16 8
File ChangeLog.LuaAPI changed (mode: 100644) (index 772ed4a23..09939dd40)
... ... documented in the regular ChangeLog.
22 22 Fixed a crash on passing a value that's not convertible to a string to Fixed a crash on passing a value that's not convertible to a string to
23 23 vifm.menus.loadcustom(). Thanks to PRESFIL. Patch by Kirill Rekhov. vifm.menus.loadcustom(). Thanks to PRESFIL. Patch by Kirill Rekhov.
24 24
25 Fixed abort on running handlers if the code is built with -DNDEBUG.
26 Thanks to Michał Majchrowicz and Marcin Wyczechowski.
27
25 28 0.13 to 0.14-beta (2025-01-19) 0.13 to 0.14-beta (2025-01-19)
26 29
27 30 Bumped API version to v0.2.0. Bumped API version to v0.2.0.
File src/lua/vifm_handlers.c changed (mode: 100644) (index ec3e913dc..5672419a3)
... ... vifm_handlers_view(vlua_t *vlua, const char viewer[], const char path[],
100 100
101 101 free(name); free(name);
102 102
103 assert(lua_getfield(vlua->lua, -1, "handler") == LUA_TFUNCTION &&
104 "Handler must be a function here.");
103 if(lua_getfield(vlua->lua, -1, "handler") != LUA_TFUNCTION)
104 {
105 assert(0 && "A handler is not a function.");
106 }
105 107
106 108 lua_createtable(vlua->lua, /*narr=*/0, /*nrec=*/6); lua_createtable(vlua->lua, /*narr=*/0, /*nrec=*/6);
107 109 lua_pushstring(vlua->lua, viewer); lua_pushstring(vlua->lua, viewer);
 
... ... vifm_handlers_open(vlua_t *vlua, const char prog[], const dir_entry_t *entry)
176 178
177 179 free(name); free(name);
178 180
179 assert(lua_getfield(vlua->lua, -1, "handler") == LUA_TFUNCTION &&
180 "Handler must be a function here.");
181 if(lua_getfield(vlua->lua, -1, "handler") != LUA_TFUNCTION)
182 {
183 assert(0 && "A handler is not a function.");
184 }
181 185
182 186 lua_createtable(vlua->lua, /*narr=*/0, /*nrec=*/2); lua_createtable(vlua->lua, /*narr=*/0, /*nrec=*/2);
183 187 lua_pushstring(vlua->lua, prog); lua_pushstring(vlua->lua, prog);
 
... ... run_format_handler(vlua_t *vlua, const char handler[])
249 253
250 254 free(name); free(name);
251 255
252 assert(lua_getfield(vlua->lua, -1, "handler") == LUA_TFUNCTION &&
253 "Handler must be a function here.");
256 if(lua_getfield(vlua->lua, -1, "handler") != LUA_TFUNCTION)
257 {
258 assert(0 && "A handler is not a function.");
259 }
254 260
255 261 lua_pushvalue(vlua->lua, -4); lua_pushvalue(vlua->lua, -4);
256 262
 
... ... run_editor_handler(vlua_t *vlua, const char handler[])
393 399
394 400 free(name); free(name);
395 401
396 assert(lua_getfield(vlua->lua, -1, "handler") == LUA_TFUNCTION &&
397 "Handler must be a function here.");
402 if(lua_getfield(vlua->lua, -1, "handler") != LUA_TFUNCTION)
403 {
404 assert(0 && "A handler is not a function.");
405 }
398 406
399 407 lua_pushvalue(vlua->lua, -4); lua_pushvalue(vlua->lua, -4);
400 408
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master