[Rpm-maint] [rpm-software-management/rpm] Auto-print returned values from Lua macros (PR #1837)
Michael Schroeder
notifications at github.com
Thu Nov 18 16:32:32 UTC 2021
@mlschroe commented on this pull request.
> rpmlog(RPMLOG_ERR, _("lua script failed: %s\n"),
lua_tostring(L, -1));
lua_pop(L, 1);
goto exit;
}
+
+ int nret = lua_gettop(L) - otop;
+ if (nret > 0 && lua->printbuf)
+ rpm_print(L);
This is a bit dangerous: rpm_print is supposed to be called from lua code run in a protected call. It may call error out for various reasons, e.g. a __tostring handler crashing. This will lead to a abort(). Maybe doing a print pcall is safer.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1837#pullrequestreview-810168946
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20211118/c56ec436/attachment.html>
More information about the Rpm-maint
mailing list