Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
domenico
2025-06-24 12:51:15 +02:00
commit 27c9d80f51
10493 changed files with 1885777 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
From 96576b44a1b368bd6590eb0778ae45cc9ccede3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 21 Jun 2019 14:08:38 +0200
Subject: [PATCH] include version number
Including it allows multiple lua versions to coexist.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ PLAT= none
# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
INSTALL_TOP= /usr/local
INSTALL_BIN= $(INSTALL_TOP)/bin
-INSTALL_INC= $(INSTALL_TOP)/include
+INSTALL_INC= $(INSTALL_TOP)/include/lua$V
INSTALL_LIB= $(INSTALL_TOP)/lib
INSTALL_MAN= $(INSTALL_TOP)/man/man1
INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
@@ -39,10 +39,10 @@ RM= rm -f
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
# What to install.
-TO_BIN= lua luac
+TO_BIN= lua$V luac$V
TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
-TO_LIB= liblua.a
-TO_MAN= lua.1 luac.1
+TO_LIB= liblua$V.a
+TO_MAN= lua$V.1 luac$V.1
# Lua version and release.
V= 5.3
@@ -52,7 +52,7 @@ R= $V.4
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) $@ V=$V
test: dummy
src/lua -v
diff --git a/doc/lua.1 b/doc/lua5.3.1
rename from doc/lua.1
rename to doc/lua5.3.1
diff --git a/doc/luac.1 b/doc/luac5.3.1
rename from doc/luac.1
rename to doc/luac5.3.1
diff --git a/src/Makefile b/src/Makefile
--- a/src/Makefile
+++ b/src/Makefile
@@ -28,7 +28,7 @@ MYOBJS=
PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris
-LUA_A= liblua.a
+LUA_A= liblua$V.a
CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
ltm.o lundump.o lvm.o lzio.o
@@ -36,10 +36,10 @@ LIB_O= lauxlib.o lbaselib.o lbitlib.o lc
lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
-LUA_T= lua
+LUA_T= lua$V
LUA_O= lua.o
-LUAC_T= luac
+LUAC_T= luac$V
LUAC_O= luac.o
ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)

View File

@@ -0,0 +1,54 @@
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -61,14 +61,12 @@
#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
-#define LUA_USE_READLINE /* needs some extra libraries */
#endif
#if defined(LUA_USE_MACOSX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* MacOS does not need -ldl */
-#define LUA_USE_READLINE /* needs an extra library: -lreadline */
#endif
--- a/src/Makefile
+++ b/src/Makefile
@@ -23,6 +23,7 @@ MYCFLAGS=
MYLDFLAGS=
MYLIBS=
MYOBJS=
+# USE_READLINE=1
# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
@@ -83,6 +84,7 @@ echo:
# Convenience targets for popular platforms
ALL= all
+RFLAG=$(if $(USE_READLINE),-DLUA_USE_READLINE)
none:
@echo "Please do 'make PLATFORM' where PLATFORM is one of these:"
@@ -102,15 +104,15 @@ c89:
freebsd:
- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX $(RFLAG) -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc"
generic: $(ALL)
linux:
- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" $(RFLAG) SYSLIBS="-Wl,-E -ldl $(if $(USE_READLINE), -lreadline)"
macosx:
- $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline"
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" $(RFLAG) SYSLIBS="$(if $(USE_READLINE), -lreadline)"
mingw:
$(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \

View File

@@ -0,0 +1,51 @@
From 89aee84cbc9224f638f3b7951b306d2ee8ecb71e Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 27 Mar 2019 14:30:12 -0300
Subject: [PATCH] Fixed bug in 'lua_upvaluejoin'
Bug-fix: joining an upvalue with itself could cause a use-after-free
crash.
---
src/lapi.c | 12 +++++------
1 file changed, 41 insertions(+), 39 deletions(-)
--- a/src/lapi.c
+++ b/src/lapi.c
@@ -1254,13 +1254,12 @@ LUA_API const char *lua_setupvalue (lua_
}
-static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
+static UpVal **getupvalref (lua_State *L, int fidx, int n) {
LClosure *f;
StkId fi = index2addr(L, fidx);
api_check(L, ttisLclosure(fi), "Lua function expected");
f = clLvalue(fi);
api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index");
- if (pf) *pf = f;
return &f->upvals[n - 1]; /* get its upvalue pointer */
}
@@ -1269,7 +1268,7 @@ LUA_API void *lua_upvalueid (lua_State *
StkId fi = index2addr(L, fidx);
switch (ttype(fi)) {
case LUA_TLCL: { /* lua closure */
- return *getupvalref(L, fidx, n, NULL);
+ return *getupvalref(L, fidx, n);
}
case LUA_TCCL: { /* C closure */
CClosure *f = clCvalue(fi);
@@ -1286,9 +1285,10 @@ LUA_API void *lua_upvalueid (lua_State *
LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,
int fidx2, int n2) {
- LClosure *f1;
- UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
- UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
+ UpVal **up1 = getupvalref(L, fidx1, n1);
+ UpVal **up2 = getupvalref(L, fidx2, n2);
+ if (*up1 == *up2)
+ return;
luaC_upvdeccount(L, *up1);
*up1 = *up2;
(*up1)->refcount++;