# HG changeset patch # User Kim Alvefur # Date 1656775659 -7200 # Node ID 10bb58ad5583927226596b37da503d510d3982bc # Parent f888c84b2284d8b28290d91288d526b3c3ef2e74 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 diff -r f888c84b2284 -r 10bb58ad5583 prosody --- a/prosody Tue Jul 05 14:59:47 2022 +0200 +++ b/prosody Sat Jul 02 17:27:39 2022 +0200 @@ -44,6 +44,12 @@ end +-- Check before first require, to preempt the probable failure +if _VERSION < "Lua 5.2" then + io.stderr:write("Prosody is no longer compatible with Lua 5.1\n") + io.stderr:write("See https://prosody.im/doc/depends#lua for more information\n") + return os.exit(1); +end local startup = require "util.startup"; local async = require "util.async"; diff -r f888c84b2284 -r 10bb58ad5583 prosodyctl --- a/prosodyctl Tue Jul 05 14:59:47 2022 +0200 +++ b/prosodyctl Sat Jul 02 17:27:39 2022 +0200 @@ -44,6 +44,13 @@ ----------- +-- Check before first require, to preempt the probable failure +if _VERSION < "Lua 5.2" then + io.stderr:write("Prosody is no longer compatible with Lua 5.1\n") + io.stderr:write("See https://prosody.im/doc/depends#lua for more information\n") + return os.exit(1); +end + local startup = require "util.startup"; startup.prosodyctl();