Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package lua55 for openSUSE:Factory checked 
in at 2026-01-08 15:25:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/lua55 (Old)
 and      /work/SRC/openSUSE:Factory/.lua55.new.1928 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "lua55"

Thu Jan  8 15:25:58 2026 rev:3 rq:1325525 version:5.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/lua55/lua55.changes      2025-08-06 
15:09:26.042835068 +0200
+++ /work/SRC/openSUSE:Factory/.lua55.new.1928/lua55.changes    2026-01-08 
15:26:45.043364366 +0100
@@ -1,0 +2,39 @@
+Wed Dec 31 01:57:43 UTC 2025 - Matej Cepl <[email protected]>
+
+- Add libdir-luaconf.patch making it possible for the build
+  process to be driven only by the command line arguments of
+  `make` without a need to modify `src/luaconf.h` "manually".
+- Add 32bit-check.patch to fix failed tests on 32bit platforms,
+  to fix 32-bit integer overflow in str_rep function.
+
+-------------------------------------------------------------------
+Wed Dec 31 01:24:14 UTC 2025 - Matej Cepl <[email protected]>
+
+- Update to the final release of 5.5.0, overview of the main
+  changes for this major version:
+  - declarations for global variables
+  - named vararg tables
+  - for-loop variables are read only
+  - floats are printed in decimal with enough digits to be read
+    back correctly.
+  - more levels for constructors
+  - table.create
+  - utf8.offset returns also final position of character
+  - external strings (that use memory not managed by Lua)
+  - new functions luaL_openselectedlibs and luaL_makeseed
+  - major garbage collections done incrementally
+  - more compact arrays (large arrays use about 60% less memory)
+  - lua.c loads 'readline' dynamically
+  - static (fixed) binaries (when loading a binary chunk in
+    memory, Lua can reuse its original memory in some of the
+    internal structures)
+  - dump and undump reuse all strings
+  - auxiliary buffer reuses buffer when it creates final string 
+
+-------------------------------------------------------------------
+Tue Nov 18 19:42:53 UTC 2025 - Matej Cepl <[email protected]>
+
+- Update to 5.5.0-rc1:
+  bugfixes
+
+-------------------------------------------------------------------

Old:
----
  lua-5.5.0-beta.tar.gz

New:
----
  32bit-check.patch
  libdir-luaconf.patch
  lua-5.5.0.tar.gz

----------(New B)----------
  New:  `make` without a need to modify `src/luaconf.h` "manually".
- Add 32bit-check.patch to fix failed tests on 32bit platforms,
  to fix 32-bit integer overflow in str_rep function.
  New:
- Add libdir-luaconf.patch making it possible for the build
  process to be driven only by the command line arguments of
