From e6741c1cebd411afa8955f57afb275329a4539985a97c68f26e21b7f3de8dee2 Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Sat, 18 Jul 2020 09:21:15 +0000 Subject: [PATCH 1/4] Accepting request 821623 from home:Andreas_Schwab:Factory - files_test.patch: use proper check for 64-bit time_t - Amend list of 64bit architectures OBS-URL: https://build.opensuse.org/request/show/821623 OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua54?expand=0&rev=4 --- files_test.patch | 26 ++++++-------------------- lua54.changes | 6 ++++++ lua54.spec | 6 +++--- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/files_test.patch b/files_test.patch index db9e8a4..739c58b 100644 --- a/files_test.patch +++ b/files_test.patch @@ -1,5 +1,7 @@ ---- a/lua-5.4.0-tests/files.lua -+++ b/lua-5.4.0-tests/files.lua +Index: lua-5.4.0/lua-5.4.0-tests/files.lua +=================================================================== +--- lua-5.4.0.orig/lua-5.4.0-tests/files.lua ++++ lua-5.4.0/lua-5.4.0-tests/files.lua @@ -81,7 +81,7 @@ assert(io.output() ~= io.stdout) if not _port then -- invalid seek @@ -36,28 +38,12 @@ _G.D = os.date("*t", t) assert(os.time(D) == t) load(os.date([[assert(D.year==%Y and D.month==%m and D.day==%d and -@@ -784,6 +788,15 @@ local function checkDateTable (t) - _G.D = nil - end - -+local function is64bit() -+ local arch = io.popen("uname -m"):read("*a") -+ if (arch or ""):match("64") then -+ return 64 -+ else -+ return 32 -+ end -+end -+ - checkDateTable(os.time()) - if not _port then - -- assume that time_t can represent these values -@@ -791,7 +804,9 @@ if not _port then +@@ -791,7 +795,9 @@ if not _port then checkDateTable(1) checkDateTable(1000) checkDateTable(0x7fffffff) - checkDateTable(0x80000000) -+ if is64bit() == 64 then ++ if not testerr("out-of-bound", os.date, "*t", 0x80000000) then + checkDateTable(0x80000000) + end end diff --git a/lua54.changes b/lua54.changes index 5df3afa..09ac550 100644 --- a/lua54.changes +++ b/lua54.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Jul 18 08:59:50 UTC 2020 - Andreas Schwab + +- files_test.patch: use proper check for 64-bit time_t +- Amend list of 64bit architectures + ------------------------------------------------------------------- Mon Jul 6 21:20:00 UTC 2020 - Matej Cepl diff --git a/lua54.spec b/lua54.spec index c2bd8cc..718bdf6 100644 --- a/lua54.spec +++ b/lua54.spec @@ -24,7 +24,7 @@ Release: 0 Summary: Small Embeddable Language with Procedural Syntax License: MIT Group: Development/Languages/Other -Url: http://www.lua.org +URL: http://www.lua.org Source: http://www.lua.org/ftp/lua-5.4.0.tar.gz Source1: http://www.lua.org/tests/lua-5.4.0-tests.tar.gz Source99: baselibs.conf @@ -78,9 +78,9 @@ application. %package -n %{libname} Summary: The Lua integration library -# Compat as libtool changes the soname Group: System/Libraries -%ifarch aarch64 x86_64 ppc64 ppc64le s390x +# Compat as libtool changes the soname +%ifarch aarch64 x86_64 ppc64 ppc64le s390x riscv64 Provides: liblua.so.5.4()(64bit) %else Provides: liblua.so.5.4 From d728da18819e2c144c84acacff35dc01c31cebb9032600737d2aca2700387c79 Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Sat, 18 Jul 2020 09:54:15 +0000 Subject: [PATCH 2/4] Accepting request 821630 from home:gmbr3:Active - Add bugs.patch, upstream fixes from https://www.lua.org/bugs.html OBS-URL: https://build.opensuse.org/request/show/821630 OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua54?expand=0&rev=5 --- bugs.patch | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++ lua54.changes | 5 +++ lua54.spec | 2 + 3 files changed, 111 insertions(+) create mode 100644 bugs.patch diff --git a/bugs.patch b/bugs.patch new file mode 100644 index 0000000..dce2f1d --- /dev/null +++ b/bugs.patch @@ -0,0 +1,104 @@ +--- a/src/lgc.c ++++ b/src/lgc.c +@@ -1140,7 +1140,7 @@ static void finishgencycle (lua_State *L, global_State *g) { + static void youngcollection (lua_State *L, global_State *g) { + GCObject **psurvival; /* to point to first non-dead survival object */ + lua_assert(g->gcstate == GCSpropagate); +- markold(g, g->survival, g->reallyold); ++ markold(g, g->allgc, g->reallyold); + markold(g, g->finobj, g->finobjrold); + atomic(L); + +--- a/src/ldo.c ++++ b/src/ldo.c +@@ -466,13 +466,13 @@ void luaD_call (lua_State *L, StkId func, int nresults) { + f = fvalue(s2v(func)); + Cfunc: { + int n; /* number of returns */ +- CallInfo *ci = next_ci(L); ++ CallInfo *ci; + checkstackp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ ++ L->ci = ci = next_ci(L); + ci->nresults = nresults; + ci->callstatus = CIST_C; + ci->top = L->top + LUA_MINSTACK; + ci->func = func; +- L->ci = ci; + lua_assert(ci->top <= L->stack_last); + if (L->hookmask & LUA_MASKCALL) { + int narg = cast_int(L->top - func) - 1; +@@ -486,18 +486,18 @@ void luaD_call (lua_State *L, StkId func, int nresults) { + break; + } + case LUA_VLCL: { /* Lua function */ +- CallInfo *ci = next_ci(L); ++ CallInfo *ci; + Proto *p = clLvalue(s2v(func))->p; + int narg = cast_int(L->top - func) - 1; /* number of real arguments */ + int nfixparams = p->numparams; + int fsize = p->maxstacksize; /* frame size */ + checkstackp(L, fsize, func); ++ L->ci = ci = next_ci(L); + ci->nresults = nresults; + ci->u.l.savedpc = p->code; /* starting point */ + ci->callstatus = 0; + ci->top = func + 1 + fsize; + ci->func = func; +- L->ci = ci; + for (; narg < nfixparams; narg++) + setnilvalue(s2v(L->top++)); /* complete missing arguments */ + lua_assert(ci->top <= L->stack_last); +@@ -674,7 +674,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs, + if (from == NULL) + L->nCcalls = CSTACKTHREAD; + else /* correct 'nCcalls' for this thread */ +- L->nCcalls = getCcalls(from) + from->nci - L->nci - CSTACKCF; ++ L->nCcalls = getCcalls(from) - L->nci - CSTACKCF; + if (L->nCcalls <= CSTACKERR) + return resume_error(L, "C stack overflow", nargs); + luai_userstateresume(L, nargs); +--- a/src/lundump.c ++++ b/src/lundump.c +@@ -205,8 +205,9 @@ static void loadUpvalues (LoadState *S, Proto *f) { + n = loadInt(S); + f->upvalues = luaM_newvectorchecked(S->L, n, Upvaldesc); + f->sizeupvalues = n; +- for (i = 0; i < n; i++) { ++ for (i = 0; i < n; i++) + f->upvalues[i].name = NULL; ++ for (i = 0; i < n; i++) { + f->upvalues[i].instack = loadByte(S); + f->upvalues[i].idx = loadByte(S); + f->upvalues[i].kind = loadByte(S); +--- a/src/lvm.c ++++ b/src/lvm.c +@@ -1104,7 +1104,7 @@ void luaV_finishOp (lua_State *L) { + + + #define checkGC(L,c) \ +- { luaC_condGC(L, L->top = (c), /* limit of live values */ \ ++ { luaC_condGC(L, (savepc(L), L->top = (c)), \ + updatetrap(ci)); \ + luai_threadyield(L); } + +@@ -1792,8 +1792,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { + vmbreak; + } + vmcase(OP_VARARGPREP) { +- luaT_adjustvarargs(L, GETARG_A(i), ci, cl->p); +- updatetrap(ci); ++ ProtectNT(luaT_adjustvarargs(L, GETARG_A(i), ci, cl->p)); + if (trap) { + luaD_hookcall(L, ci); + L->oldpc = pc + 1; /* next opcode will be seen as a "new" line */ +--- a/src/ldo.h ++++ b/src/ldo.h +@@ -44,7 +44,7 @@ + + /* macro to check stack size and GC */ + #define checkstackGC(L,fsize) \ +- luaD_checkstackaux(L, (fsize), (void)0, luaC_checkGC(L)) ++ luaD_checkstackaux(L, (fsize), luaC_checkGC(L), (void)0) + + + /* type of protected functions, to be ran by 'runprotected' */ diff --git a/lua54.changes b/lua54.changes index 09ac550..ccb0857 100644 --- a/lua54.changes +++ b/lua54.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sat Jul 18 09:51:00 UTC 2020 - Callum Farmer + +- Add bugs.patch, upstream fixes from https://www.lua.org/bugs.html + ------------------------------------------------------------------- Sat Jul 18 08:59:50 UTC 2020 - Andreas Schwab diff --git a/lua54.spec b/lua54.spec index 718bdf6..d38fc48 100644 --- a/lua54.spec +++ b/lua54.spec @@ -34,6 +34,8 @@ Patch0: lua-build-system.patch # Fix failing test Patch1: attrib_test.patch Patch2: files_test.patch +# PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html +Patch3: bugs.patch BuildRequires: libtool BuildRequires: lua-macros BuildRequires: pkgconfig From 19f828beffc83ca0ad0e81e3220a1c6669dc698339a0c1fdaa50b4a8f3a85b5c Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Sat, 18 Jul 2020 10:28:01 +0000 Subject: [PATCH 3/4] Accepting request 821637 from home:gmbr3:Active - Add upstream-bugs.patch, upstream fixes from https://www.lua.org/bugs.html - files_test.patch: use proper check for 64-bit time_t - Amend list of 64bit architectures - Don't use %make_build macro, which doesn't work on SLE-12 - Add attrib_test.patch and files_test.patch which fix failing tests (https://is.gd/6DYPgG). With these two patches full test suite passes. - Update to 5.4.0 * Changes from http://www.lua.org/manual/5.4/readme.html#changes * new generational mode for garbage collection * to-be-closed variables * const variables * userdata can have multiple user values * new implementation for math.random * warning system * debug information about function arguments and returns * new semantics for the integer 'for' loop * optional 'init' argument to 'string.gmatch' * new functions 'lua_resetthread' and 'coroutine.close' * string-to-number coercions moved to the string library * allocation function allowed to fail when shrinking a memory block * new format '%p' in 'string.format' * utf8 library accepts codepoints up to 2^31 - Changes copied from request by Matthias G. Eckermann - Updated spec file for lua 5.4: copied from lua53 - lua-build-system.patch: updated from Debian - added tests - Use FAT LTO objects in order to provide proper static library. - Update to 5.3.5: (it is really problematic to find ANY documentation of changes between minor versions; the best we have is https://www.lua.org/bugs.html) - Long brackets with a huge number of '=' overflow some internal buffer arithmetic. - Small build tweaks. - Provide symbol for pkgconfig - Add INSTALL_LMOD and INSTALL_CMOD variables to lua53.pc: this is queried for example by rrdtool's buildsystem. - Properly set includedir in the .pc file - Require lua macros rather than bundling them with lua itself - Add patch lua-build-system.patch for all the builsystem changes - Drop patches merged to the above: * lua-5.3.3-prefix.patch * lua-5.3.3-shared.patch - Drop not really needed lua-5.3.3-visible.patch - Version update to lua 5.3.4 containing various bugfixes - Rename to lua53 - Let package description adhere to guidelines: trim redundant or biased wording and strip future goals. - update version 5.3.3 * bugfix release - changes in 5.3.2 * metatable may access its own deallocated field when it has a self reference in __newindex * label between local definitions can mix-up their initializations * gmatch iterator fails when called from a coroutine different from the one that created it - split lua-suse.diff to 3 reasonable patches * add lua-5.3.3-prefix.patch * add lua-5.3.3-shared.patch * add lua-5.3.3-visible.patch - Update RPM group classification - Provide Lua(API) = 5.3, so that packages installing files to /usr/share/lua/5.3 can properly depend on the right lua branch. - Provide Lua(devel) = 5.3 by lua-devel and conflict with other packages providing Lua(devel) (e.g lua51-devel, lua52-devel...). - macros.lua installs to lua-devel - build with LUA_COMPAT_MODULE to compatible w/ old module system - update version 5.3.1 * integers (64-bit by default) * official support for 32-bit numbers * bitwise operators * basic utf-8 support * functions for packing and unpacking values * see http://www.lua.org/manual/5.3/readme.html#changes - Update to 5.2.4 * Compiler can optimize away overflow check in table.unpack. * Ephemeron table can wrongly collect entry with strong key. * Chunk with too many lines may crash Lua. - the %dir is still needed. - fix update-alternatives - fix /etc/rpm/macros.lua perms - updated to 5.2.3: * yieldable pcall and metamethods * new lexical scheme for globals * ephemeron tables * new library for bitwise operations * light C functions * emergency garbage collector * goto statement * finalizers for tables - updated to 5.2.2: bugfix release, fixed: * Stack overflow in vararg functions with many fixed parameters called with few arguments. * Garbage collector can trigger too many times in recursive loops. * Wrong assert when reporting concatenation errors (manifests only when Lua is compiled in debug mode). * Wrong error message in some short-cut expressions. * luac listings choke on long strings. * see http://www.lua.org/bugs.html for details - fix visibility of global variables [bnc#803791] * modified lua-suse.diff - added LUA_SO target as dependency to LUAC_T and LUA_T to fix parallel build * modified lua-suse.diff - added regresion check for this error into %check - update alternatives need to be %ghosts - export luaU_dump in order to fix linking of luac binary - Tweak lua-suse.diff again: * LUA_IFUNC must be defined as upstream but without "extern", revert the previous mod. * LUA_API must be defined as visibility default - Even after the previous update, third party modules/libraries would not work because LUA_CDIR constant is wrong in x86_64 - devel package must require libluaver = %{version} - Broken lua-suse patch breaks loading third party modules or scripts - updated to 5.2.1: * main thread predefined in the registry * bugfixes - Correction in Provides and Obsolete for lua-libs - Passed the spec file through spec-cleaner - Require liblua5_2 from the -devel package: Otherwise the .so file is a dangling symlink and apps will use the static lib. - Update baselibs.conf to reference liblua5_2 instead of liblua5_1. - readd lua.pc for building rpm - raise update-alternatives priority to 15 (lua51 have 10, lua50 have 5) - updated to 5.2.0: * Main changes yieldable pcall and metamethods new lexical scheme for globals ephemeron tables new library for bitwise operations light C functions emergency garbage collector [goto] statement finalizers for tables * Language no more fenv for threads or functions tables honor the [__len] metamethod hex and [\z] escapes in strings support for hexadecimal floats order metamethods work for different types no more verification of opcode consistency hook event "tail return" replaced by "tail call" empty statement [break] statement may appear in the middle of a block * Libraries arguments for function called through [xpcall] optional 'mode' argument to load and loadfile (to control binary x text) optional 'env' argument to load and loadfile (environment for loaded chunk) [loadlib] may load libraries with global names (RTLD_GLOBAL) new function [package.searchpath] modules receive their paths when loaded optional base in [math.log] optional separator in [string.rep] [file:write] returns file closing a pipe returns exit status [os.exit] may close state new metamethods [__pairs] and __ipairs new option 'isrunning' for [collectgarbage] and lua_gc frontier patterns [\0] in patterns new option [*L] for io.read options for [io.lines] [debug.getlocal] can access function varargs * C API new functions: lua_absindex, lua_arith, lua_compare, lua_copy, lua_len, lua_rawgetp, lua_rawsetp, lua_upvalueid, lua_upvaluejoin, lua_version, luaL_checkversion, luaL_setmetatable, luaL_testudata, luaL_tolstring [lua_pushstring] and pushlstring return string [nparams] and isvararg available in debug API new lua_Unsigned * Implementation max constants per function raised to 2^26 generational mode for garbage collection (experimental) NaN trick (experimental) internal (immutable) version of ctypes simpler implementation for string buffers parser uses much less C-stack space (no more auto arrays) * Lua standalone interpreter new [-E] option to avoid environment variables handling of non-string error messages - cross-build fix: use %__cc macro - use %_smp_mflags - removed -L/usr/lib from Libs: in etc/lua.pc [bnc#613497] - used upstream bugfix patch from http://www.lua.org/download.html - buildrequire pkg-config to fix provides - modified LUA_PATH_DEFAULT [bnc#589441]: search modules under /usr/%{_lib}/lua/%{major_version} too - add baselibs.conf as a source - package documentation as noarch - enable parallel building - updated patches to apply with fuzz=0 - add baselibs.conf - package owns /usr/{lib,share}/lua directories from now - emoved unneeded root.patch - updated to 5.1.4: bugfix release - Set LUA_ROOT to /usr and fix INSTALL_CMOD for lib64 - Add RPM macros file - Allows for lua- packages like python, perl, and ruby - hint the solver about the package rename - do not package/provide the shared lib twice / follow shared lib policy - created -doc package - updated to version 5.1.3, bug fix release. Fixed bugs: * wrong error message in some concatenations * too many variables in an assignment may cause a C stack overflow * an error in a module loaded through the '-l' option shows no traceback * gsub may go wild when wrongly called without its third argument and with a large subject * table.remove removes last element of a table when given an out-of-bound index * lua_setfenv may crash if called over an invalid object * stand-alone interpreter shows incorrect error message when the "message" is a coroutine. * debug.sethook/gethook may overflow the thread's stack - using /sbin/ldconfig in specfile - updated to version 5.1.2, fixes some bugs: * count hook may be called without being set * code generated for "-nil", "-true", and "-false" is wrong * recursive coroutines may overflow C stack * wrong error message in some concatenations * very small numbers all collide in the hash function - package liblua.so as symlink. - the core package now uses update alternatives to allow installation of 5.0.x and 5.1.x - devel packages will conflict now - ARGH dont copy and paste!: lua-libs should not depend on lua. another run on (#217875) - really fix the file pattern (#217875) - splitted out lua-libs so we can install at least both libs in parallel. (#217875) - fix wrong prefix in lua.pc - link liblua with -lm to satisfy unresolved symbols - include lua.pc - update to 5.1.1 Language: * new module system. * new semantics for control variables of fors. * new semantics for setn/getn. * new syntax/semantics for varargs. * new long strings and comments. * new `mod' operator (`%') * new length operator #t * metatables for all types API: * new functions: lua_createtable, lua_get(set)field, lua_push(to)integer. * user supplies memory allocator (lua_open becomes lua_newstate). * luaopen_* functionst must be called through Lua. Implementation: * new configuration scheme via luaconf.h. * incremental garbage collection. * better handling of end-of-line in the lexer. * fully reentrant parser (new Lua function `load') * better support for 64-bit machines. * native loadlib support for Mac OS X. * standard distribution in only one library (lualib.a merged into lua.a) - converted neededforbuild to BuildRequires - Don't strip binaries. - Fix shared library linking. - enable dynamic loading capability (#106845) - initial packaging OBS-URL: https://build.opensuse.org/request/show/821637 OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua54?expand=0&rev=6 --- lua54.changes | 2 +- lua54.spec | 2 +- bugs.patch => upstream-bugs.patch | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename bugs.patch => upstream-bugs.patch (100%) diff --git a/lua54.changes b/lua54.changes index ccb0857..2d25ea5 100644 --- a/lua54.changes +++ b/lua54.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- Sat Jul 18 09:51:00 UTC 2020 - Callum Farmer -- Add bugs.patch, upstream fixes from https://www.lua.org/bugs.html +- Add upstream-bugs.patch, upstream fixes from https://www.lua.org/bugs.html ------------------------------------------------------------------- Sat Jul 18 08:59:50 UTC 2020 - Andreas Schwab diff --git a/lua54.spec b/lua54.spec index d38fc48..512a12c 100644 --- a/lua54.spec +++ b/lua54.spec @@ -35,7 +35,7 @@ Patch0: lua-build-system.patch Patch1: attrib_test.patch Patch2: files_test.patch # PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html -Patch3: bugs.patch +Patch3: upstream-bugs.patch BuildRequires: libtool BuildRequires: lua-macros BuildRequires: pkgconfig diff --git a/bugs.patch b/upstream-bugs.patch similarity index 100% rename from bugs.patch rename to upstream-bugs.patch From ee0ec2d5c60c223f885f1650be9b73f2ab5fafcf8fcff63af65f734fb3e67a96 Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Mon, 20 Jul 2020 11:08:51 +0000 Subject: [PATCH 4/4] Accepting request 821866 from home:gmbr3:Active - Add upstream patches 7 & 8 OBS-URL: https://build.opensuse.org/request/show/821866 OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua54?expand=0&rev=7 --- lua54.changes | 5 +++++ upstream-bugs.patch | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/lua54.changes b/lua54.changes index 2d25ea5..5a4f2fc 100644 --- a/lua54.changes +++ b/lua54.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jul 20 11:00:56 UTC 2020 - Callum Farmer + +- Add upstream patches 7 & 8 + ------------------------------------------------------------------- Sat Jul 18 09:51:00 UTC 2020 - Callum Farmer diff --git a/upstream-bugs.patch b/upstream-bugs.patch index dce2f1d..b0e2481 100644 --- a/upstream-bugs.patch +++ b/upstream-bugs.patch @@ -1,5 +1,14 @@ --- a/src/lgc.c +++ b/src/lgc.c +@@ -856,6 +856,8 @@ static void GCTM (lua_State *L) { + if (unlikely(status != LUA_OK)) { /* error while running __gc? */ + luaE_warnerror(L, "__gc metamethod"); + L->top--; /* pops error object */ ++ if (isLua(L->ci)) ++ L->oldpc = L->ci->u.l.savedpc; /* update 'oldpc' */ + } + } + } @@ -1140,7 +1140,7 @@ static void finishgencycle (lua_State *L, global_State *g) { static void youngcollection (lua_State *L, global_State *g) { GCObject **psurvival; /* to point to first non-dead survival object */ @@ -91,6 +100,18 @@ if (trap) { luaD_hookcall(L, ci); L->oldpc = pc + 1; /* next opcode will be seen as a "new" line */ +--- a/src/liolib.c ++++ b/src/liolib.c +@@ -279,6 +279,8 @@ static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + LStream *p = newprefile(L); ++ luaL_argcheck(L, ((mode[0] == 'r' || mode[0] == 'w') && mode[1] == '\0'), ++ 2, "invalid mode"); + p->f = l_popen(L, filename, mode); + p->closef = &io_pclose; + return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; + --- a/src/ldo.h +++ b/src/ldo.h @@ -44,7 +44,7 @@