Skip to content

Commit

Permalink
[Minor] Lua_task: Log when an unknown symbol is inserted from Lua
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Jun 11, 2020
1 parent f6b8d1a commit b2d80e6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/lua/lua_task.c
Expand Up @@ -1944,6 +1944,15 @@ lua_task_insert_result_common (lua_State * L, struct rspamd_scan_result *result,

/* Get additional options */
if (s) {
if (s->sym == NULL) {
/* Unknown symbol, print traceback */
lua_pushfstring (L, "unknown symbol %s", symbol_name);
rspamd_lua_traceback (L);

msg_info_task ("symbol insertion issue: %s", lua_tostring (L, -1));

lua_pop (L, 1); /* Traceback string */
}
for (i = args_start + 2; i <= top; i++) {
gint ltype = lua_type (L, i);

Expand Down Expand Up @@ -2013,6 +2022,14 @@ lua_task_insert_result_common (lua_State * L, struct rspamd_scan_result *result,
}
}
}
else {
lua_pushfstring (L, "insertion failed for %s", symbol_name);
rspamd_lua_traceback (L);

msg_info_task ("symbol insertion issue: %s", lua_tostring (L, -1));

lua_pop (L, 2); /* Traceback string + error string */
}

}
else {
Expand Down

0 comments on commit b2d80e6

Please sign in to comment.