[Tarantool-patches] [PATCH] build: disable LUAJIT_ENABLE_PAIRSMM
Igor Munkin
imun at tarantool.org
Thu Feb 20 18:20:34 MSK 2020
Since this build flag has been removed as a result of reverting the
tarantool/luajit at d4e985a, its definition in the corresponding Tarantool
cmake file is irrelevant.
Furthermore, considering the breakage faced in #4770 the following tests
are introduced:
* the check whether space __pairs metamethod is set to space.pairs to
create a Lua Fun iterator that handles __pairs manually underneath.
* the check whether pairs builtin behaviour doesn't change when __pairs
is set e.g. on space object.
Follow-up #4560
Closes #4770
Signed-off-by: Igor Munkin <imun at tarantool.org>
---
Issue: https://github.com/tarantool/tarantool/issues/4770
Branch: https://github.com/tarantool/tarantool/tree/imun/gh-4770-broken-pairs
@ChangeLog (need to be added to already released versions):
| The feature is removed since we faced the issues with the backward
| compatibility between Lua 5.1 and Lua 5.2 within Tarantool modules as
| well as other third party code (see #4770).
cmake/luajit.cmake | 1 -
test/box/misc.result | 40 ++++++++++++++++++++++++++++++++++++++++
test/box/misc.test.lua | 15 +++++++++++++++
3 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake
index 072db8269..10df633d5 100644
--- a/cmake/luajit.cmake
+++ b/cmake/luajit.cmake
@@ -217,7 +217,6 @@ macro(luajit_build)
add_definitions(-DLUAJIT_USE_ASAN=1)
set (luajit_ldflags ${luajit_ldflags} -fsanitize=address)
endif()
- add_definitions(-DLUAJIT_ENABLE_PAIRSMM=1)
add_definitions(-DLUAJIT_SMART_STRINGS=1)
# Add all COMPILE_DEFINITIONS to xcflags
get_property(defs DIRECTORY PROPERTY COMPILE_DEFINITIONS)
diff --git a/test/box/misc.result b/test/box/misc.result
index 5ac5e0f26..6fc035171 100644
--- a/test/box/misc.result
+++ b/test/box/misc.result
@@ -1431,3 +1431,43 @@ test_run:grep_log('default', 'test log')
---
- test log
...
+--
+-- gh-4770: Iteration through space with Lua builtin pairs routine
+--
+box.cfg{}
+---
+...
+s = box.schema.create_space('test')
+---
+...
+-- Check whether __pairs is set for the space object, since Lua Fun
+-- handles it manually underneath.
+getmetatable(s).__pairs == space.pairs
+---
+- true
+...
+-- Check whether pairs builtin behaviour doesn't change when the
+-- __pairs is set.
+keys = {}
+---
+...
+for k, v in pairs(s) do keys[k] = true end
+---
+...
+keys
+---
+- engine: true
+ before_replace: true
+ field_count: true
+ id: true
+ on_replace: true
+ temporary: true
+ index: true
+ is_local: true
+ enabled: true
+ name: true
+ ck_constraint: true
+...
+s:drop()
+---
+...
diff --git a/test/box/misc.test.lua b/test/box/misc.test.lua
index e1c2f990f..1c8ec95eb 100644
--- a/test/box/misc.test.lua
+++ b/test/box/misc.test.lua
@@ -415,3 +415,18 @@ tuple_format = box.internal.new_tuple_format(format)
box.cfg{}
local ffi = require'ffi' ffi.C._say(ffi.C.S_WARN, nil, 0, nil, "%s", "test log")
test_run:grep_log('default', 'test log')
+
+--
+-- gh-4770: Iteration through space with Lua builtin pairs routine
+--
+box.cfg{}
+s = box.schema.create_space('test')
+-- Check whether __pairs is set for the space object, since Lua Fun
+-- handles it manually underneath.
+getmetatable(s).__pairs == space.pairs
+-- Check whether pairs builtin behaviour doesn't change when the
+-- __pairs is set.
+keys = {}
+for k, v in pairs(s) do keys[k] = true end
+keys
+s:drop()
--
2.25.0
More information about the Tarantool-patches
mailing list