diff --git a/.gitignore b/.gitignore index dd10f178d0822700c6a3a902db2317d3caef8f66..f361e10b8a97ae28dffd7e517676dd0836973bf1 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,10 @@ connector/c/tntsql/libtarantoolsql.so.1 connector/c/tntsql/libtarantoolsql.so.1.1 connector/c/tntrpl/libtarantoolrpl.so.1 connector/c/tntrpl/libtarantoolrpl.so.1.1 +src/box/00000000000000000001.snap +src/box/tarantool.cfg +test/connector_c/tp +test/unit/bit_test +test/unit/bitset_basic_test +test/unit/bitset_index_test +test/unit/bitset_iterator_test diff --git a/src/lua/init.m b/src/lua/init.m index 1afd9ba0ea56d57eae7e2747fe5016448c9ef071..2e8a2858142bfad435ca0b923daed48a0ac77dfe 100644 --- a/src/lua/init.m +++ b/src/lua/init.m @@ -837,9 +837,11 @@ tarantool_lua_printstack_yaml(struct lua_State *L, struct tbuf *out) int top = lua_gettop(L); for (int i = 1; i <= top; i++) { if (lua_type(L, i) == LUA_TCDATA) { + GCcdata *cd = cdataV(L->base + i - 1); const char *sz = tarantool_lua_tostring(L, i); int len = strlen(sz); - tbuf_printf(out, " - %-.*s" CRLF, len - 3, sz); + int chop = (cd->typeid == CTID_UINT64 ? 3 : 2); + tbuf_printf(out, " - %-.*s" CRLF, len - chop, sz); } else tbuf_printf(out, " - %s" CRLF, tarantool_lua_tostring(L, i)); @@ -856,9 +858,11 @@ tarantool_lua_printstack(struct lua_State *L, struct tbuf *out) int top = lua_gettop(L); for (int i = 1; i <= top; i++) { if (lua_type(L, i) == LUA_TCDATA) { + GCcdata *cd = cdataV(L->base + i - 1); const char *sz = tarantool_lua_tostring(L, i); int len = strlen(sz); - tbuf_printf(out, "%-.*s" CRLF, len - 3, sz); + int chop = (cd->typeid == CTID_UINT64 ? 3 : 2); + tbuf_printf(out, "%-.*s" CRLF, len - chop, sz); } else tbuf_printf(out, "%s", tarantool_lua_tostring(L, i)); } diff --git a/test/box/lua.result b/test/box/lua.result index 5ee7f36e844f01957c4a2f593cadecf156b588f1..c5fe6150248deb431d47fd495b2ac41b006397ca 100644 --- a/test/box/lua.result +++ b/test/box/lua.result @@ -1783,3 +1783,36 @@ lua t[2], t[3], t[4], t[5] lua box.space[0]:truncate() --- ... +# A test case for Bug#1131108 'tonumber64 from negative int inconsistency' +lua tonumber64(-1) +--- + - 18446744073709551615 +... +lua tonumber64(-1LL) +--- + - 18446744073709551615 +... +lua tonumber64(-1ULL) +--- + - 18446744073709551615 +... +lua -1 +--- + - -1 +... +lua -1LL +--- + - -1 +... +lua -1ULL +--- + - 18446744073709551615 +... +lua tonumber64(-1.0) +--- + - 18446744073709551615 +... +lua 6LL - 7LL +--- + - -1 +... diff --git a/test/box/lua.test b/test/box/lua.test index 3f7f9851f590edc390ace33dc0195c83d5efe680..c7d725dfca5cf7932b36cefea551313c1dcc8cea 100644 --- a/test/box/lua.test +++ b/test/box/lua.test @@ -593,3 +593,12 @@ print """# A test case for tuple:totable() method""" exec admin "lua t=box.select(0, 0, 777):totable()" exec admin "lua t[2], t[3], t[4], t[5]" exec admin "lua box.space[0]:truncate()" +print """# A test case for Bug#1131108 'tonumber64 from negative int inconsistency'""" +exec admin "lua tonumber64(-1)" +exec admin "lua tonumber64(-1LL)" +exec admin "lua tonumber64(-1ULL)" +exec admin "lua -1" +exec admin "lua -1LL" +exec admin "lua -1ULL" +exec admin "lua tonumber64(-1.0)" +exec admin "lua 6LL - 7LL"