forked from pool/lua54
Accepting request 878378 from home:gmbr3:Lua
- Add upstream-bugs.patch and upstream-bugs-test.patch to fix bugs 2,3,4 for build and tests respectively. OBS-URL: https://build.opensuse.org/request/show/878378 OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua54?expand=0&rev=24
This commit is contained in:
parent
4ddfb6a0c6
commit
236d9fb18d
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 11 17:10:14 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
|
||||
|
||||
- Add upstream-bugs.patch and upstream-bugs-test.patch to fix
|
||||
bugs 2,3,4 for build and tests respectively.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 22 12:38:04 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
|
||||
|
||||
|
@ -42,7 +42,8 @@ Patch1: attrib_test.patch
|
||||
Patch2: files_test.patch
|
||||
Patch3: main_test.patch
|
||||
# PATCH-FIX-UPSTREAM https://www.lua.org/bugs.html#5.4.2
|
||||
#Patch4: upstream-bugs.patch
|
||||
Patch4: upstream-bugs.patch
|
||||
Patch5: upstream-bugs-test.patch
|
||||
%if "%{flavor}" == "test"
|
||||
BuildRequires: lua54
|
||||
%else
|
||||
@ -138,9 +139,11 @@ of C functions, written in ANSI C.
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch5 -p1
|
||||
%else
|
||||
%setup -q -n lua-%{version}
|
||||
%patch0 -p1
|
||||
%patch4 -p1
|
||||
%endif
|
||||
|
||||
# manpage
|
||||
|
38
upstream-bugs-test.patch
Normal file
38
upstream-bugs-test.patch
Normal file
@ -0,0 +1,38 @@
|
||||
--- a/db.lua
|
||||
+++ b/db.lua
|
||||
@@ -31,6 +31,7 @@ end
|
||||
|
||||
do
|
||||
assert(not pcall(debug.getinfo, print, "X")) -- invalid option
|
||||
+ assert(not pcall(debug.getinfo, 0, ">")) -- invalid option
|
||||
assert(not debug.getinfo(1000)) -- out of range level
|
||||
assert(not debug.getinfo(-1)) -- out of range level
|
||||
local a = debug.getinfo(print)
|
||||
--- a/strings.lua
|
||||
+++ b/strings.lua
|
||||
@@ -361,6 +361,9 @@ assert(load("return 1\n--comment without ending EOL")() == 1)
|
||||
|
||||
|
||||
checkerror("table expected", table.concat, 3)
|
||||
+checkerror("at index " .. maxi, table.concat, {}, " ", maxi, maxi)
|
||||
+-- '%' escapes following minus signal
|
||||
+checkerror("at index %" .. mini, table.concat, {}, " ", mini, mini)
|
||||
assert(table.concat{} == "")
|
||||
assert(table.concat({}, 'x') == "")
|
||||
assert(table.concat({'\0', '\0\1', '\0\1\2'}, '.\0.') == "\0.\0.\0\1.\0.\0\1\2")
|
||||
--- a/errors.lua
|
||||
+++ b/errors.lua
|
||||
@@ -191,6 +191,13 @@ checkmessage("a = 24 // 0", "divide by zero")
|
||||
checkmessage("a = 1 % 0", "'n%0'")
|
||||
|
||||
|
||||
+-- type error for an object which is neither in an upvalue nor a register.
|
||||
+-- The following code will try to index the value 10 that is stored in
|
||||
+-- the metatable, without moving it to a register.
|
||||
+checkmessage("local a = setmetatable({}, {__index = 10}).x",
|
||||
+ "attempt to index a number value")
|
||||
+
|
||||
+
|
||||
-- numeric for loops
|
||||
checkmessage("for i = {}, 10 do end", "table")
|
||||
checkmessage("for i = io.stdin, 10 do end", "FILE")
|
46
upstream-bugs.patch
Normal file
46
upstream-bugs.patch
Normal file
@ -0,0 +1,46 @@
|
||||
--- a/src/ldblib.c
|
||||
+++ b/src/ldblib.c
|
||||
@@ -152,6 +152,7 @@ static int db_getinfo (lua_State *L) {
|
||||
lua_State *L1 = getthread(L, &arg);
|
||||
const char *options = luaL_optstring(L, arg+2, "flnSrtu");
|
||||
checkstack(L, L1, 3);
|
||||
+ luaL_argcheck(L, options[0] != '>', arg + 2, "invalid option '>'");
|
||||
if (lua_isfunction(L, arg + 1)) { /* info about a function? */
|
||||
options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */
|
||||
lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */
|
||||
--- a/src/ltablib.c
|
||||
+++ b/src/ltablib.c
|
||||
@@ -146,7 +146,7 @@ static int tmove (lua_State *L) {
|
||||
static void addfield (lua_State *L, luaL_Buffer *b, lua_Integer i) {
|
||||
lua_geti(L, 1, i);
|
||||
if (!lua_isstring(L, -1))
|
||||
- luaL_error(L, "invalid value (%s) at index %d in table for 'concat'",
|
||||
+ luaL_error(L, "invalid value (%s) at index %I in table for 'concat'",
|
||||
luaL_typename(L, -1), i);
|
||||
luaL_addvalue(b);
|
||||
}
|
||||
--- a/src/ldebug.c
|
||||
+++ b/src/ldebug.c
|
||||
@@ -638,14 +638,18 @@ static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
|
||||
|
||||
|
||||
/*
|
||||
-** The subtraction of two potentially unrelated pointers is
|
||||
-** not ISO C, but it should not crash a program; the subsequent
|
||||
-** checks are ISO C and ensure a correct result.
|
||||
+** Check whether pointer 'o' points to some value in the stack
|
||||
+** frame of the current function. Because 'o' may not point to a
|
||||
+** value in this stack, we cannot compare it with the region
|
||||
+** boundaries (undefined behaviour in ISO C).
|
||||
*/
|
||||
static int isinstack (CallInfo *ci, const TValue *o) {
|
||||
- StkId base = ci->func + 1;
|
||||
- ptrdiff_t i = cast(StkId, o) - base;
|
||||
- return (0 <= i && i < (ci->top - base) && s2v(base + i) == o);
|
||||
+ StkId pos;
|
||||
+ for (pos = ci->func + 1; pos < ci->top; pos++) {
|
||||
+ if (o == s2v(pos))
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0; /* not found */
|
||||
}
|
Loading…
Reference in New Issue
Block a user