----------(New E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ lua55.spec ++++++
--- /var/tmp/diff_new_pack.lJBqDN/_old  2026-01-08 15:26:45.771394517 +0100
+++ /var/tmp/diff_new_pack.lJBqDN/_new  2026-01-08 15:26:45.775394682 +0100
@@ -27,16 +27,15 @@
 %endif
 %define major_version 5.5
 %define libname liblua5_5-5
-%define upversion 5.5.0-beta
 Name:           lua55%{name_ext}
-Version:        5.5.0~beta1
+Version:        5.5.0
 Release:        0
 Summary:        Small Embeddable Language with Procedural Syntax
 License:        MIT
 Group:          Development/Languages/Other
 URL:            https://www.lua.org
-Source:         https://www.lua.org/work/lua-%{upversion}.tar.gz
-Source1:        https://www.lua.org/work/lua-5.5.0-tests.tar.gz
+Source:         https://www.lua.org/ftp/lua-%{version}.tar.gz
+Source1:        https://www.lua.org/tests/lua-%{version}-tests.tar.gz
 Source99:       baselibs.conf
 # PATCH-FIX-SUSE tweak the buildsystem to produce what is needed for SUSE
 Patch0:         lua-build-system.patch
@@ -48,6 +47,13 @@
 Patch6:         shared_link.patch
 # PATCH-FIX-UPSTREAM inspect errno only after failure
 Patch8:         execresult.patch
+# PATCH-FIX-UPSTREAM libdir-luaconf.patch [email protected]
+# Make the build system controlled only by the command line arguments
+# (no need to modify src/luaconf.h "manually")
+Patch9:         libdir-luaconf.patch
+# PATCH-FIX-UPSTREAM 32bit-check.patch [email protected]
+# fix 32-bit integer overflow in str_rep function
+Patch10:         32bit-check.patch
 BuildRequires:  lua-interpreter
 Requires:       alts
 Requires:       lua-interpreter
@@ -144,23 +150,25 @@
 of C functions, written in ANSI C.
 
 %prep
-%setup -q -n lua-%{upversion} -a1
+%setup -q -n lua-5.5.0 -a1
 mv lua-5.5.0-tests testes
 %autopatch -p1
 
-# manpage
 %if %{without test}
+# manpage
 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 %{without test}
-sed -i -e "s@lib/lua/@%{_lib}/lua/@g" src/luaconf.h
+MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_COMPAT_MODULE" 
+MYCFLAGS="${MYCFLAGS} -DLUA_CDIR=\"%{_libdir}/lua/5.5/\""
+export MYCFLAGS
 %make_build linux -C src \
     CC="cc" LIBDIR="%{_libdir}" \
     LDFLAGS="-lm" \
-    MYCFLAGS="%{optflags} -std=gnu99 -D_GNU_SOURCE -fPIC -DLUA_COMPAT_MODULE" \
+    MYCFLAGS="${MYCFLAGS}"\
     V=%{major_version} \
     LIBTOOL="libtool --quiet"
 %endif

++++++ 32bit-check.patch ++++++
---
 src/lstrlib.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: lua-5.5.0/src/lstrlib.c
===================================================================
--- lua-5.5.0.orig/src/lstrlib.c        2025-12-15 11:44:40.000000000 +0100
+++ lua-5.5.0/src/lstrlib.c     2025-12-31 13:24:10.526974226 +0100
@@ -144,7 +144,7 @@
   if (n <= 0)
     lua_pushliteral(L, "");
   else if (l_unlikely(len > MAX_SIZE - lsep ||
-               cast_st2S(len + lsep) > cast_st2S(MAX_SIZE) / n))
+                (len + lsep > 0 && n > cast_st2S(MAX_SIZE) / cast_st2S(len + 
lsep))))
     return luaL_error(L, "resulting string too large");
   else {
     size_t totallen = (cast_sizet(n) * (len + lsep)) - lsep;
@@ -1726,7 +1726,7 @@
     luaL_argcheck(L, opt != Kstring && opt != Kzstr, 1,
                      "variable-length format");
     size += ntoalign;  /* total space used by option */
-    luaL_argcheck(L, totalsize <= LUA_MAXINTEGER - size,
+    luaL_argcheck(L, totalsize <= MAX_SIZE - size,
                      1, "format result too large");
     totalsize += size;
   }

++++++ _scmsync.obsinfo ++++++
--- /var/tmp/diff_new_pack.lJBqDN/_old  2026-01-08 15:26:45.839397333 +0100
+++ /var/tmp/diff_new_pack.lJBqDN/_new  2026-01-08 15:26:45.847397664 +0100
@@ -1,6 +1,6 @@
-mtime: 1754308374
-commit: bd11caef4ef88cf36db02b84668aab6d1ef4129dc71da71ac17a445601600f73
+mtime: 1767184809
+commit: 88b4b4c4862231d654886669698471b0c416a343fc318591f8d394a23aeda554
 url: https://src.opensuse.org/lua/lua55.git
-revision: bd11caef4ef88cf36db02b84668aab6d1ef4129dc71da71ac17a445601600f73
+revision: 88b4b4c4862231d654886669698471b0c416a343fc318591f8d394a23aeda554
 projectscmsync: https://src.opensuse.org/lua/_ObsPrj.git
 

++++++ attrib_test.patch ++++++
--- /var/tmp/diff_new_pack.lJBqDN/_old  2026-01-08 15:26:45.859398161 +0100
+++ /var/tmp/diff_new_pack.lJBqDN/_new  2026-01-08 15:26:45.859398161 +0100
@@ -2,10 +2,10 @@
  testes/attrib.lua |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-Index: lua-5.5.0-beta/testes/attrib.lua
+Index: lua-5.5.0/testes/attrib.lua
 ===================================================================
---- lua-5.5.0-beta.orig/testes/attrib.lua      2025-06-28 12:06:33.000000000 
+0200
-+++ lua-5.5.0-beta/testes/attrib.lua   2025-07-11 11:26:59.407130105 +0200
+--- lua-5.5.0.orig/testes/attrib.lua   2025-12-15 11:44:41.000000000 +0100
++++ lua-5.5.0/testes/attrib.lua        2025-12-31 02:22:51.648969263 +0100
 @@ -269,7 +269,7 @@
  local st, err, when = package.loadlib(DC"lib1", "*")
  if not st then

++++++ build.specials.obscpio ++++++

++++++ build.specials.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore      1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore      2025-12-31 16:12:29.000000000 +0100
@@ -0,0 +1,6 @@
+.osc
+_scmsync.obsinfo
+.assets/
+_buildconfig-*
+_buildinfo-*.xml
+lua55-*-build/

++++++ files_test.patch ++++++
--- /var/tmp/diff_new_pack.lJBqDN/_old  2026-01-08 15:26:46.043405782 +0100
+++ /var/tmp/diff_new_pack.lJBqDN/_new  2026-01-08 15:26:46.051406113 +0100
@@ -2,10 +2,10 @@
  testes/files.lua |   12 +++++++++---
  1 file changed, 9 insertions(+), 3 deletions(-)
 
-Index: lua-5.5.0-beta/testes/files.lua
+Index: lua-5.5.0/testes/files.lua
 ===================================================================
---- lua-5.5.0-beta.orig/testes/files.lua       2025-06-28 12:06:33.000000000 
+0200
-+++ lua-5.5.0-beta/testes/files.lua    2025-07-11 11:27:35.933693258 +0200
+--- lua-5.5.0.orig/testes/files.lua    2025-12-15 11:44:41.000000000 +0100
++++ lua-5.5.0/testes/files.lua 2025-12-31 02:22:53.840645621 +0100
 @@ -85,7 +85,7 @@
  
  if not _port then   -- invalid seek

++++++ libdir-luaconf.patch ++++++
---
 src/luaconf.h |   25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

Index: lua-5.5.0/src/luaconf.h
===================================================================
--- lua-5.5.0.orig/src/luaconf.h        2025-12-31 11:46:44.519057348 +0100
+++ lua-5.5.0/src/luaconf.h     2025-12-31 12:11:13.610715984 +0100
@@ -239,20 +239,35 @@
 
 #else                  /* }{ */
 
+#ifndef LUA_ROOT
 #define LUA_ROOT       "/usr/"
-#define LUA_LDIR       LUA_ROOT "share/lua/" LUA_VDIR "/"
-#define LUA_CDIR       LUA_ROOT "lib/lua/" LUA_VDIR "/"
+#endif
+
+#define LUA_STR_HELPER(x) #x
+#define LUA_STR(x) LUA_STR_HELPER(x)
+
+#ifdef LUA_LDIR
+#define LUA_LDIR_PATH LUA_STR(LUA_LDIR)
+#else
+#define LUA_LDIR_PATH  LUA_ROOT "share/lua/" LUA_VDIR "/"
+#endif
+
+#ifdef LUA_CDIR
+#define LUA_CDIR_PATH LUA_STR(LUA_CDIR)
+#else
+#define LUA_CDIR_PATH  LUA_ROOT "lib/lua/" LUA_VDIR "/"
+#endif
 
 #if !defined(LUA_PATH_DEFAULT)
 #define LUA_PATH_DEFAULT  \
-               LUA_LDIR"?.lua;"  LUA_LDIR"?/init.lua;" \
-               LUA_CDIR"?.lua;"  LUA_CDIR"?/init.lua;" \
+               LUA_LDIR_PATH"?.lua;"  LUA_LDIR_PATH"?/init.lua;" \
+               LUA_CDIR_PATH"?.lua;"  LUA_CDIR_PATH"?/init.lua;" \
                "./?.lua;" "./?/init.lua"
 #endif
 
 #if !defined(LUA_CPATH_DEFAULT)
 #define LUA_CPATH_DEFAULT \
-               LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so"
+               LUA_CDIR_PATH"?.so;" LUA_CDIR_PATH"loadall.so;" "./?.so"
 #endif
 
 #endif                 /* } */

++++++ lua-5.5.0-tests.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/api.lua new/lua-5.5.0-tests/api.lua
--- old/lua-5.5.0-tests/api.lua 2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/api.lua 2025-12-15 11:44:40.000000000 +0100
@@ -246,7 +246,8 @@
 assert(not T.testC("compare LE 9 1, return 1"))
 assert(not T.testC("compare EQ 9 9, return 1"))
 
-local b = {__lt = function (a,b) return a[1] < b[1] end}
+local b = {__lt = function (a,b) return a[1] < b[1] end,
+           __le = function (a,b) return a[1] <= b[1] end}
 local a1,a3,a4 = setmetatable({1}, b),
                  setmetatable({3}, b),
                  setmetatable({4}, b)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/attrib.lua 
new/lua-5.5.0-tests/attrib.lua
--- old/lua-5.5.0-tests/attrib.lua      2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/attrib.lua      2025-12-15 11:44:41.000000000 +0100
@@ -308,11 +308,11 @@
   _ENV.x, _ENV.y = nil
 end
 
+
 _ENV = _G
 
 
 -- testing preload
-
 do
   local p = package
   package = {}
@@ -331,6 +331,26 @@
   assert(type(package.path) == "string")
 end
 
+
+do  print("testing external strings")
+  package.cpath = DC"?"
+  local lib2 = require"lib2-v2"
+  local t = {}
+  for _, len in ipairs{0, 10, 39, 40, 41, 1000} do
+    local str = string.rep("a", len)
+    local str1 = lib2.newstr(str)
+    assert(str == str1)
+    assert(not T or T.hash(str) == T.hash(str1))
+    t[str1] = 20; assert(t[str] == 20 and t[str1] == 20)
+    t[str] = 10; assert(t[str1] == 10)
+    local tt = {[str1] = str1}
+    assert(next(tt) == str1 and next(tt, str1) == nil)
+    assert(tt[str] == str)
+    local str2 = lib2.newstr(str1)
+    assert(str == str2 and t[str2] == 10 and tt[str2] == str)
+  end
+end
+
 print('+')
 
 end  --]
@@ -447,7 +467,7 @@
 end
 
 
--- test of large float/integer indices 
+-- test of large float/integer indices
 
 -- compute maximum integer where all bits fit in a float
 local maxint = math.maxinteger
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/bwcoercion.lua 
new/lua-5.5.0-tests/bwcoercion.lua
--- old/lua-5.5.0-tests/bwcoercion.lua  2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/bwcoercion.lua  2025-12-15 11:44:41.000000000 +0100
@@ -4,7 +4,7 @@
 
 local print = print
 
-_ENV = nil
+global none
 
 -- Try to convert a value to an integer, without assuming any coercion.
 local function toint (x)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/calls.lua 
new/lua-5.5.0-tests/calls.lua
--- old/lua-5.5.0-tests/calls.lua       2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/calls.lua       2025-12-15 11:44:41.000000000 +0100
@@ -24,7 +24,7 @@
 
 
 -- testing local-function recursion
-global fact; fact = false
+global fact = false
 do
   local res = 1
   local function fact (n)
@@ -65,7 +65,7 @@
 
 print('+')
 
