diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2016-11-30 10:59:52 +0100 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2016-11-30 11:17:55 +0100 |
commit | 4237b5875d9775c20fbbe8cacf202c0b3d0d46d7 (patch) | |
tree | d6e9c3ca7504740aa013c505b2e2413dc3e30d30 /daemon | |
parent | Merge !81: travis: fix pip bootstrap (diff) | |
download | knot-resolver-4237b5875d9775c20fbbe8cacf202c0b3d0d46d7.tar.xz knot-resolver-4237b5875d9775c20fbbe8cacf202c0b3d0d46d7.zip |
Revert "lua: embed bytecode instead of stripped source"
This reverts commit 64f80706fbe428e4a93ac92f22cf6f5905a1e977.
TL;DR: it brought almost no benefits AFAIK and potential for problems.
The "portable bytecode" produced by luajit isn't compatible when
(lib)luajit version changes or when some build-time configuration of it
changes. If you mix these up, kresd fails to start.
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/daemon.mk | 2 | ||||
-rw-r--r-- | daemon/engine.c | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/daemon/daemon.mk b/daemon/daemon.mk index 583e2830..fcdbde5b 100644 --- a/daemon/daemon.mk +++ b/daemon/daemon.mk @@ -12,7 +12,7 @@ kresd_DIST := daemon/lua/kres.lua daemon/lua/trust_anchors.lua # Embedded resources %.inc: %.lua - @$(call quiet,LUA,$<) $< $@ + @$(call quiet,XXD_LUA,$<) $< > $@ ifeq ($(AMALG), yes) kresd.amalg.c: daemon/lua/sandbox.inc daemon/lua/config.inc else diff --git a/daemon/engine.c b/daemon/engine.c index 551d7bb3..1751855d 100644 --- a/daemon/engine.c +++ b/daemon/engine.c @@ -690,9 +690,10 @@ static int engine_loadconf(struct engine *engine, const char *config_path) lua_pop(engine->L, 1); } /* Init environment */ - #include "daemon/lua/sandbox.inc" - if (l_dobytecode(engine->L, luaJIT_BC_sandbox, - sizeof(luaJIT_BC_sandbox), "init") != 0) { + static const char sandbox_bytecode[] = { + #include "daemon/lua/sandbox.inc" + }; + if (l_dobytecode(engine->L, sandbox_bytecode, sizeof(sandbox_bytecode), "init") != 0) { fprintf(stderr, "[system] error %s\n", lua_tostring(engine->L, -1)); lua_pop(engine->L, 1); return kr_error(ENOEXEC); @@ -706,9 +707,10 @@ static int engine_loadconf(struct engine *engine, const char *config_path) } if (ret == 0) { /* Load defaults */ - #include "daemon/lua/config.inc" - ret = l_dobytecode(engine->L, luaJIT_BC_config, - sizeof(luaJIT_BC_config), "config"); + static const char config_bytecode[] = { + #include "daemon/lua/config.inc" + }; + ret = l_dobytecode(engine->L, config_bytecode, sizeof(config_bytecode), "config"); } /* Evaluate */ |