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