Accepting request 821867 from devel:languages:lua

- Add upstream patches 7 & 8
- 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

OBS-URL: https://build.opensuse.org/request/show/821867
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/lua54?expand=0&rev=2
This commit is contained in:
Dominique Leuenberger 2020-07-24 07:47:53 +00:00 committed by Git OBS Bridge
commit 5633027fbc
4 changed files with 152 additions and 23 deletions

View File

@ -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

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Mon Jul 20 11:00:56 UTC 2020 - Callum Farmer <callumjfarmer13@gmail.com>
- Add upstream patches 7 & 8
-------------------------------------------------------------------
Sat Jul 18 09:51:00 UTC 2020 - Callum Farmer <callumjfarmer13@gmail.com>
- Add upstream-bugs.patch, upstream fixes from https://www.lua.org/bugs.html
-------------------------------------------------------------------
Sat Jul 18 08:59:50 UTC 2020 - Andreas Schwab <schwab@suse.de>
- 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 <mcepl@suse.com>

View File

@ -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
@ -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: upstream-bugs.patch
BuildRequires: libtool
BuildRequires: lua-macros
BuildRequires: pkgconfig
@ -78,9 +80,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

125
upstream-bugs.patch Normal file
View File

@ -0,0 +1,125 @@
--- 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 */
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/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 @@
/* 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' */