-global t; t = nil   -- 'declare' t
+global t = nil   -- 'declare' t
 function f(a,b,c) local d = 'a'; t={a,b,c,d} end
 
 f(      -- this line change must be valid
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/coroutine.lua 
new/lua-5.5.0-tests/coroutine.lua
--- old/lua-5.5.0-tests/coroutine.lua   2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/coroutine.lua   2025-12-15 11:44:41.000000000 +0100
@@ -702,7 +702,9 @@
     assert(t.currentline == t.linedefined + 2)
     assert(not debug.getinfo(c, 1))      -- no other level
     assert(coroutine.resume(c))          -- run next line
-    local n,v = debug.getlocal(c, 0, 2)    -- check next local
+    local n,v = debug.getlocal(c, 0, 2)    -- check vararg table
+    assert(n == "(vararg table)" and v == nil)
+    local n,v = debug.getlocal(c, 0, 3)    -- check next local
     assert(n == "b" and v == 10)
     v = {coroutine.resume(c)}         -- finish coroutine
     assert(v[1] == true and v[2] == 2 and v[3] == 3 and v[4] == undef)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/db.lua new/lua-5.5.0-tests/db.lua
--- old/lua-5.5.0-tests/db.lua  2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/db.lua  2025-12-15 11:44:41.000000000 +0100
@@ -356,8 +356,8 @@
   global assert, g, string
   local _, y = debug.getlocal(1, 2)
   assert(x == a and y == b)
-  assert(debug.setlocal(2, 3, "pera") == "AA".."AA")
-  assert(debug.setlocal(2, 4, "manga") == "B")
+  assert(debug.setlocal(2, 4, "pera") == "AA".."AA")
+  assert(debug.setlocal(2, 5, "manga") == "B")
   x = debug.getinfo(2)
   assert(x.func == g and x.what == "Lua" and x.name == 'g' and
          x.nups == 2 and string.find(x.source, "^@.*db%.lua$"))
@@ -392,7 +392,7 @@
      global *
      local B = 13
      global<const> assert
-     local x,y = debug.getlocal(1,5)
+     local x,y = debug.getlocal(1,6)
      assert(x == 'B' and y == 13)
   end
 end
@@ -458,7 +458,8 @@
   local tab = {}
   for i = 1, math.huge do
     local n, v = debug.getlocal(level + 1, i)
-    if not (n and string.find(n, "^[a-zA-Z0-9_]+$")) then
+    if not (n and string.find(n, "^[a-zA-Z0-9_]+$") or
+            n == "(vararg table)") then
        break   -- consider only real variables
     end
     tab[n] = v
@@ -725,6 +726,9 @@
 t = debug.getinfo(function (a,b,...) return t[a] end, "u")
 assert(t.isvararg == true and t.nparams == 2 and t.nups == 1)
 
+t = debug.getinfo(function (a,b,...t) t.n = 2; return t[a] end, "u")
+assert(t.isvararg == true and t.nparams == 2 and t.nups == 0)
+
 t = debug.getinfo(1)   -- main
 assert(t.isvararg == true and t.nparams == 0 and t.nups == 1 and
        debug.getupvalue(t.func, 1) == "_ENV")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/errors.lua 
new/lua-5.5.0-tests/errors.lua
--- old/lua-5.5.0-tests/errors.lua      2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/errors.lua      2025-12-15 11:44:41.000000000 +0100
@@ -418,28 +418,28 @@
 
 -- testing line error
 
-local function lineerror (s, l)
+local function lineerror (s, l, w)
   local err,msg = pcall(load(s))
   local line = tonumber(string.match(msg, ":(%d+):"))
-  assert(line == l or (not line and not l))
+  assert((line == l or (not line and not l)) and string.find(msg, w))
 end
 
-lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2)
-lineerror("\n local a \n for k,v in 3 \n do \n print(k) \n end", 3)
-lineerror("\n\n for k,v in \n 3 \n do \n print(k) \n end", 4)
-lineerror("function a.x.y ()\na=a+1\nend", 1)
-
-lineerror("a = \na\n+\n{}", 3)
-lineerror("a = \n3\n+\n(\n4\n/\nprint)", 6)
-lineerror("a = \nprint\n+\n(\n4\n/\n7)", 3)
+lineerror("local a\n for i=1,'a' do \n print(i) \n end", 2, "limit")
+lineerror("\n local a \n for k,v in 3 \n do \n print(k) \n end", 3, "to call")
+lineerror("\n\n for k,v in \n 3 \n do \n print(k) \n end", 4, "to call")
+lineerror("function a.x.y ()\na=a+1\nend", 1, "index")
+
+lineerror("a = \na\n+\n{}", 3, "arithmetic")
+lineerror("a = \n3\n+\n(\n4\n/\nprint)", 6, "arithmetic")
+lineerror("a = \nprint\n+\n(\n4\n/\n7)", 3, "arithmetic")
 
-lineerror("a\n=\n-\n\nprint\n;", 3)
+lineerror("a\n=\n-\n\nprint\n;", 3, "arithmetic")
 
 lineerror([[
 a
 (     -- <<
 23)
-]], 2)
+]], 2, "call")
 
 lineerror([[
 local a = {x = 13}
@@ -449,7 +449,7 @@
 (     -- <<
 23
 )
-]], 5)
+]], 5, "call")
 
 lineerror([[
 local a = {x = 13}
@@ -459,17 +459,17 @@
 (
 23 + a
 )
-]], 6)
+]], 6, "arithmetic")
 
 local p = [[
   function g() f() end
   function f(x) error('a', XX) end
 g()
 ]]
-XX=3;lineerror((p), 3)
-XX=0;lineerror((p), false)
-XX=1;lineerror((p), 2)
-XX=2;lineerror((p), 1)
+XX=3;lineerror((p), 3, "a")
+XX=0;lineerror((p), false, "a")
+XX=1;lineerror((p), 2, "a")
+XX=2;lineerror((p), 1, "a")
 _G.XX, _G.g, _G.f = nil
 
 
@@ -477,7 +477,7 @@
 local b = false
 if not b then
   error 'test'
-end]], 3)
+end]], 3, "test")
 
 lineerror([[
 local b = false
@@ -487,7 +487,7 @@
       error 'test'
     end
   end
-end]], 5)
+end]], 5, "test")
 
 lineerror([[
 _ENV = 1
@@ -495,7 +495,7 @@
   local a = 10
   return a
 end
-]], 2)
+]], 2, "index")
 
 
 -- bug in 5.4.0
@@ -503,17 +503,37 @@
   local a = 0
   local b = 1
   local c = b % a
-]], 3)
+]], 3, "perform")
 
 do
   -- Force a negative estimate for base line. Error in instruction 2
   -- (after VARARGPREP, GETGLOBAL), with first absolute line information
   -- (forced by too many lines) in instruction 0.
   local s = string.format("%s return __A.x", string.rep("\n", 300))
-  lineerror(s, 301)
+  lineerror(s, 301, "index")
 end
 
 
+local function stxlineerror (s, l, w)
+  local err,msg = load(s)
+  local line = tonumber(string.match(msg, ":(%d+):"))
+  assert((line == l or (not line and not l)) and string.find(msg, w, 1, true))
+end
+
+stxlineerror([[
+::L1::
+::L1::
+]], 2, "already defined")
+
+stxlineerror([[
+global none
+local x = b
+]], 2, "not declared")
+
+stxlineerror([[
+local <close> a, b
+]], 1, "multiple")
+
 if not _soft then
   -- several tests that exhaust the Lua stack
   collectgarbage()
@@ -689,21 +709,26 @@
 -- testing syntax limits
 
 local function testrep (init, rep, close, repc, finalresult)
-  local s = init .. string.rep(rep, 100) .. close .. string.rep(repc, 100)
-  local res, msg = load(s)
-  assert(res)   -- 100 levels is OK
+  local function gencode (n)
+    return init .. string.rep(rep, n) .. close .. string.rep(repc, n)
+  end
+  local res, msg = load(gencode(100))   -- 100 levels is OK
+  assert(res)
   if (finalresult) then
     assert(res() == finalresult)
   end
