Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
games/xnethack: fix behaviour with mismatched lua version
The latest version of the package has introduced a "lua sandbox" that comes with a version check against the bundled lua version. As we unbundle lua, we cannot ensure that this version check succeeds. Removal of the version check allows us to build a working binary, but it is uncertain if there are any residual effects from the version mismatch. To rule out that possibility, the sandbox code is left disabled by default but can be enabled if desired through the SANDBOX option. PR: 264882
- Loading branch information
1 parent
048b2cb
commit 4f055da
Showing
3 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
As we unbundle lua, we cannot ensure that this version check succeeds. | ||
Removal of the version check allows us to build a working binary, but | ||
it is uncertain if there are any residual effects from the version | ||
mismatch. | ||
|
||
To rule out that possibility, the sandbox code is left disabled by | ||
default but can be enabled if desired through the SANDBOX option. | ||
|
||
--- src/nhlua.c.orig 2022-06-25 04:31:43 UTC | ||
+++ src/nhlua.c | ||
@@ -1652,20 +1652,6 @@ DISABLE_WARNING_CONDEXPR_IS_CONSTANT | ||
lua_State * | ||
nhl_init(nhl_sandbox_info *sbi) | ||
{ | ||
- /* It would be nice to import EXPECTED from each build system. XXX */ | ||
- /* And it would be nice to do it only once, but it's cheap. */ | ||
-#ifndef NHL_VERSION_EXPECTED | ||
-#define NHL_VERSION_EXPECTED 50404 | ||
-#endif | ||
- | ||
-#ifdef NHL_SANDBOX | ||
- if(NHL_VERSION_EXPECTED != LUA_VERSION_RELEASE_NUM){ | ||
- panic( | ||
- "sandbox doesn't know this Lua version: this=%d != expected=%d ", | ||
- LUA_VERSION_RELEASE_NUM, NHL_VERSION_EXPECTED); | ||
- } | ||
-#endif | ||
- | ||
lua_State *L = nhlL_newstate(sbi); | ||
|
||
iflags.in_lua = TRUE; | ||
@@ -2348,7 +2334,7 @@ nhlL_newstate (nhl_sandbox_info *sbi) { | ||
} | ||
|
||
lua_State *L = lua_newstate(nhl_alloc, nud); | ||
-#if LUA_VERSION_NUM == 503 | ||
+#ifndef luai_likely | ||
# define luai_likely(x) (x) | ||
#endif | ||
if (luai_likely(L)) { |