SHA256
10
0
forked from pool/lua54

Update to version 5.4.8

* Also add patch upstream1.patch

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
This commit is contained in:
2025-07-12 19:41:06 +01:00
parent b832770e08
commit a815e81e87
7 changed files with 68 additions and 7 deletions

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)

Binary file not shown.

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

Binary file not shown.

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
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>

View File

@@ -26,7 +26,7 @@
%define major_version 5.4
%define libname liblua5_4-5
Name: lua54%{name_ext}
Version: 5.4.7
Version: 5.4.8
Release: 0
Summary: Small Embeddable Language with Procedural Syntax
License: MIT
@@ -45,6 +45,7 @@ Patch3: main_test.patch
Patch6: shared_link.patch
# PATCH-FIX-UPSTREAM inspect errno only after failure
Patch8: execresult.patch
Patch100: upstream1.patch
Requires(post): update-alternatives
Requires(postun):update-alternatives
Provides: lua = %{version}

53
upstream1.patch Normal file
View 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}