-  s = init .. string.rep(rep, 500)
-  local res, msg = load(s)   -- 500 levels not ok
+  local res, msg = load(gencode(500))   -- 500 levels not ok
   assert(not res and (string.find(msg, "too many") or
                       string.find(msg, "overflow")))
 end
 
+testrep("local a", ",a", ";", "")    -- local variables
+testrep("local a", ",a", "= 1", ",1")    -- local variables initialized
+testrep("local a", ",a", "= f()", "")    -- local variables initialized
 testrep("local a; a", ",a", "= 1", ",1")    -- multiple assignment
-testrep("local a; a=", "{", "0", "}")
-testrep("return ", "(", "2", ")", 2)
+testrep("local a; a=", "{", "0", "}")   -- constructors
+testrep("return ", "(", "2", ")", 2)  -- parentheses
+-- nested calls  (a(a(a(a(...)))))
 testrep("local function a (x) return x end; return ", "a(", "2.2", ")", 2.2)
 testrep("", "do ", "", " end")
 testrep("", "while a do ", "", " end")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/files.lua 
new/lua-5.5.0-tests/files.lua
--- old/lua-5.5.0-tests/files.lua       2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/files.lua       2025-12-15 11:44:41.000000000 +0100
@@ -715,7 +715,7 @@
 end
 
 
-if T and T.nonblock then
+if T and T.nonblock and not _port then
   print("testing failed write")
 
   -- unable to write anything to /dev/full
@@ -840,7 +840,7 @@
 local x = string.rep("a", 10000)
 assert(os.date(x) == x)
 local t = os.time()
-global D; D = os.date("*t", t)
+global D = os.date("*t", t)
 assert(os.date(string.rep("%d", 1000), t) ==
        string.rep(os.date("%d", t), 1000))
 assert(os.date(string.rep("%", 200)) == string.rep("%", 100))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/gengc.lua 
new/lua-5.5.0-tests/gengc.lua
--- old/lua-5.5.0-tests/gengc.lua       2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/gengc.lua       2025-12-15 11:44:41.000000000 +0100
@@ -176,6 +176,20 @@
   assert(collectgarbage("param", "stepsize") == step)
 end
 
+
+if T then   -- test GC parameter codification
+  for _, percentage in ipairs{5, 10, 12, 20, 50, 100, 200, 500} do
+    local param = T.codeparam(percentage)   -- codify percentage
+    for _, value in ipairs{1, 2, 10, 100, 257, 1023, 6500, 100000} do
+      local exact = value*percentage // 100
+      local aprox = T.applyparam(param, value)   -- apply percentage
+      -- difference is at most 10% (+1 compensates difference due to
+      -- rounding to integers)
+      assert(math.abs(aprox - exact) <= exact/10 + 1)
+    end
+  end
+end
+
 collectgarbage(oldmode)
 
 print('OK')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/goto.lua new/lua-5.5.0-tests/goto.lua
--- old/lua-5.5.0-tests/goto.lua        2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/goto.lua        2025-12-15 11:44:41.000000000 +0100
@@ -293,6 +293,7 @@
 foo()
 --------------------------------------------------------------------------
 
+-- check for compilation errors
 local function checkerr (code, err)
   local st, msg = load(code)
   assert(not st and string.find(msg, err))
@@ -380,7 +381,7 @@
   global *
   Y = x + Y
   assert(_ENV.Y == 20)
-
+  Y = nil
 end
 
 
@@ -411,5 +412,66 @@
   _ENV.x200 = nil
 end
 
+do  print "testing initialization in global declarations"
+  global<const> a, b, c = 10, 20, 30
+  assert(_ENV.a == 10 and b == 20 and c == 30)
+  _ENV.a = nil; _ENV.b = nil; _ENV.c = nil;
+
+  global<const> a, b, c = 10
+  assert(_ENV.a == 10 and b == nil and c == nil)
+  _ENV.a = nil; _ENV.b = nil; _ENV.c = nil;
+
+  global table
+  global a, b, c, d = table.unpack{1, 2, 3, 6, 5}
+  assert(_ENV.a == 1 and b == 2 and c == 3 and d == 6)
+  a = nil; b = nil; c = nil; d = nil
+
+  local a, b = 100, 200
+  do
+    global a, b = a, b
+  end
+  assert(_ENV.a == 100 and _ENV.b == 200)
+  _ENV.a = nil; _ENV.b = nil
+
+
+  assert(_ENV.a == nil and _ENV.b == nil and _ENV.c == nil and _ENV.d == nil)
+end
+
+do
+  global table, string
+  -- global initialization when names don't fit in K
+
+  -- to fill constant table
+  local code = {}
+  for i = 1, 300 do code[i] = "'" .. i .. "'" end
+  code = table.concat(code, ",")
+  code = string.format([[
+    return function (_ENV)
+      local dummy = {%s}  -- fill initial positions in constant table,
+      -- so that initialization must use registers for global names
+      global a, b, c = 10, 20, 30
+    end]], code)
+
+  local fun = assert(load(code))()
+
+  local env = {}
+  fun(env)
+  assert(env.a == 10 and env.b == 20 and env.c == 30)
+end
+
+
+do  -- testing global redefinitions
+  -- cannot use 'checkerr' as errors are not compile time
+  global pcall
+  local f = assert(load("global print = 10"))
+  local st, msg = pcall(f)
+  assert(string.find(msg, "global 'print' already defined"))
+
+  local f = assert(load("local _ENV = {AA = false}; global AA = 10"))
+  local st, msg = pcall(f)
+  assert(string.find(msg, "global 'AA' already defined"))
+
+end
+
 print'OK'
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/heavy.lua 
new/lua-5.5.0-tests/heavy.lua
--- old/lua-5.5.0-tests/heavy.lua       2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/heavy.lua       2025-12-15 11:44:41.000000000 +0100
@@ -1,6 +1,8 @@
 -- $Id: testes/heavy.lua,v $
 -- See Copyright Notice in file lua.h
 
+global <const> *
+
 local function teststring ()
   print("creating a string too long")
   do
@@ -47,9 +49,9 @@
 end
 
 
-function controlstruct ()
+local function controlstruct ()
   print("control structure too long")
-  local lim = ((1 << 24) - 2) // 3
+  local lim = ((1 << 24) - 2) // 4
   local s = string.rep("a = a + 1\n", lim)
   s = "while true do " .. s .. "end"
   assert(load(s))
@@ -63,7 +65,7 @@
 end
 
 
-function manylines ()
+local function manylines ()
   print("loading chunk with too many lines")
   local st, msg = loadrep("\n", "lines")
   assert(not st and string.find(msg, "too many lines"))
@@ -71,7 +73,7 @@
 end
 
 
