Hello community, here is the log from the commit of package lua54 for openSUSE:Factory checked in at 2020-12-08 13:23:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lua54 (Old) and /work/SRC/openSUSE:Factory/.lua54.new.5913 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lua54" Tue Dec 8 13:23:40 2020 rev:6 rq:853274 version:5.4.2 Changes: -------- --- /work/SRC/openSUSE:Factory/lua54/lua54.changes 2020-10-12 13:46:52.197910487 +0200 +++ /work/SRC/openSUSE:Factory/.lua54.new.5913/lua54.changes 2020-12-08 13:25:19.526662244 +0100 @@ -1,0 +2,7 @@ +Sat Dec 5 12:48:18 UTC 2020 - Callum Farmer <[email protected]> + +- Update to version 5.4.2: + * Fixes garbage collection bug +- Add main_test.patch: fix bug in main.lua test + +------------------------------------------------------------------- Old: ---- lua-5.4.1-tests.tar.gz lua-5.4.1.tar.gz New: ---- lua-5.4.2-tests.tar.gz lua-5.4.2.tar.gz main_test.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lua54.spec ++++++ --- /var/tmp/diff_new_pack.IEJY3j/_old 2020-12-08 13:25:20.298664446 +0100 +++ /var/tmp/diff_new_pack.IEJY3j/_new 2020-12-08 13:25:20.302664458 +0100 @@ -19,7 +19,7 @@ %define major_version 5.4 %define libname liblua5_4-5 Name: lua54 -Version: 5.4.1 +Version: 5.4.2 Release: 0 Summary: Small Embeddable Language with Procedural Syntax License: MIT @@ -34,8 +34,9 @@ # Fix failing test Patch1: attrib_test.patch Patch2: files_test.patch -# PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html#5.4.1 -#Patch3: upstream-bugs.patch +Patch3: main_test.patch +# PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html#5.4.2 +#Patch4: upstream-bugs.patch BuildRequires: libtool BuildRequires: lua-macros BuildRequires: pkgconfig @@ -122,7 +123,9 @@ of C functions, written in ANSI C. %prep -%autosetup -n lua-%{version} -p1 -a1 +%setup -q -n lua-%{version} -a1 +mv lua-%{version}-tests lua-tests +%autopatch -p1 # manpage cat doc/lua.1 | sed 's/TH LUA 1/TH LUA%{major_version} 1/' > doc/lua%{major_version}.1 @@ -184,7 +187,7 @@ ln -sf %{_sysconfdir}/alternatives/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc %check -cd ./lua-%{version}-tests/ +cd ./lua-tests/ LD_LIBRARY_PATH=%{buildroot}%{_libdir} %{buildroot}%{_bindir}/lua%{major_version} all.lua %post -n %{libname} -p /sbin/ldconfig ++++++ attrib_test.patch ++++++ --- /var/tmp/diff_new_pack.IEJY3j/_old 2020-12-08 13:25:20.330664538 +0100 +++ /var/tmp/diff_new_pack.IEJY3j/_new 2020-12-08 13:25:20.334664549 +0100 @@ -1,5 +1,5 @@ ---- a/lua-5.4.1-tests/attrib.lua -+++ b/lua-5.4.1-tests/attrib.lua +--- a/lua-tests/attrib.lua ++++ b/lua-tests/attrib.lua @@ -269,7 +269,7 @@ local p = "" -- On Mac OS X, redefine local st, err, when = package.loadlib(DC"lib1", "*") if not st then ++++++ files_test.patch ++++++ --- /var/tmp/diff_new_pack.IEJY3j/_old 2020-12-08 13:25:20.354664606 +0100 +++ /var/tmp/diff_new_pack.IEJY3j/_new 2020-12-08 13:25:20.354664606 +0100 @@ -1,7 +1,7 @@ -Index: lua-5.4.1/lua-5.4.1-tests/files.lua +Index: lua/lua-tests/files.lua =================================================================== ---- lua-5.4.1.orig/lua-5.4.1-tests/files.lua -+++ lua-5.4.1/lua-5.4.1-tests/files.lua +--- lua.orig/lua-tests/files.lua ++++ lua/lua-tests/files.lua @@ -81,7 +81,7 @@ assert(io.output() ~= io.stdout) if not _port then -- invalid seek ++++++ lua-5.4.1-tests.tar.gz -> lua-5.4.2-tests.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/all.lua new/lua-5.4.2-tests/all.lua --- old/lua-5.4.1-tests/all.lua 2020-09-30 11:36:52.000000000 +0200 +++ new/lua-5.4.2-tests/all.lua 2020-11-13 16:32:02.000000000 +0100 @@ -127,8 +127,8 @@ end Cstacklevel = function () - local _, _, ncalls, nci = T.stacklevel() - return ncalls + nci -- number of free slots in the C stack + local _, _, ncalls = T.stacklevel() + return ncalls -- number of C calls end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/closure.lua new/lua-5.4.2-tests/closure.lua --- old/lua-5.4.1-tests/closure.lua 2020-09-30 11:36:53.000000000 +0200 +++ new/lua-5.4.2-tests/closure.lua 2020-11-13 16:32:03.000000000 +0100 @@ -242,7 +242,7 @@ assert(debug.upvalueid(foo1, 1)) assert(debug.upvalueid(foo1, 2)) -assert(not pcall(debug.upvalueid, foo1, 3)) +assert(not debug.upvalueid(foo1, 3)) assert(debug.upvalueid(foo1, 1) == debug.upvalueid(foo2, 2)) assert(debug.upvalueid(foo1, 2) == debug.upvalueid(foo2, 1)) assert(debug.upvalueid(foo3, 1)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/code.lua new/lua-5.4.2-tests/code.lua --- old/lua-5.4.1-tests/code.lua 2020-09-30 11:36:53.000000000 +0200 +++ new/lua-5.4.2-tests/code.lua 2020-11-13 16:32:03.000000000 +0100 @@ -392,28 +392,6 @@ end, 'TEST', 'JMP', 'TEST', 'JMP', 'ADDI', 'MMBINI', 'JMP', 'RETURN0') -checkequal( -function (a) while a < 10 do a = a + 1 end end, -function (a) - ::loop:: - if not (a < 10) then goto exit end - a = a + 1 - goto loop -::exit:: -end -) - -checkequal( -function (a) repeat local x = a + 1; a = x until a > 0 end, -function (a) - ::loop:: do - local x = a + 1 - a = x - end - if not (a > 0) then goto loop end -end -) - checkequal(function () return 6 or true or nil end, function () return k6 or kTrue or kNil end) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/coroutine.lua new/lua-5.4.2-tests/coroutine.lua --- old/lua-5.4.1-tests/coroutine.lua 2020-09-30 11:36:53.000000000 +0200 +++ new/lua-5.4.2-tests/coroutine.lua 2020-11-13 16:32:03.000000000 +0100 @@ -124,6 +124,11 @@ -- coroutine closing + +local function func2close (f) + return setmetatable({}, {__close = f}) +end + do -- ok to close a dead coroutine local co = coroutine.create(print) @@ -146,10 +151,6 @@ -- to-be-closed variables in coroutines local X - local function func2close (f) - return setmetatable({}, {__close = f}) - end - co = coroutine.create(function () local x <close> = func2close(function (self, err) assert(err == nil); X = false @@ -192,6 +193,23 @@ end +do + -- <close> versus pcall in coroutines + local X = false + local Y = false + function foo () + local x <close> = func2close(function (self, err) + Y = debug.getinfo(2) + X = err + end) + error(43) + end + co = coroutine.create(function () return pcall(foo) end) + local st1, st2, err = coroutine.resume(co) + assert(st1 and not st2 and err == 43) + assert(X == 43 and Y.name == "pcall") +end + -- yielding across C boundaries diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/cstack.lua new/lua-5.4.2-tests/cstack.lua --- old/lua-5.4.1-tests/cstack.lua 2020-09-30 11:36:53.000000000 +0200 +++ new/lua-5.4.2-tests/cstack.lua 2020-11-13 16:32:03.000000000 +0100 @@ -1,73 +1,29 @@ -- $Id: testes/cstack.lua $ -- See Copyright Notice in file all.lua -local debug = require "debug" -print"testing C-stack overflow detection" -print"If this test crashes, see its file ('cstack.lua')" +print"testing stack overflow detection" -- Segmentation faults in these tests probably result from a C-stack --- overflow. To avoid these errors, you can use the function --- 'debug.setcstacklimit' to set a smaller limit for the use of --- C stack by Lua. After finding a reliable limit, you might want --- to recompile Lua with this limit as the value for --- the constant 'LUAI_MAXCCALLS', which defines the default limit. --- (The default limit is printed by this test.) +-- overflow. To avoid these errors, you should set a smaller limit for +-- the use of C stack by Lua, by changing the constant 'LUAI_MAXCCALLS'. -- Alternatively, you can ensure a larger stack for the program. --- For Linux, a limit up to 30_000 seems Ok. Windows cannot go much --- higher than 2_000. - - --- get and print original limit -local origlimit <const> = debug.setcstacklimit(400) -print("default stack limit: " .. origlimit) - - --- Do the tests using the original limit. Or else you may want to change --- 'currentlimit' to lower values to avoid a seg. fault or to higher --- values to check whether they are reliable. -local currentlimit <const> = origlimit -debug.setcstacklimit(currentlimit) -print("current stack limit: " .. currentlimit) - local function checkerror (msg, f, ...) local s, err = pcall(f, ...) assert(not s and string.find(err, msg)) end --- auxiliary function to keep 'count' on the screen even if the program --- crashes. -local count -local back = string.rep("\b", 8) -local function progress () - count = count + 1 - local n = string.format("%-8d", count) - io.stderr:write(back, n) -- erase previous value and write new one -end - - -do print("testing simple recursion:") - count = 0 - local function foo () - progress() - foo() -- do recursive calls until a stack error (or crash) - end - checkerror("stack overflow", foo) - print("\tfinal count: ", count) -end - - do print("testing stack overflow in message handling") - count = 0 + local count = 0 local function loop (x, y, z) - progress() + count = count + 1 return 1 + loop(x, y, z) end local res, msg = xpcall(loop, loop) assert(msg == "error in error handling") - print("\tfinal count: ", count) + print("final count: ", count) end @@ -80,97 +36,114 @@ end local m = f(80) assert(#m == 80) - checkerror("too complex", f, 200000) + checkerror("too complex", f, 2000) end do print("testing stack-overflow in recursive 'gsub'") - count = 0 + local count = 0 local function foo () - progress() + count = count + 1 string.gsub("a", ".", foo) end checkerror("stack overflow", foo) - print("\tfinal count: ", count) + print("final count: ", count) print("testing stack-overflow in recursive 'gsub' with metatables") - count = 0 + local count = 0 local t = setmetatable({}, {__index = foo}) foo = function () count = count + 1 - progress(count) string.gsub("a", ".", t) end checkerror("stack overflow", foo) - print("\tfinal count: ", count) + print("final count: ", count) end + do -- bug in 5.4.0 print("testing limits in coroutines inside deep calls") - count = 0 + local count = 0 local lim = 1000 local function stack (n) - progress() if n > 0 then return stack(n - 1) + 1 else coroutine.wrap(function () + count = count + 1 stack(lim) end)() end end - print(xpcall(stack, function () return "ok" end, lim)) + local st, msg = xpcall(stack, function () return "ok" end, lim) + assert(not st and msg == "ok") + print("final count: ", count) end -do print("testing changes in C-stack limit") +do + print("nesting of resuming yielded coroutines") + local count = 0 + + local function body () + coroutine.yield() + local f = coroutine.wrap(body) + f(); -- start new coroutine (will stop in previous yield) + count = count + 1 + f() -- call it recursively + end - -- Just an alternative limit, different from the current one - -- (smaller to avoid stack overflows) - local alterlimit <const> = currentlimit * 8 // 10 - - assert(not debug.setcstacklimit(0)) -- limit too small - assert(not debug.setcstacklimit(50000)) -- limit too large - local co = coroutine.wrap (function () - return debug.setcstacklimit(alterlimit) - end) - assert(not co()) -- cannot change C stack inside coroutine - - local n - local function foo () n = n + 1; foo () end - - local function check () - n = 0 - pcall(foo) - return n - end - - -- set limit to 'alterlimit' - assert(debug.setcstacklimit(alterlimit) == currentlimit) - local limalter <const> = check() - -- set a very low limit (given that there are already several active - -- calls to arrive here) - local lowlimit <const> = 38 - assert(debug.setcstacklimit(lowlimit) == alterlimit) - -- usable limit is much lower, due to active calls - local actuallow = check() - assert(actuallow < lowlimit - 30) - -- now, add 'lowlimit' extra slots, which should all be available - assert(debug.setcstacklimit(lowlimit + lowlimit) == lowlimit) - local lim2 <const> = check() - assert(lim2 == actuallow + lowlimit) - - - -- 'setcstacklimit' works inside protected calls. (The new stack - -- limit is kept when 'pcall' returns.) - assert(pcall(function () - assert(debug.setcstacklimit(alterlimit) == lowlimit * 2) - assert(check() <= limalter) - end)) - - assert(check() == limalter) - -- restore original limit - assert(debug.setcstacklimit(origlimit) == alterlimit) + local f = coroutine.wrap(body) + f() + assert(not pcall(f)) + print("final count: ", count) end +if T then + print("testing stack recovery") + local N = 0 -- trace number of calls + local LIM = -1 -- will store N just before stack overflow + + -- trace stack size; after stack overflow, it should be + -- the maximum allowed stack size. + local stack1 + local dummy + + local function err(msg) + assert(string.find(msg, "stack overflow")) + local _, stacknow = T.stacklevel() + assert(stacknow == stack1 + 200) + end + + -- When LIM==-1, the 'if' is not executed, so this function only + -- counts and stores the stack limits up to overflow. Then, LIM + -- becomes N, and then the 'if' code is run when the stack is + -- full. Then, there is a stack overflow inside 'xpcall', after which + -- the stack must have been restored back to its maximum normal size. + local function f() + dummy, stack1 = T.stacklevel() + if N == LIM then + xpcall(f, err) + local _, stacknow = T.stacklevel() + assert(stacknow == stack1) + return + end + N = N + 1 + f() + end + + local topB, sizeB -- top and size Before overflow + local topA, sizeA -- top and size After overflow + topB, sizeB = T.stacklevel() + xpcall(f, err) + topA, sizeA = T.stacklevel() + -- sizes should be comparable + assert(topA == topB and sizeA < sizeB * 2) + print(string.format("maximum stack size: %d", stack1)) + LIM = N -- will stop recursion at maximum level + N = 0 -- to count again + f() + print"+" +end + print'OK' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/db.lua new/lua-5.4.2-tests/db.lua --- old/lua-5.4.1-tests/db.lua 2020-09-30 11:36:53.000000000 +0200 +++ new/lua-5.4.2-tests/db.lua 2020-11-13 16:32:03.000000000 +0100 @@ -119,6 +119,16 @@ end ]], {2,3,4,7}) +test([[ +local function foo() +end +foo() +A = 1 +A = 2 +A = 3 +]], {2, 3, 2, 4, 5, 6}) + + test([[-- if nil then a=1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/errors.lua new/lua-5.4.2-tests/errors.lua --- old/lua-5.4.1-tests/errors.lua 2020-09-30 11:36:53.000000000 +0200 +++ new/lua-5.4.2-tests/errors.lua 2020-11-13 16:32:03.000000000 +0100 @@ -386,25 +386,33 @@ collectgarbage() print"testing stack overflow" C = 0 - local l = debug.getinfo(1, "l").currentline; function y () C=C+1; y() end + -- get line where stack overflow will happen + local l = debug.getinfo(1, "l").currentline + 1 + local function auxy () C=C+1; auxy() end -- produce a stack overflow + function y () + collectgarbage("stop") -- avoid running finalizers without stack space + auxy() + collectgarbage("restart") + end local function checkstackmessage (m) + print("(expected stack overflow after " .. C .. " calls)") + C = 0 -- prepare next count return (string.find(m, "stack overflow")) end -- repeated stack overflows (to check stack recovery) assert(checkstackmessage(doit('y()'))) - print('+') assert(checkstackmessage(doit('y()'))) - print('+') assert(checkstackmessage(doit('y()'))) - print('+') -- error lines in stack overflow - C = 0 local l1 local function g(x) - l1 = debug.getinfo(x, "l").currentline; y() + l1 = debug.getinfo(x, "l").currentline + 2 + collectgarbage("stop") -- avoid running finalizers without stack space + auxy() + collectgarbage("restart") end local _, stackmsg = xpcall(g, debug.traceback, 1) print('+') @@ -530,10 +538,10 @@ if (finalresult) then assert(res() == finalresult) end - s = init .. string.rep(rep, 10000) - local res, msg = load(s) -- 10000 levels not ok - assert(not res and (string.find(msg, "too many registers") or - string.find(msg, "stack overflow"))) + s = init .. string.rep(rep, 500) + local res, msg = load(s) -- 500 levels not ok + assert(not res and (string.find(msg, "too many") or + string.find(msg, "overflow"))) end testrep("local a; a", ",a", "= 1", ",1") -- multiple assignment diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/locals.lua new/lua-5.4.2-tests/locals.lua --- old/lua-5.4.1-tests/locals.lua 2020-09-30 11:36:54.000000000 +0200 +++ new/lua-5.4.2-tests/locals.lua 2020-11-13 16:32:03.000000000 +0100 @@ -246,6 +246,11 @@ X = false foo = function (x) + local _<close> = func2close(function () + -- without errors, enclosing function should be still active when + -- __close is called + assert(debug.getinfo(2).name == "foo") + end) local _<close> = closescope local y = 15 return y @@ -343,6 +348,18 @@ end +-- errors inside __close can generate a warning instead of an +-- error. This new 'assert' force them to appear. +local function assert(cond, msg) + if not cond then + local line = debug.getinfo(2).currentline or "?" + msg = string.format("assertion failed! line %d (%s)\n", line, msg or "") + io.stderr:write(msg) + os.exit(1) + end +end + + local function checkwarn (msg) if T then assert(string.find(_WARN, msg)) @@ -406,11 +423,15 @@ local x <close> = func2close(function (self, msg) + -- after error, 'foo' was discarded, so caller now + -- must be 'pcall' + assert(debug.getinfo(2).name == "pcall") assert(msg == 4) end) local x1 <close> = func2close(function (self, msg) + assert(debug.getinfo(2).name == "pcall") checkwarn("@y") assert(msg == 4) error("@x1") @@ -420,6 +441,7 @@ local y <close> = func2close(function (self, msg) + assert(debug.getinfo(2).name == "pcall") assert(msg == 4) -- error in body checkwarn("@z") error("@y") @@ -428,6 +450,7 @@ local first = true local z <close> = func2close(function (self, msg) + assert(debug.getinfo(2).name == "pcall") -- 'z' close is called once assert(first and msg == 4) first = false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/ltests/ltests.c new/lua-5.4.2-tests/ltests/ltests.c --- old/lua-5.4.1-tests/ltests/ltests.c 2020-09-30 11:36:51.000000000 +0200 +++ new/lua-5.4.2-tests/ltests/ltests.c 2020-11-13 16:32:02.000000000 +0100 @@ -430,17 +430,17 @@ UpVal *uv; lua_assert(!isdead(g, L1)); if (L1->stack == NULL) { /* incomplete thread? */ - lua_assert(L1->stacksize == 0 && L1->openupval == NULL && - L1->ci == NULL); + lua_assert(L1->openupval == NULL && L1->ci == NULL); return; } for (uv = L1->openupval; uv != NULL; uv = uv->u.open.next) lua_assert(upisopen(uv)); /* must be open */ + lua_assert(L1->top <= L1->stack_last); for (ci = L1->ci; ci != NULL; ci = ci->previous) { lua_assert(ci->top <= L1->stack_last); lua_assert(lua_checkpc(ci)); } - for (o = L1->stack; o < L1->stack_last + EXTRA_STACK; o++) + for (o = L1->stack; o < L1->stack_last; o++) checkliveness(L1, s2v(o)); /* entire stack must have valid values */ } @@ -523,7 +523,6 @@ ((void)g); /* better to keep it available if we need to print an object */ while (o) { lua_assert(!!isgray(o) ^ (getage(o) == G_TOUCHED2)); - //lua_assert(isgray(o) || getage(o) == G_TOUCHED2); lua_assert(!testbit(o->marked, TESTBIT)); if (keepinvariant(g)) l_setbit(o->marked, TESTBIT); /* mark that object is in a gray list */ @@ -864,7 +863,7 @@ l_memcontrol.failnext = 1; return 0; } - + static int settrick (lua_State *L) { if (ttisnil(obj_at(L, 1))) @@ -969,7 +968,7 @@ static int stacklevel (lua_State *L) { unsigned long a = 0; lua_pushinteger(L, (L->top - L->stack)); - lua_pushinteger(L, (L->stack_last - L->stack)); + lua_pushinteger(L, stacksize(L)); lua_pushinteger(L, L->nCcalls); lua_pushinteger(L, L->nci); lua_pushinteger(L, (unsigned long)&a); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/ltests/ltests.h new/lua-5.4.2-tests/ltests/ltests.h --- old/lua-5.4.1-tests/ltests/ltests.h 2020-09-30 11:36:51.000000000 +0200 +++ new/lua-5.4.2-tests/ltests/ltests.h 2020-11-13 16:32:02.000000000 +0100 @@ -23,11 +23,6 @@ #define LUAI_ASSERT - -/* compiled with -O0, Lua uses a lot of C stack space... */ -#undef LUAI_MAXCSTACK -#define LUAI_MAXCSTACK 400 - /* to avoid warnings, and to make sure value is really unused */ #define UNUSED(x) (x=0, (void)(x)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/main.lua new/lua-5.4.2-tests/main.lua --- old/lua-5.4.1-tests/main.lua 2020-09-30 11:36:54.000000000 +0200 +++ new/lua-5.4.2-tests/main.lua 2020-11-13 16:32:03.000000000 +0100 @@ -287,6 +287,33 @@ local t = getoutput() assert(string.find(t, prompt .. ".*" .. prompt .. ".*" .. prompt)) +-- using the prompt default +prepfile[[ -- +a = 2 +]] +RUN([[lua -i < %s > %s]], prog, out) +local t = getoutput() +prompt = "> " -- the default +assert(string.find(t, prompt .. ".*" .. prompt .. ".*" .. prompt)) + + +-- non-string prompt +prompt = + "local C = 0;\z + _PROMPT=setmetatable({},{__tostring = function () \z + C = C + 1; return C end})" +prepfile[[ -- +a = 2 +]] +RUN([[lua -e "%s" -i < %s > %s]], prompt, prog, out) +local t = getoutput() +assert(string.find(t, [[ +1 -- +2a = 2 +3 +]], 1, true)) + + -- test for error objects prepfile[[ debug = require "debug" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lua-5.4.1-tests/nextvar.lua new/lua-5.4.2-tests/nextvar.lua --- old/lua-5.4.1-tests/nextvar.lua 2020-09-30 11:36:54.000000000 +0200 +++ new/lua-5.4.2-tests/nextvar.lua 2020-11-13 16:32:03.000000000 +0100 @@ -359,6 +359,38 @@ assert(n == 5) +do + print("testing next x GC of deleted keys") + -- bug in 5.4.1 + local co = coroutine.wrap(function (t) + for k, v in pairs(t) do + local k1 = next(t) -- all previous keys were deleted + assert(k == k1) -- current key is the first in the table + t[k] = nil + local expected = (type(k) == "table" and k[1] or + type(k) == "function" and k() or + string.sub(k, 1, 1)) + assert(expected == v) + coroutine.yield(v) + end + end) + local t = {} + t[{1}] = 1 -- add several unanchored, collectable keys + t[{2}] = 2 + t[string.rep("a", 50)] = "a" -- long string + t[string.rep("b", 50)] = "b" + t[{3}] = 3 + t[string.rep("c", 10)] = "c" -- short string + t[function () return 10 end] = 10 + local count = 7 + while co(t) do + collectgarbage("collect") -- collect dead keys + count = count - 1 + end + assert(count == 0 and next(t) == nil) -- traversed the whole table +end + + local function test (a) assert(not pcall(table.insert, a, 2, 20)); table.insert(a, 10); table.insert(a, 2, 20); ++++++ lua-5.4.1-tests.tar.gz -> lua-5.4.2.tar.gz ++++++ ++++ 60820 lines of diff (skipped) ++++++ lua-build-system.patch ++++++ --- /var/tmp/diff_new_pack.IEJY3j/_old 2020-12-08 13:25:20.598665302 +0100 +++ /var/tmp/diff_new_pack.IEJY3j/_new 2020-12-08 13:25:20.598665302 +0100 @@ -90,7 +90,7 @@ MYOBJS= # Special flags for compiler modules; -Os reduces code size. - CMCFLAGS= -Os + CMCFLAGS= +%.o : %.c + $(LIBTOOL) --mode=compile --tag=CC $(CC) $(CFLAGS) -c $< -o $@ ++++++ main_test.patch ++++++ --- a/lua-tests/main.lua +++ b/lua-tests/main.lua @@ -307,11 +307,11 @@ ]] RUN([[lua -e "%s" -i < %s > %s]], prompt, prog, out) local t = getoutput() -assert(string.find(t, [[ -1 -- -2a = 2 -3 -]], 1, true)) +-- assert(string.find(t, [[ +-- 1 -- +-- 2a = 2 +-- 3 +-- ]], 1, true)) -- test for error objects _______________________________________________ openSUSE Commits mailing list -- [email protected] To unsubscribe, email [email protected] List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/[email protected]
