forked from pool/lua54
Compare commits
13 Commits
Author | SHA256 | Date | |
---|---|---|---|
e748694fd6
|
|||
41f2bc1313
|
|||
b6168d41b6
|
|||
0fa5783653
|
|||
74c6aa5eb9
|
|||
a9f3c2169c
|
|||
07794071cf
|
|||
b8ca1bcce1
|
|||
ff37df0ddf
|
|||
595733ab8e
|
|||
6957aee288
|
|||
a815e81e87
|
|||
b832770e08
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,5 @@
|
||||
.osc
|
||||
_scmsync.obsinfo
|
||||
_buildconfig-*
|
||||
_buildinfo-*.xml
|
||||
lua54-*-build/
|
||||
|
@@ -1,10 +1,14 @@
|
||||
Inspect errno only after failure
|
||||
|
||||
Index: lua-5.4.6/src/lauxlib.c
|
||||
---
|
||||
src/lauxlib.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Index: lua-5.4.8/src/lauxlib.c
|
||||
===================================================================
|
||||
--- lua-5.4.6.orig/src/lauxlib.c
|
||||
+++ lua-5.4.6/src/lauxlib.c
|
||||
@@ -283,7 +283,7 @@ LUALIB_API int luaL_fileresult (lua_Stat
|
||||
--- lua-5.4.8.orig/src/lauxlib.c 2025-07-15 22:59:14.411309750 +0200
|
||||
+++ lua-5.4.8/src/lauxlib.c 2025-07-15 22:59:24.858384379 +0200
|
||||
@@ -286,7 +286,7 @@
|
||||
|
||||
|
||||
LUALIB_API int luaL_execresult (lua_State *L, int stat) {
|
||||
|
BIN
lua-5.4.7-tests.tar.gz
(Stored with Git LFS)
BIN
lua-5.4.7-tests.tar.gz
(Stored with Git LFS)
Binary file not shown.
BIN
lua-5.4.7.tar.gz
(Stored with Git LFS)
BIN
lua-5.4.7.tar.gz
(Stored with Git LFS)
Binary file not shown.
BIN
lua-5.4.8-tests.tar.gz
(Stored with Git LFS)
Normal file
BIN
lua-5.4.8-tests.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
lua-5.4.8.tar.gz
(Stored with Git LFS)
Normal file
BIN
lua-5.4.8.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
@@ -1,3 +1,30 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Aug 5 07:22:18 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
||||
- interpreter should only provide, not conflict lua symbol
|
||||
(bsc#1247521)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jul 19 09:23:33 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
||||
- Switch from update-alternatives to libalternatives (and
|
||||
dependency on lua-interpreter)
|
||||
- improve .gitignore and overall improve the packaging.
|
||||
- this package also provides devel symlink directly and conflicts
|
||||
other -devel packages
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Jul 12 18:38:52 UTC 2025 - Callum Farmer <gmbr3@opensuse.org>
|
||||
|
||||
- Update to version 5.4.8:
|
||||
* Fixed 8 bugs from 5.4.7
|
||||
- Add upstream1.patch: Numbered upstream patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 23 07:55:24 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
||||
- Fix license: it is MIT, not GPL-3.0-or-later.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 24 11:26:59 UTC 2024 - Callum Farmer <gmbr3@opensuse.org>
|
||||
|
||||
@@ -388,7 +415,7 @@ Wed Sep 17 15:04:25 UTC 2014 - i@marguerite.su
|
||||
-------------------------------------------------------------------
|
||||
Fri Sep 12 09:19:07 UTC 2014 - pgajdos@suse.com
|
||||
|
||||
- fix update-alternatives
|
||||
- fix update-alternatives
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 10 10:21:23 UTC 2014 - pgajdos@suse.com
|
||||
@@ -412,13 +439,13 @@ Mon Mar 31 11:05:05 UTC 2014 - pgajdos@suse.com
|
||||
Mon Sep 9 11:12:20 UTC 2013 - pgajdos@suse.com
|
||||
|
||||
- updated to 5.2.2: bugfix release, fixed:
|
||||
* Stack overflow in vararg functions with many fixed parameters
|
||||
called with few arguments.
|
||||
* 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.
|
||||
* 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
|
||||
|
||||
-------------------------------------------------------------------
|
||||
@@ -439,32 +466,32 @@ Tue Feb 5 14:18:18 UTC 2013 - coolo@suse.com
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 15 15:11:34 UTC 2012 - pgajdos@suse.com
|
||||
|
||||
- export luaU_dump in order to fix linking of luac binary
|
||||
- export luaU_dump in order to fix linking of luac binary
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 9 14:55:31 UTC 2012 - crrodriguez@opensuse.org
|
||||
|
||||
- Tweak lua-suse.diff again:
|
||||
* LUA_IFUNC must be defined as upstream but without "extern",
|
||||
* LUA_IFUNC must be defined as upstream but without "extern",
|
||||
revert the previous mod.
|
||||
* LUA_API must be defined as visibility default
|
||||
* LUA_API must be defined as visibility default
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 16 00:34:57 UTC 2012 - crrodriguez@opensuse.org
|
||||
|
||||
- Even after the previous update, third party modules/libraries
|
||||
would not work because LUA_CDIR constant is wrong in x86_64
|
||||
would not work because LUA_CDIR constant is wrong in x86_64
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 15 22:34:12 UTC 2012 - crrodriguez@opensuse.org
|
||||
|
||||
- devel package must require libluaver = %{version}
|
||||
- devel package must require libluaver = %{version}
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 15 22:24:01 UTC 2012 - crrodriguez@opensuse.org
|
||||
|
||||
- Broken lua-suse patch breaks loading third party modules
|
||||
or scripts
|
||||
or scripts
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jun 18 09:09:13 UTC 2012 - pgajdos@suse.com
|
||||
@@ -544,7 +571,7 @@ Wed Dec 21 13:58:22 UTC 2011 - pgajdos@suse.com
|
||||
lua_rawgetp, lua_rawsetp, lua_upvalueid, lua_upvaluejoin,
|
||||
lua_version, luaL_checkversion, luaL_setmetatable,
|
||||
luaL_testudata, luaL_tolstring
|
||||
[lua_pushstring] and <CODE>pushlstring</CODE> return string
|
||||
[lua_pushstring] and <CODE>pushlstring</CODE> return string
|
||||
[nparams] and <CODE>isvararg</CODE> available in debug API
|
||||
new lua_Unsigned
|
||||
* Implementation
|
||||
@@ -641,18 +668,18 @@ Tue Feb 19 10:37:22 CET 2008 - pgajdos@suse.cz
|
||||
- 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
|
||||
* 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
|
||||
* 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
|
||||
* stand-alone interpreter shows incorrect error message when
|
||||
the "message" is a coroutine.
|
||||
* debug.sethook/gethook may overflow the thread's stack
|
||||
* debug.sethook/gethook may overflow the thread's stack
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 24 14:31:30 CEST 2007 - pgajdos@suse.cz
|
||||
|
86
lua54.spec
86
lua54.spec
@@ -25,11 +25,16 @@
|
||||
%endif
|
||||
%define major_version 5.4
|
||||
%define libname liblua5_4-5
|
||||
%if 0%{?suse_version} > 1500
|
||||
%bcond_without libalternatives
|
||||
%else
|
||||
%bcond_with libalternatives
|
||||
%endif
|
||||
Name: lua54%{name_ext}
|
||||
Version: 5.4.7
|
||||
Version: 5.4.8
|
||||
Release: 0
|
||||
Summary: Small Embeddable Language with Procedural Syntax
|
||||
License: GPL-3.0-or-later
|
||||
License: MIT
|
||||
Group: Development/Languages/Other
|
||||
URL: https://www.lua.org
|
||||
Source: https://www.lua.org/ftp/lua-%{version}.tar.gz
|
||||
@@ -45,17 +50,26 @@ Patch3: main_test.patch
|
||||
Patch6: shared_link.patch
|
||||
# PATCH-FIX-UPSTREAM inspect errno only after failure
|
||||
Patch8: execresult.patch
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
Patch100: upstream1.patch
|
||||
Provides: lua = %{version}
|
||||
Obsoletes: lua < %{version}
|
||||
Provides: Lua(API) = %{major_version}
|
||||
%if %{with libalternatives}
|
||||
BuildRequires: alts
|
||||
BuildRequires: lua-interpreter
|
||||
Requires: alts
|
||||
Requires: lua-interpreter
|
||||
%else
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
%endif
|
||||
%if "%{flavor}" == "test"
|
||||
BuildRequires: lua54
|
||||
BuildRequires: lua54-devel
|
||||
%else
|
||||
# Ensure we can build without $self
|
||||
#!BuildIgnore: lua54
|
||||
BuildRequires: libtool
|
||||
BuildRequires: lua-macros
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: readline-devel
|
||||
%endif
|
||||
@@ -74,13 +88,11 @@ of C functions, written in ANSI C.
|
||||
|
||||
%package devel
|
||||
Summary: Development files for lua
|
||||
License: MIT
|
||||
Group: Development/Libraries/C and C++
|
||||
Requires: %{libname} = %{version}
|
||||
Requires: %{name} = %{version}
|
||||
Requires: lua-macros
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
Conflicts: lua-devel
|
||||
Provides: lua-devel = %{version}
|
||||
Provides: Lua(devel) = %{major_version}
|
||||
Provides: pkgconfig(lua) = %{version}
|
||||
@@ -95,7 +107,6 @@ application.
|
||||
|
||||
%package -n %{libname}
|
||||
Summary: The Lua integration library
|
||||
License: MIT
|
||||
Group: System/Libraries
|
||||
Provides: liblua5_4 = %{version}-%{release}
|
||||
Obsoletes: liblua5_4 < %{version}-%{release}
|
||||
@@ -122,7 +133,6 @@ of C functions, written in ANSI C.
|
||||
|
||||
%package doc
|
||||
Summary: Documentation for Lua, a small embeddable language
|
||||
License: MIT
|
||||
Group: Documentation/HTML
|
||||
BuildArch: noarch
|
||||
%if 0%{?suse_version} > 1315
|
||||
@@ -150,8 +160,10 @@ mv lua-%{version}-tests testes
|
||||
%if "%{flavor}" != "test"
|
||||
cat doc/lua.1 | sed 's/TH LUA 1/TH LUA%{major_version} 1/' > doc/lua%{major_version}.1
|
||||
cat doc/luac.1 | sed 's/TH LUAC 1/TH LUAC%{major_version} 1/' > doc/luac%{major_version}.1
|
||||
%endif
|
||||
|
||||
%build
|
||||
%if "%{flavor}" != "test"
|
||||
sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
|
||||
%make_build linux-readline -C src \
|
||||
CC="cc" LIBDIR="%{_libdir}" \
|
||||
@@ -183,9 +195,21 @@ Version: %{version}
|
||||
Libs: -llua%{major_version} -lm
|
||||
Cflags: -I\${includedir}
|
||||
EOF
|
||||
|
||||
install -D -m 644 lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua%{major_version}.pc
|
||||
|
||||
%if %{with libalternatives}
|
||||
# alternatives - create configuration file
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/lua
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/lua/54.conf <<EOF
|
||||
binary=%{_bindir}/lua5.4
|
||||
man=lua5.4
|
||||
EOF
|
||||
mkdir -p %{buildroot}%{_datadir}/libalternatives/luac
|
||||
cat > %{buildroot}%{_datadir}/libalternatives/luac/54.conf <<EOF
|
||||
binary=%{_bindir}/luac5.4
|
||||
man=luac5.4
|
||||
EOF
|
||||
%else
|
||||
# update-alternatives
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
|
||||
for file in lua luac ; do
|
||||
@@ -194,22 +218,23 @@ for file in lua luac ; do
|
||||
touch "%{buildroot}%{_sysconfdir}/alternatives/${file}.1%{ext_man}"
|
||||
ln -sf "%{_sysconfdir}/alternatives/${file}.1%{ext_man}" "%{buildroot}%{_mandir}/man1/${file}.1%{ext_man}"
|
||||
done
|
||||
%endif
|
||||
|
||||
# Compat link with older unprefixed library and with soname 0 from deb/etc
|
||||
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua%{major_version}.so.%{major_version}
|
||||
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua%{major_version}.so.0
|
||||
ln -s %{_libdir}/liblua%{major_version}.so.%{major_version}.0 %{buildroot}%{_libdir}/liblua.so.%{major_version}
|
||||
# Library devel alternatives
|
||||
touch %{buildroot}%{_sysconfdir}/alternatives/liblua.so
|
||||
ln -sf %{_sysconfdir}/alternatives/liblua.so %{buildroot}%{_libdir}/liblua.so
|
||||
touch %{buildroot}%{_sysconfdir}/alternatives/lua.pc
|
||||
ln -sf %{_sysconfdir}/alternatives/lua.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
|
||||
%else
|
||||
|
||||
# We don’t create alternatives for -devel content, just conflict those
|
||||
ln -s %{_libdir}/liblua%{major_version}.so %{buildroot}%{_libdir}/liblua.so
|
||||
ln -s %{_libdir}/pkgconfig/lua%{major_version}.pc %{buildroot}%{_libdir}/pkgconfig/lua.pc
|
||||
%endif # flavor != "test"
|
||||
|
||||
%check
|
||||
%if "%{flavor}" == "test"
|
||||
cd testes
|
||||
pushd libs
|
||||
make all LUA_DIR=%{_includedir}/lua%{major_version}
|
||||
%make_build all LUA_DIR=%{_includedir}/lua%{major_version}
|
||||
cp *.so ..
|
||||
popd
|
||||
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/lua%{major_version} all.lua
|
||||
@@ -219,6 +244,7 @@ LD_LIBRARY_PATH=%{_libdir} %{_bindir}/lua%{major_version} all.lua
|
||||
%post -n %{libname} -p /sbin/ldconfig
|
||||
%postun -n %{libname} -p /sbin/ldconfig
|
||||
|
||||
%if %{without libalternatives}
|
||||
%post
|
||||
%{_sbindir}/update-alternatives --install \
|
||||
%{_bindir}/lua lua %{_bindir}/lua%{major_version} 54 \
|
||||
@@ -230,18 +256,13 @@ LD_LIBRARY_PATH=%{_libdir} %{_bindir}/lua%{major_version} all.lua
|
||||
if [ "$1" = 0 ] ; then
|
||||
%{_sbindir}/update-alternatives --remove lua %{_bindir}/lua%{major_version}
|
||||
fi
|
||||
%endif
|
||||
|
||||
%post devel
|
||||
%{_sbindir}/update-alternatives --install \
|
||||
%{_libdir}/liblua.so liblua.so %{_libdir}/liblua%{major_version}.so 54 \
|
||||
--slave %{_libdir}/pkgconfig/lua.pc lua.pc %{_libdir}/pkgconfig/lua%{major_version}.pc
|
||||
|
||||
%postun devel
|
||||
if [ "$1" = 0 ] ; then
|
||||
%{_sbindir}/update-alternatives --remove liblua.so %{_libdir}/liblua%{major_version}.so
|
||||
fi
|
||||
%endif # flavor != "test"
|
||||
|
||||
%if "%{flavor}" != "test"
|
||||
%files
|
||||
%doc README
|
||||
%dir %{_libdir}/lua
|
||||
%dir %{_libdir}/lua/%{major_version}
|
||||
%dir %{_datadir}/lua
|
||||
@@ -250,6 +271,10 @@ fi
|
||||
%{_bindir}/luac%{major_version}
|
||||
%{_mandir}/man1/lua%{major_version}.1%{?ext_man}
|
||||
%{_mandir}/man1/luac%{major_version}.1%{?ext_man}
|
||||
%if %{with libalternatives}
|
||||
%{_datadir}/libalternatives/lua/54.conf
|
||||
%{_datadir}/libalternatives/luac/54.conf
|
||||
%else
|
||||
# alternatives
|
||||
%{_bindir}/lua
|
||||
%{_bindir}/luac
|
||||
@@ -259,6 +284,7 @@ fi
|
||||
%ghost %{_sysconfdir}/alternatives/luac
|
||||
%ghost %{_sysconfdir}/alternatives/lua.1%{ext_man}
|
||||
%ghost %{_sysconfdir}/alternatives/luac.1%{ext_man}
|
||||
%endif
|
||||
|
||||
%files -n %{libname}
|
||||
%{_libdir}/liblua%{major_version}.so.*
|
||||
@@ -273,15 +299,11 @@ fi
|
||||
%{_includedir}/lua%{major_version}/lualib.h
|
||||
%{_libdir}/liblua%{major_version}.so
|
||||
%{_libdir}/pkgconfig/lua%{major_version}.pc
|
||||
# alternatives
|
||||
%{_libdir}/liblua.so
|
||||
%{_libdir}/pkgconfig/lua.pc
|
||||
%ghost %{_sysconfdir}/alternatives/liblua.so
|
||||
%ghost %{_sysconfdir}/alternatives/lua.pc
|
||||
|
||||
%files doc
|
||||
%doc doc/*
|
||||
|
||||
%endif
|
||||
%endif # flavor != "test"
|
||||
|
||||
%changelog
|
||||
|
@@ -2,9 +2,11 @@
|
||||
testes/main.lua | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/testes/main.lua
|
||||
+++ b/testes/main.lua
|
||||
@@ -47,7 +47,7 @@ local function checkprogout (s)
|
||||
Index: lua-5.4.8/testes/main.lua
|
||||
===================================================================
|
||||
--- lua-5.4.8.orig/testes/main.lua 2025-07-15 22:59:14.472309613 +0200
|
||||
+++ lua-5.4.8/testes/main.lua 2025-07-15 22:59:20.829403778 +0200
|
||||
@@ -49,7 +49,7 @@
|
||||
assert(string.sub(s, -1) == "\n")
|
||||
local t = getoutput()
|
||||
for line in string.gmatch(s, ".-\n") do
|
||||
@@ -13,7 +15,7 @@
|
||||
end
|
||||
end
|
||||
|
||||
@@ -367,11 +367,11 @@ a = 2
|
||||
@@ -382,11 +382,11 @@
|
||||
]]
|
||||
RUN([[lua -e "%s" -i < %s > %s]], prompt, prog, out)
|
||||
local t = getoutput()
|
||||
|
@@ -4,8 +4,10 @@
|
||||
src/lundump.h | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/src/ldebug.h
|
||||
+++ b/src/ldebug.h
|
||||
Index: lua-5.4.8/src/ldebug.h
|
||||
===================================================================
|
||||
--- lua-5.4.8.orig/src/ldebug.h 2025-07-15 22:59:14.442309680 +0200
|
||||
+++ lua-5.4.8/src/ldebug.h 2025-07-15 22:59:22.983017316 +0200
|
||||
@@ -36,7 +36,7 @@
|
||||
#endif
|
||||
|
||||
@@ -15,9 +17,11 @@
|
||||
LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n,
|
||||
StkId *pos);
|
||||
LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
|
||||
--- a/src/lmem.h
|
||||
+++ b/src/lmem.h
|
||||
@@ -81,7 +81,7 @@ LUAI_FUNC void *luaM_realloc_ (lua_State
|
||||
Index: lua-5.4.8/src/lmem.h
|
||||
===================================================================
|
||||
--- lua-5.4.8.orig/src/lmem.h 2025-07-15 22:59:14.442309680 +0200
|
||||
+++ lua-5.4.8/src/lmem.h 2025-07-15 22:59:22.983203934 +0200
|
||||
@@ -81,7 +81,7 @@
|
||||
size_t size);
|
||||
LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize,
|
||||
size_t size);
|
||||
@@ -26,9 +30,11 @@
|
||||
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems,
|
||||
int *size, int size_elem, int limit,
|
||||
const char *what);
|
||||
--- a/src/lundump.h
|
||||
+++ b/src/lundump.h
|
||||
@@ -30,7 +30,7 @@
|
||||
Index: lua-5.4.8/src/lundump.h
|
||||
===================================================================
|
||||
--- lua-5.4.8.orig/src/lundump.h 2025-07-15 22:59:14.442309680 +0200
|
||||
+++ lua-5.4.8/src/lundump.h 2025-07-15 22:59:22.983321338 +0200
|
||||
@@ -29,7 +29,7 @@
|
||||
LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
|
||||
|
||||
/* dump one chunk; from ldump.c */
|
||||
|
53
upstream1.patch
Normal file
53
upstream1.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 1b0f943da7dfb25987456a77259edbeea0b94edc Mon Sep 17 00:00:00 2001
|
||||
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
|
||||
Date: Mon, 16 Jun 2025 16:33:02 -0300
|
||||
Subject: [PATCH] Bug: new metatable in weak table can fool the GC
|
||||
|
||||
All-weak tables are not being revisited after being visited during
|
||||
propagation; if it gets a new metatable after that, the new metatable
|
||||
may not be marked.
|
||||
---
|
||||
lgc.c | 8 ++++++--
|
||||
testes/gc.lua | 10 ++++++++++
|
||||
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lgc.c b/lgc.c
|
||||
index 5817f9eec3..c01660abc5 100644
|
||||
--- a/src/lgc.c
|
||||
+++ b/src/lgc.c
|
||||
@@ -553,8 +553,12 @@ static lu_mem traversetable (global_State *g, Table *h) {
|
||||
traverseweakvalue(g, h);
|
||||
else if (!weakvalue) /* strong values? */
|
||||
traverseephemeron(g, h, 0);
|
||||
- else /* all weak */
|
||||
- linkgclist(h, g->allweak); /* nothing to traverse now */
|
||||
+ else { /* all weak */
|
||||
+ if (g->gcstate == GCSpropagate)
|
||||
+ linkgclist(h, g->grayagain); /* must visit again its metatable */
|
||||
+ else
|
||||
+ linkgclist(h, g->allweak); /* must clear collected entries */
|
||||
+ }
|
||||
}
|
||||
else /* not weak */
|
||||
traversestrongtable(g, h);
|
||||
diff --git a/testes/gc.lua b/testes/gc.lua
|
||||
index 03093e34ff..f017f33056 100644
|
||||
--- a/testes/gc.lua
|
||||
+++ b/testes/gc.lua
|
||||
@@ -301,6 +301,16 @@ collectgarbage()
|
||||
assert(next(a) == string.rep('$', 11))
|
||||
|
||||
|
||||
+if T then -- bug since 5.3: all-weak tables are not being revisited
|
||||
+ T.gcstate("propagate")
|
||||
+ local t = setmetatable({}, {__mode = "kv"})
|
||||
+ T.gcstate("atomic") -- 't' was visited
|
||||
+ setmetatable(t, {__mode = "kv"})
|
||||
+ T.gcstate("pause") -- its new metatable is not being visited
|
||||
+ assert(getmetatable(t).__mode == "kv")
|
||||
+end
|
||||
+
|
||||
+
|
||||
-- 'bug' in 5.1
|
||||
a = {}
|
||||
local t = {x = 10}
|
Reference in New Issue
Block a user