-function hugeid ()
+local function hugeid ()
   print("loading chunk with huge identifier")
   local st, msg = loadrep("a", "chars")
   assert(not st and 
@@ -80,7 +82,7 @@
   print('+')
 end
 
-function toomanyinst ()
+local function toomanyinst ()
   print("loading chunk with too many instructions")
   local st, msg = loadrep("a = 10; ", "instructions")
   print('+')
@@ -107,7 +109,7 @@
 end
 
 
-function toomanyconst ()
+local function toomanyconst ()
   print("loading function with too many constants")
   loadrepfunc("function foo () return {0,",
       function (n)
@@ -126,7 +128,7 @@
 end
 
 
-function toomanystr ()
+local function toomanystr ()
   local a = {}
   local st, msg = pcall(function ()
     for i = 1, math.huge do
@@ -144,7 +146,7 @@
 end
 
 
-function toomanyidx ()
+local function toomanyidx ()
   local a = {}
   local st, msg = pcall(function ()
     for i = 1, math.huge do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/libs/lib11.c 
new/lua-5.5.0-tests/libs/lib11.c
--- old/lua-5.5.0-tests/libs/lib11.c    2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/libs/lib11.c    2025-12-15 11:44:41.000000000 +0100
@@ -1,7 +1,7 @@
 #include "lua.h"
 
 /* function from lib1.c */
-int lib1_export (lua_State *L);
+LUAMOD_API int lib1_export (lua_State *L);
 
 LUAMOD_API int luaopen_lib11 (lua_State *L) {
   return lib1_export(L);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/libs/lib22.c 
new/lua-5.5.0-tests/libs/lib22.c
--- old/lua-5.5.0-tests/libs/lib22.c    2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/libs/lib22.c    2025-12-15 11:44:41.000000000 +0100
@@ -1,3 +1,7 @@
+/* implementation for lib2-v2 */
+
+#include <string.h>
+
 #include "lua.h"
 #include "lauxlib.h"
 
@@ -8,8 +12,54 @@
 }
 
 
+struct STR {
+  void *ud;
+  lua_Alloc allocf;
+};
+
+
+static void *t_freestr (void *ud, void *ptr, size_t osize, size_t nsize) {
+  struct STR *blk = (struct STR*)ptr - 1;
+  blk->allocf(blk->ud, blk, sizeof(struct STR) + osize, 0);
+  return NULL;
+}
+
+
+static int newstr (lua_State *L) {
+  size_t len;
+  const char *str = luaL_checklstring(L, 1, &len);
+  void *ud;
+  lua_Alloc allocf = lua_getallocf(L, &ud);
+  struct STR *blk = (struct STR*)allocf(ud, NULL, 0,
+                                        len + 1 + sizeof(struct STR));
+  if (blk == NULL) {  /* allocation error? */
+    lua_pushliteral(L, "not enough memory");
+    lua_error(L);  /* raise a memory error */
+  }
+  blk->ud = ud;  blk->allocf = allocf;
+  memcpy(blk + 1, str, len + 1);
+  lua_pushexternalstring(L, (char *)(blk + 1), len, t_freestr, L);
+  return 1;
+}
+
+
+/*
+** Create an external string and keep it in the registry, so that it
+** will test that the library code is still available (to deallocate
+** this string) when closing the state.
+*/
+static void initstr (lua_State *L) {
+  lua_pushcfunction(L, newstr);
+  lua_pushstring(L,
+     "012345678901234567890123456789012345678901234567890123456789");
+  lua_call(L, 1, 1);  /* call newstr("0123...") */
+  luaL_ref(L, LUA_REGISTRYINDEX);  /* keep string in the registry */
+}
+
+
 static const struct luaL_Reg funcs[] = {
   {"id", id},
+  {"newstr", newstr},
   {NULL, NULL}
 };
 
@@ -18,6 +68,7 @@
   lua_settop(L, 2);
   lua_setglobal(L, "y");  /* y gets 2nd parameter */
   lua_setglobal(L, "x");  /* x gets 1st parameter */
+  initstr(L);
   luaL_newlib(L, funcs);
   return 1;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/libs/makefile 
new/lua-5.5.0-tests/libs/makefile
--- old/lua-5.5.0-tests/libs/makefile   2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/libs/makefile   2025-12-15 11:44:41.000000000 +0100
@@ -5,7 +5,7 @@
 CC = gcc
 
 # compilation should generate Dynamic-Link Libraries
-CFLAGS = -Wall -std=c99 -O2 -I$(LUA_DIR) -fPIC -shared
+CFLAGS = -Wall -O2 -I$(LUA_DIR) -fPIC -shared
 
 # libraries used by the tests
 all: lib1.so lib11.so lib2.so lib21.so lib2-v2.so
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/locals.lua 
new/lua-5.5.0-tests/locals.lua
--- old/lua-5.5.0-tests/locals.lua      2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/locals.lua      2025-12-15 11:44:41.000000000 +0100
@@ -310,8 +310,7 @@
   local function foo (howtoclose, obj, n)
     local ca   -- copy of 'a' visible inside its close metamethod
     do
-      local a <close> = func2close(function (...)
-        local t = table.pack(...)
+      local a <close> = func2close(function (...t)
         assert(select("#", ...) == n)
         assert(t.n == n and t[1] == ca and (t.n < 2 or t[2] == obj))
         ca = 15   -- final value to be returned if howtoclose=="scope"
@@ -911,8 +910,7 @@
 
   local extrares    -- result from extra yield (if any)
 
-  local function check (body, extra, ...)
-    local t = table.pack(...)   -- expected returns
+  local function check (body, extra, ...t)
     local co = coroutine.wrap(body)
     if extra then
       extrares = co()    -- runs until first (extra) yield
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/ltests/ltests.c 
new/lua-5.5.0-tests/ltests/ltests.c
--- old/lua-5.5.0-tests/ltests/ltests.c 2025-06-28 12:06:32.000000000 +0200
+++ new/lua-5.5.0-tests/ltests/ltests.c 2025-12-15 11:44:40.000000000 +0100
@@ -164,13 +164,13 @@
 
 #define MARK           0x55  /* 01010101 (a nice pattern) */
 
-typedef union Header {
+typedef union memHeader {
   LUAI_MAXALIGN;
   struct {
     size_t size;
     int type;
   } d;
-} Header;
+} memHeader;
 
 
 #if !defined(EXTERNMEMCHECK)
@@ -193,14 +193,14 @@
    {0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL}};
 
 
-static void freeblock (Memcontrol *mc, Header *block) {
+static void freeblock (Memcontrol *mc, memHeader *block) {
   if (block) {
     size_t size = block->d.size;
     int i;
     for (i = 0; i < MARKSIZE; i++)  /* check marks after block */
       lua_assert(*(cast_charp(block + 1) + size + i) == MARK);
     mc->objcount[block->d.type]--;
-    fillmem(block, sizeof(Header) + size + MARKSIZE);  /* erase block */
+    fillmem(block, sizeof(memHeader) + size + MARKSIZE);  /* erase block */
     free(block);  /* actually free block */
     mc->numblocks--;  /* update counts */
     mc->total -= size;
@@ -210,7 +210,7 @@
 
 void *debug_realloc (void *ud, void *b, size_t oldsize, size_t size) {
   Memcontrol *mc = cast(Memcontrol *, ud);
-  Header *block = cast(Header *, b);
+  memHeader *block = cast(memHeader *, b);
   int type;
   if (mc->memlimit == 0) {  /* first time? */
     char *limit = getenv("MEMLIMIT");  /* initialize memory limit */
@@ -241,12 +241,12 @@
   if (size > oldsize && mc->total+size-oldsize > mc->memlimit)
     return NULL;  /* fake a memory allocation error */
   else {
-    Header *newblock;
+    memHeader *newblock;
     int i;
     size_t commonsize = (oldsize < size) ? oldsize : size;
-    size_t realsize = sizeof(Header) + size + MARKSIZE;
+    size_t realsize = sizeof(memHeader) + size + MARKSIZE;
     if (realsize < size) return NULL;  /* arithmetic overflow! */
-    newblock = cast(Header *, malloc(realsize));  /* alloc a new block */
+    newblock = cast(memHeader *, malloc(realsize));  /* alloc a new block */
     if (newblock == NULL)
       return NULL;  /* really out of memory? */
     if (block) {
@@ -480,7 +480,7 @@
 }
 
 
-static void checkstack (global_State *g, lua_State *L1) {
+static void check_stack (global_State *g, lua_State *L1) {
   StkId o;
   CallInfo *ci;
   UpVal *uv;
@@ -517,7 +517,7 @@
       break;
     }
     case LUA_VTHREAD: {
-      checkstack(g, gco2th(o));
+      check_stack(g, gco2th(o));
       break;
     }
     case LUA_VLCL: {
@@ -908,6 +908,17 @@
 }
 
 
+static int get_sizes (lua_State *L) {
+  lua_newtable(L);
+  setnameval(L, "Lua state", sizeof(lua_State));
+  setnameval(L, "global state", sizeof(global_State));
+  setnameval(L, "TValue", sizeof(TValue));
+  setnameval(L, "Node", sizeof(Node));
+  setnameval(L, "stack Value", sizeof(StackValue));
+  return 1;
+}
+
+
 static int mem_query (lua_State *L) {
   if (lua_isnone(L, 1)) {
     lua_pushinteger(L, cast_Integer(l_memcontrol.total));
@@ -1066,8 +1077,12 @@
 
 static int hash_query (lua_State *L) {
   if (lua_isnone(L, 2)) {
+    TString *ts;
     luaL_argcheck(L, lua_type(L, 1) == LUA_TSTRING, 1, "string expected");
-    lua_pushinteger(L, cast_int(tsvalue(obj_at(L, 1))->hash));
+    ts = tsvalue(obj_at(L, 1));
+    if (ts->tt == LUA_VLNGSTR)
+      luaS_hashlongstr(ts);  /* make sure long string has a hash */
+    lua_pushinteger(L, cast_int(ts->hash));
   }
   else {
     TValue *o = obj_at(L, 1);
@@ -2167,6 +2182,7 @@
   {"s2d", s2d},
   {"sethook", sethook},
   {"stacklevel", stacklevel},
+  {"sizes", get_sizes},
   {"testC", testC},
   {"makeCfunc", makeCfunc},
   {"totalmem", mem_query},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/ltests/ltests.h 
new/lua-5.5.0-tests/ltests/ltests.h
--- old/lua-5.5.0-tests/ltests/ltests.h 2025-06-28 12:06:32.000000000 +0200
+++ new/lua-5.5.0-tests/ltests/ltests.h 2025-12-15 11:44:40.000000000 +0100
@@ -13,7 +13,6 @@
 
 /* test Lua with compatibility code */
 #define LUA_COMPAT_MATHLIB
-#define LUA_COMPAT_LT_LE
 #undef LUA_COMPAT_GLOBAL
 
 
@@ -64,7 +63,7 @@
 
 
 #define luai_tracegc(L,f)              luai_tracegctest(L, f)
-LUAI_FUNC void luai_tracegctest (lua_State *L, int first);
+extern void luai_tracegctest (lua_State *L, int first);
 
 
 /*
@@ -76,26 +75,26 @@
 /*
 ** Function to traverse and check all memory used by Lua
 */
-LUAI_FUNC int lua_checkmemory (lua_State *L);
+extern int lua_checkmemory (lua_State *L);
 
 /*
 ** Function to print an object GC-friendly
 */
 struct GCObject;
-LUAI_FUNC void lua_printobj (lua_State *L, struct GCObject *o);
+extern void lua_printobj (lua_State *L, struct GCObject *o);
 
 
 /*
 ** Function to print a value
 */
 struct TValue;
-LUAI_FUNC void lua_printvalue (struct TValue *v);
+extern void lua_printvalue (struct TValue *v);
 
 /*
 ** Function to print the stack
 */
-LUAI_FUNC void lua_printstack (lua_State *L);
-LUAI_FUNC int lua_printallstack (lua_State *L);
+extern void lua_printstack (lua_State *L);
+extern int lua_printallstack (lua_State *L);
 
 
 /* test for lock/unlock */
@@ -122,14 +121,14 @@
 LUA_API void *debug_realloc (void *ud, void *block,
                              size_t osize, size_t nsize);
 
-#if defined(lua_c)
+
 #define luaL_newstate()  \
        lua_newstate(debug_realloc, &l_memcontrol, luaL_makeseed(NULL))
 #define luai_openlibs(L)  \
   {  luaL_openlibs(L); \
      luaL_requiref(L, "T", luaB_opentests, 1); \
      lua_pop(L, 1); }
-#endif
+
 
 
 
@@ -143,19 +142,13 @@
 #define STRCACHE_N     23
 #define STRCACHE_M     5
 
-
-/*
-** This one is not compatible with tests for opcode optimizations,
-** as it blocks some optimizations
-#define MAXINDEXRK     0
-*/
+#define MAXINDEXRK     1
 
 
 /*
 ** Reduce maximum stack size to make stack-overflow tests run faster.
 ** (But value is still large enough to overflow smaller integers.)
 */
-#undef LUAI_MAXSTACK
 #define LUAI_MAXSTACK   68000
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/main.lua new/lua-5.5.0-tests/main.lua
--- old/lua-5.5.0-tests/main.lua        2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/main.lua        2025-12-15 11:44:41.000000000 +0100
@@ -90,7 +90,7 @@
 1, a
 )
 ]]
-RUN('lua - < %s > %s', prog, out)
+RUN('lua - -- < %s > %s', prog, out)
 checkout("1\tnil\n")
 
 RUN('echo "print(10)\nprint(2)\n" | lua > %s', out)
@@ -133,7 +133,7 @@
 prepfile("print(package.path)")
 
 -- test LUA_PATH
-RUN('env LUA_INIT= LUA_PATH=x lua %s > %s', prog, out)
+RUN('env LUA_INIT= LUA_PATH=x lua -- %s > %s', prog, out)
 checkout("x\n")
 
 -- test LUA_PATH_version
@@ -358,7 +358,7 @@
 checkprogout("6\n10\n10\n\n")
 
 prepfile("a = [[b\nc\nd\ne]]\na")
-RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i < %s > %s]], prog, out)
+RUN([[lua -e"_PROMPT='' _PROMPT2=''" -i -- < %s > %s]], prog, out)
 checkprogout("b\nc\nd\ne\n\n")
 
 -- input interrupted in continuation line
@@ -488,12 +488,13 @@
 -- invalid options
 NoRun("unrecognized option '-h'", "lua -h")
 NoRun("unrecognized option '---'", "lua ---")
-NoRun("unrecognized option '-Ex'", "lua -Ex")
+NoRun("unrecognized option '-Ex'", "lua -Ex --")
 NoRun("unrecognized option '-vv'", "lua -vv")
 NoRun("unrecognized option '-iv'", "lua -iv")
 NoRun("'-e' needs argument", "lua -e")
 NoRun("syntax error", "lua -e a")
 NoRun("'-l' needs argument", "lua -l")
+NoRun("-i", "lua -- -i")   -- handles -i as a script name
 
 
 if T then   -- test library?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/math.lua new/lua-5.5.0-tests/math.lua
--- old/lua-5.5.0-tests/math.lua        2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/math.lua        2025-12-15 11:44:41.000000000 +0100
@@ -685,6 +685,18 @@
 assert(eq(math.sin(10), math.sin(10%(2*math.pi))))
 
 
+do  print("testing ldexp/frexp")
+  global ipairs
+  for _, x in ipairs{0, 10, 32, -math.pi, 1e10, 1e-10, math.huge, -math.huge} 
do
+    local m, p = math.frexp(x)
+    assert(math.ldexp(m, p) == x)
+    local am = math.abs(m)
+    assert(m == x or (0.5 <= am and am < 1))
+  end
+
+end
+
+
 assert(tonumber(' 1.3e-2 ') == 1.3e-2)
 assert(tonumber(' -1.00000000000001 ') == -1.00000000000001)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/memerr.lua 
new/lua-5.5.0-tests/memerr.lua
--- old/lua-5.5.0-tests/memerr.lua      2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/memerr.lua      2025-12-15 11:44:41.000000000 +0100
@@ -42,8 +42,12 @@
 T.alloccount()          -- remove limit
 
 
+-- preallocate stack space
+local function deep (n) if n > 0 then deep(n - 1) end end
+
+
 -- test memory errors; increase limit for maximum memory by steps,
--- o that we get memory errors in all allocations of a given
+-- so that we get memory errors in all allocations of a given
 -- task, until there is enough memory to complete the task without
 -- errors.
 local function testbytes (s, f)
@@ -53,6 +57,7 @@
   local a,b = nil
   while true do
     collectgarbage(); collectgarbage()
+    deep(4)
     T.totalmem(M)
     a, b = T.testC("pcall 0 1 0; pushstatus; return 2", f)
     T.totalmem(0)  -- remove limit
@@ -77,6 +82,7 @@
   local a,b = nil
   while true do
     collectgarbage(); collectgarbage()
+    deep(4)
     T.alloccount(M)
     a, b = T.testC("pcall 0 1 0; pushstatus; return 2", f)
     T.alloccount()  -- remove limit
@@ -87,21 +93,19 @@
     M = M + 1   -- increase allocation limit
   end
   print(string.format("minimum allocations for %s: %d allocations", s, M))
-  return a
+  return M
 end
 
 
 local function testamem (s, f)
-  testalloc(s, f)
-  return testbytes(s, f)
+  local aloc = testalloc(s, f)
+  local res = testbytes(s, f)
+  return {aloc = aloc, res = res}
 end
 
 
--- doing nothing
-b = testamem("doing nothing", function () return 10 end)
-assert(b == 10)
-
--- testing memory errors when creating a new state
+local b = testamem("function call", function () return 10 end)
+assert(b.res == 10 and b.aloc == 0)
 
 testamem("state creation", function ()
   local st = T.newstate()
@@ -121,6 +125,18 @@
            return coroutine.create(print)
 end)
 
+do  -- vararg tables
+  local function pack (...t) return t end
+  local b = testamem("vararg table", function ()
+    return pack(10, 20, 30, 40, "hello")
+  end)
+  assert(b.aloc == 3)   -- new table uses three memory blocks
+  -- table optimized away
+  local function sel (n, ...arg) return arg[n] + arg.n end
+  local b = testamem("optimized vararg table",
+        function () return sel(2.0, 20, 30) end)
+  assert(b.res == 32 and b.aloc == 0)   -- no memory needed for this case
+end
 
 -- testing to-be-closed variables
 testamem("to-be-closed variables", function()
@@ -150,9 +166,9 @@
                               e, s, expand(n-1,s), e)
 end
 
-G=0; collectgarbage(); a =collectgarbage("count")
+G=0; collectgarbage()
 load(expand(20,"G=G+1"))()
-assert(G==20); collectgarbage();  -- assert(gcinfo() <= a+1)
+assert(G==20); collectgarbage()
 G = nil
 
 testamem("running code on new thread", function ()
@@ -160,6 +176,14 @@
 end)
 
 
+do   -- external strings
+  local str = string.rep("a", 100)
+  testamem("creating external strings", function ()
+    return T.externstr(str)
+  end)
+end
+
+
 -- testing memory x compiler
 
 testamem("loadstring", function ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/nextvar.lua 
new/lua-5.5.0-tests/nextvar.lua
--- old/lua-5.5.0-tests/nextvar.lua     2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/nextvar.lua     2025-12-15 11:44:41.000000000 +0100
@@ -345,6 +345,18 @@
   end
 end
 
+
+do  print("testing attack on table length")
+  local t = {}
+  local lim = math.floor(math.log(math.maxinteger, 2)) - 1
+  for i = lim, 0, -1 do
+    t[2^i] = true
+  end
+  assert(t[1 << lim])
+  -- next loop should not take forever
+  for i = 1, #t do end
+end
+
 local nofind = {}
 
 
@@ -893,13 +905,18 @@
   if i <= e.n then return i,a[i] end
 end
 
-setmetatable(a, {__pairs = function (x) return foo, x, 0 end})
+local closed = false
+setmetatable(a, {__pairs = function (x)
+  local tbc = setmetatable({}, {__close = function () closed = true end})
+  return foo, x, 0, tbc
+ end})
 
 local i = 0
 for k,v in pairs(a) do
   i = i + 1
   assert(k == i and v == k+1)
 end
+assert(closed)   -- 'tbc' has been closed
 
 a.n = 5
 a[3] = 30
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/strings.lua 
new/lua-5.5.0-tests/strings.lua
--- old/lua-5.5.0-tests/strings.lua     2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/strings.lua     2025-12-15 11:44:41.000000000 +0100
@@ -540,6 +540,23 @@
   assert(y == x)
   local z = T.externstr(x)   -- external allocated long string
   assert(z == y)
+
+  local e = T.externstr("")   -- empty external string
+  assert(e .. "x" == "x" and "x" .. e == "x")
+  assert(e .. e == "" and #e == 0)
+
+  -- external string as the "n" key in vararg table
+  local n = T.externstr("n")
+  local n0 = T.externstr("n\0")
+  local function aux (...t) assert(t[n0] == nil); return t[n] end
+  assert(aux(10, 20, 30) == 3)
+
+  -- external string as mode in weak table
+  local t = setmetatable({}, {__mode = T.externstr("kv")})
+  t[{}] = {}
+  assert(next(t))
+  collectgarbage()
+  assert(next(t) == nil)
 end
 
 print('OK')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/tracegc.lua 
new/lua-5.5.0-tests/tracegc.lua
--- old/lua-5.5.0-tests/tracegc.lua     2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/tracegc.lua     2025-12-15 11:44:41.000000000 +0100
@@ -6,7 +6,7 @@
 local setmetatable, stderr, collectgarbage =
          setmetatable, io.stderr, collectgarbage
 
-_ENV = nil
+global none
 
 local active = false
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/utf8.lua new/lua-5.5.0-tests/utf8.lua
--- old/lua-5.5.0-tests/utf8.lua        2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/utf8.lua        2025-12-15 11:44:41.000000000 +0100
@@ -152,11 +152,20 @@
 checkerror("continuation byte", utf8.offset, "𦧺", 1, 2)
 checkerror("continuation byte", utf8.offset, "𦧺", 1, 2)
 checkerror("continuation byte", utf8.offset, "\x80", 1)
+checkerror("continuation byte", utf8.offset, "\x9c", -1)
 
 -- error in indices for len
 checkerror("out of bounds", utf8.len, "abc", 0, 2)
 checkerror("out of bounds", utf8.len, "abc", 1, 4)
 
+do  -- missing continuation bytes
+  -- get what is available
+  local p, e = utf8.offset("\xE0", 1)
+  assert(p == 1 and e == 1)
+  local p, e = utf8.offset("\xE0\x9e", -1)
+  assert(p == 1 and e == 2)
+end
+
 
 local s = "hello World"
 local t = {string.byte(s, 1, -1)}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lua-5.5.0-tests/vararg.lua 
new/lua-5.5.0-tests/vararg.lua
--- old/lua-5.5.0-tests/vararg.lua      2025-06-28 12:06:33.000000000 +0200
+++ new/lua-5.5.0-tests/vararg.lua      2025-12-15 11:44:41.000000000 +0100
@@ -3,9 +3,12 @@
 
 print('testing vararg')
 
-local function f (a, ...)
+local function f (a, ...t)
   local x = {n = select('#', ...), ...}
-  for i = 1, x.n do assert(a[i] == x[i]) end
+  assert(x.n == t.n)
+  for i = 1, x.n do
+    assert(a[i] == x[i] and x[i] == t[i])
+  end
   return x.n
 end
 
@@ -17,7 +20,7 @@
   return res, 2
 end
 
-local function vararg (...) return {n = select('#', ...), ...} end
+local function vararg (... t) return t end
 
 local call = function (f, args) return f(table.unpack(args, 1, args.n)) end
 
@@ -98,8 +101,40 @@
 assert(a==nil and b==nil and c==nil and d==nil and e==nil)
 
 
+do  -- vararg expressions using unpack
+  local function aux (a, v, ...t)
+    for k, val in pairs(v) do t[k] = val end
+    return ...
+  end
+
+  local t = table.pack(aux(10, {11, [5] = 24}, 1, 2, 3, nil, 4))
+  assert(t.n == 5 and t[1] == 11 and t[2] == 2 and t[3] == 3
+                  and t[4] == nil and t[5] == 24)
+
+  local t = table.pack(aux(nil, {1, [20] = "a", [30] = "b", n = 30}))
+  assert(t.n == 30 and t[1] == 1 and t[20] == "a" and t[30] == "b")
+  -- table has only those four elements
+  assert(next(t, next(t, next(t, next(t, next(t, nil))))) == nil)
+
+  local a, b, c, d = aux(nil, {}, 10, 20, 30)
+  assert(a == 10 and b == 20 and c == 30 and d == nil)
+
+  local function aux (a, b, n, ...t) t.n = n; return b, ... end
+  local t = table.pack(aux(10, 1, 10000))
+  assert(t.n == 10001 and t[1] == 1 and #t == 1)
+
+  local function checkerr (emsg, f, ...)
+    local st, msg = pcall(f, ...)
+    assert(not st and string.find(msg, emsg))
+  end
+  checkerr("no proper 'n'", aux, 1, 1, -1)
+  checkerr("no proper 'n'", aux, 1, 1, math.maxinteger)
+  checkerr("no proper 'n'", aux, 1, 1, math.mininteger)
+  checkerr("no proper 'n'", aux, 1, 1, 1.0)
+end
+
 -- varargs for main chunks
-local f = load[[ return {...} ]]
+local f = assert(load[[ return {...} ]])
 local x = f(2,3)
 assert(x[1] == 2 and x[2] == 3 and x[3] == undef)
 
@@ -147,5 +182,79 @@
   local a, b = g()
   assert(a == nil and b == 2)
 end
+
+
+do  -- vararg parameter used in nested functions
+  local function foo (...tab1)
+    return function (...tab2)
+      return {tab1, tab2}
+    end
+  end
+  local f = foo(10, 20, 30)
+  local t = f("a", "b")
+  assert(t[1].n == 3 and t[1][1] == 10)
+  assert(t[2].n == 2 and t[2][1] == "a")
+end
+
+do  -- vararg parameter is read-only
+  local st, msg = load("return function (... t) t = 10 end")
+  assert(string.find(msg, "const variable 't'"))
+
+  local st, msg = load[[
+    local function foo (...extra)
+      return function (...) extra = nil end
+    end
+  ]]
+  assert(string.find(msg, "const variable 'extra'"))
+end
+
+
+do  -- _ENV as vararg parameter
+  local st, msg = load[[
+    local function aux (... _ENV)
+      global <const> a
+      a = 10
+    end ]]
+  assert(string.find(msg, "const variable 'a'"))
+
+  local function aux (..._ENV)
+    global a; a = 10
+    return a
+  end
+  assert(aux() == 10)
+
+  local function aux (... _ENV)
+    global a = 10
+    return a
+  end
+  assert(aux() == 10)
+end
+
+
+do   -- access to vararg parameter
+  local function notab (keys, t, ...v)
+    for _, k in pairs(keys) do
+      assert(t[k] == v[k])
+    end
+    assert(t.n == v.n)
+    return ...
+  end
+
+  local t = table.pack(10, 20, 30)
+  local keys = {-1, 0, 1, t.n, t.n + 1, 1.0, 1.1, "n", print, "k", "1"}
+  notab(keys, t, 10, 20, 30)    -- ensure stack space
+  local m = collectgarbage"count"
+  notab(keys, t, 10, 20, 30)
+  -- 'notab' does not create any table/object
+  assert(m == collectgarbage"count")
+
+  -- writing to the vararg table
+  local function foo (...t)
+    t[1] = t[1] + 10
+    return t[1]
+  end
+  assert(foo(10, 30) == 20)
+end
+
 print('OK')
 

++++++ lua-5.5.0-beta.tar.gz -> lua-5.5.0.tar.gz ++++++
++++ 4584 lines of diff (skipped)

++++++ lua-build-system.patch ++++++
--- /var/tmp/diff_new_pack.lJBqDN/_old  2026-01-08 15:26:46.431421851 +0100
+++ /var/tmp/diff_new_pack.lJBqDN/_new  2026-01-08 15:26:46.443422348 +0100
@@ -4,14 +4,14 @@
 
 ---
  Makefile      |   22 +++++++++++-----------
- src/Makefile  |   45 ++++++++++++++++++++++++++-------------------
+ src/Makefile  |   43 +++++++++++++++++++++++++------------------
  src/luaconf.h |    2 +-
- 3 files changed, 38 insertions(+), 31 deletions(-)
+ 3 files changed, 37 insertions(+), 30 deletions(-)
 
-Index: lua-5.5.0-beta/Makefile
+Index: lua-5.5.0/Makefile
 ===================================================================
---- lua-5.5.0-beta.orig/Makefile       2025-06-26 15:04:37.000000000 +0200
-+++ lua-5.5.0-beta/Makefile    2025-07-16 11:43:49.998066837 +0200
+--- lua-5.5.0.orig/Makefile    2025-06-26 15:04:37.000000000 +0200
++++ lua-5.5.0/Makefile 2025-12-31 02:22:49.285223272 +0100
 @@ -10,18 +10,18 @@
  # so take care if INSTALL_TOP is not an absolute path. See the local target.
  # You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with
@@ -67,10 +67,10 @@
        cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
  
  uninstall:
-Index: lua-5.5.0-beta/src/Makefile
+Index: lua-5.5.0/src/Makefile
 ===================================================================
---- lua-5.5.0-beta.orig/src/Makefile   2025-06-26 14:57:29.000000000 +0200
-+++ lua-5.5.0-beta/src/Makefile        2025-07-16 11:43:49.998317291 +0200
+--- lua-5.5.0.orig/src/Makefile        2025-07-07 02:19:14.000000000 +0200
++++ lua-5.5.0/src/Makefile     2025-12-31 02:22:49.285486108 +0100
 @@ -7,7 +7,7 @@
  PLAT= guess
  
@@ -151,15 +151,6 @@
  
  clean:
        $(RM) $(ALL_T) $(ALL_O)
-@@ -127,7 +142,7 @@
-       $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" 
SYSLIBS="-lreadline"
- 
- mingw:
--      $(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" \
-+      $(MAKE) "LUA_A=lua55.dll" "LUA_T=lua.exe" \
-       "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
-       "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
-       $(MAKE) "LUAC_T=luac.exe" luac.exe
 @@ -142,14 +157,6 @@
  .PHONY: all $(PLATS) help test clean default o a depend echo
  
@@ -175,10 +166,10 @@
  
  # DO NOT DELETE
  
-Index: lua-5.5.0-beta/src/luaconf.h
+Index: lua-5.5.0/src/luaconf.h
 ===================================================================
---- lua-5.5.0-beta.orig/src/luaconf.h  2025-06-28 12:06:32.000000000 +0200
-+++ lua-5.5.0-beta/src/luaconf.h       2025-07-16 11:43:49.998518156 +0200
+--- lua-5.5.0.orig/src/luaconf.h       2025-12-15 11:44:40.000000000 +0100
++++ lua-5.5.0/src/luaconf.h    2025-12-31 02:22:49.285795791 +0100
 @@ -239,7 +239,7 @@
  
  #else                 /* }{ */

++++++ main_test.patch ++++++
--- /var/tmp/diff_new_pack.lJBqDN/_old  2026-01-08 15:26:46.467423342 +0100
+++ /var/tmp/diff_new_pack.lJBqDN/_new  2026-01-08 15:26:46.471423508 +0100
@@ -2,10 +2,10 @@
  testes/main.lua |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-Index: lua-5.5.0-beta/testes/main.lua
+Index: lua-5.5.0/testes/main.lua
 ===================================================================
---- lua-5.5.0-beta.orig/testes/main.lua        2025-06-28 12:06:33.000000000 
+0200
-+++ lua-5.5.0-beta/testes/main.lua     2025-07-11 11:27:50.692260424 +0200
+--- lua-5.5.0.orig/testes/main.lua     2025-11-12 11:35:03.000000000 +0100
++++ lua-5.5.0/testes/main.lua  2025-11-18 20:41:40.095646576 +0100
 @@ -49,7 +49,7 @@
    assert(string.sub(s, -1) == "\n")
    local t = getoutput()

Reply via email to