https://hg.prosody.im/trunk/log?rev=only%28%22tip%22%2C+%220.11.2%22%29+and+keyword%28%22lua+5.3%22%29
--- prosody-0.11.4/plugins/mod_admin_telnet.lua 2020-01-02 10:49:37.000000000 +0100
+++ prosody-0.11.4/plugins/mod_admin_telnet.lua.lua53 2020-02-10 01:22:04.338037958 +0100
@@ -1207,7 +1207,7 @@
--do return tostring(value) end
if type == "duration" then
if ref_value < 0.001 then
- return ("%d µs"):format(value*1000000);
+ return ("%g µs"):format(value*1000000);
elseif ref_value < 0.9 then
return ("%0.2f ms"):format(value*1000);
end
--- prosody-0.11.4/spec/util_format_spec.lua 2020-01-02 10:49:37.000000000 +0100
+++ prosody-0.11.4/spec/util_format_spec.lua.lua53 2020-02-10 01:22:04.337037950 +0100
@@ -9,6 +9,8 @@
assert.equal("true", format("%s", true));
assert.equal("[true]", format("%d", true));
assert.equal("% [true]", format("%%", true));
+ assert.equal("{ }", format("%q", { }));
+ assert.equal("[1.5]", format("%d", 1.5));
end);
end);
end);
--- prosody-0.11.4/spec/util_json_spec.lua 2020-01-02 10:49:37.000000000 +0100
+++ prosody-0.11.4/spec/util_json_spec.lua.lua53 2020-02-10 01:25:25.036574135 +0100
@@ -1,5 +1,6 @@
local json = require "util.json";
+local array = require "util.array";
describe("util.json", function()
describe("#encode()", function()
@@ -67,4 +68,13 @@
end
end);
end)
+
+ describe("util.array integration", function ()
+ it("works", function ()
+ assert.equal("[]", json.encode(array()));
+ assert.equal("[1,2,3]", json.encode(array({1,2,3})));
+ assert.equal(getmetatable(array()), getmetatable(json.decode("[]")));
+ end);
+ end);
+
end);
--- prosody-0.11.4/util/array.lua 2020-01-02 10:49:37.000000000 +0100
+++ prosody-0.11.4/util/array.lua.lua53 2020-02-10 01:24:20.088079855 +0100
@@ -10,6 +10,7 @@
= table.insert, table.sort, table.remove, table.concat;
local setmetatable = setmetatable;
+local getmetatable = getmetatable;
local math_random = math.random;
local math_floor = math.floor;
local pairs, ipairs = pairs, ipairs;
@@ -40,6 +41,10 @@
end
function array_mt.__eq(a, b)
+ if getmetatable(a) ~= array_mt or getmetatable(b) ~= array_mt then
+ -- Lua 5.3+ calls this if both operands are tables, even if metatables differ
+ return false;
+ end
if #a == #b then
for i = 1, #a do
if a[i] ~= b[i] then
--- prosody-0.11.4/util/dependencies.lua 2020-01-02 10:49:37.000000000 +0100
+++ prosody-0.11.4/util/dependencies.lua.lua53 2020-02-10 01:22:04.337037950 +0100
@@ -140,7 +140,7 @@
end
local function log_warnings()
- if _VERSION > "Lua 5.2" then
+ if _VERSION > "Lua 5.3" then
prosody.log("warn", "Support for %s is experimental, please report any issues", _VERSION);
end
local ssl = softreq"ssl";
--- prosody-0.11.4/util/format.lua 2020-01-02 10:49:37.000000000 +0100
+++ prosody-0.11.4/util/format.lua.lua53 2020-02-10 01:22:04.338037958 +0100
@@ -6,6 +6,9 @@
local select = select;
local unpack = table.unpack or unpack; -- luacheck: ignore 113/unpack
local type = type;
+local num_type = math.type;
+
+local expects_integer = num_type and { c = true, d = true, i = true, o = true, u = true, X = true, x = true, } or {};
local function format(formatstring, ...)
local args, args_length = { ... }, select('#', ...);
@@ -39,6 +42,9 @@
elseif type(arg) ~= "number" then -- arg isn't number as expected?
args[i] = tostring(arg);
spec = "[%s]";
+ elseif expects_integer[option] and num_type(arg) ~= "integer" then
+ args[i] = tostring(arg);
+ spec = "[%s]";
end
end
return spec;
--- prosody-0.11.4/util/ip.lua 2020-01-02 10:49:37.000000000 +0100
+++ prosody-0.11.4/util/ip.lua.lua53 2020-02-10 01:23:34.117728556 +0100
@@ -19,8 +19,14 @@
return ret;
end,
__tostring = function (ip) return ip.addr; end,
- __eq = function (ipA, ipB) return ipA.packed == ipB.packed; end
};
+ip_mt.__eq = function (ipA, ipB)
+ if getmetatable(ipA) ~= ip_mt or getmetatable(ipB) ~= ip_mt then
+ -- Lua 5.3+ calls this if both operands are tables, even if metatables differ
+ return false;
+ end
+ return ipA.packed == ipB.packed;
+end
local hex2bits = {
["0"] = "0000", ["1"] = "0001", ["2"] = "0010", ["3"] = "0011",
--- prosody-0.11.4/util/set.lua 2020-01-02 10:49:37.000000000 +0100
+++ prosody-0.11.4/util/set.lua.lua53 2020-02-10 01:22:59.838465654 +0100
@@ -8,6 +8,7 @@
local ipairs, pairs, setmetatable, next, tostring =
ipairs, pairs, setmetatable, next, tostring;
+local getmetatable = getmetatable;
local t_concat = table.concat;
local _ENV = nil;
@@ -146,6 +147,11 @@
return new_set;
end
function set_mt.__eq(set1, set2)
+ if getmetatable(set1) ~= set_mt or getmetatable(set2) ~= set_mt then
+ -- Lua 5.3+ calls this if both operands are tables, even if metatables differ
+ return false;
+ end
+
set1, set2 = set1._items, set2._items;
for item in pairs(set1) do
if not set2[item] then