Comparison

prosodyctl @ 12578:10bb58ad5583

executables: Reject Lua 5.1 early Prevents attempting to load libraries that may no longer be found and crashing with a traceback. Platforms like Debian where multiple Lua versions can be installed at the same time and 'lua' pointing to one of the installed interpreters via symlinks, there's the possibility that prosody/prosodyctl may be invoked with Lua 5.1, which will no longer have any of the rest of Prosody libraries available to be require(), and thus would immediately fail with an unfriendly traceback. Checking and aborting early with a friendlier message and reference to more information is better. Part of #1600
author Kim Alvefur <zash@zash.se>
date Sat, 02 Jul 2022 17:27:39 +0200
parent 12452:c475a7802169
child 12589:39ae08180c81
comparison
equal deleted inserted replaced
12577:f888c84b2284 12578:10bb58ad5583
41 CFG_DATADIR = CFG_DATADIR:gsub("^~", os.getenv("HOME")); 41 CFG_DATADIR = CFG_DATADIR:gsub("^~", os.getenv("HOME"));
42 end 42 end
43 end 43 end
44 44
45 ----------- 45 -----------
46
47 -- Check before first require, to preempt the probable failure
48 if _VERSION < "Lua 5.2" then
49 io.stderr:write("Prosody is no longer compatible with Lua 5.1\n")
50 io.stderr:write("See https://prosody.im/doc/depends#lua for more information\n")
51 return os.exit(1);
52 end
46 53
47 local startup = require "util.startup"; 54 local startup = require "util.startup";
48 startup.prosodyctl(); 55 startup.prosodyctl();
49 56
50 ----------- 57 -----------