changeset 14069:af28d6debaca

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Mon, 09 Feb 2026 18:38:35 +0100
parents 6ccc6e0ece29 (current diff) 2462247ec377 (diff)
children 54b30a374953
files prosody prosodyctl tools/migration/prosody-migrator.lua
diffstat 3 files changed, 15 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/prosody	Mon Feb 09 17:11:52 2026 +0100
+++ b/prosody	Mon Feb 09 18:38:35 2026 +0100
@@ -26,7 +26,8 @@
 end
 
 -- Tell Lua where to find our libraries
-if CFG_SOURCEDIR then
+-- and ensure that resources in the current directory are not picked up by accident
+do
 	-- Installed instance
 	local function is_relative(path)
 		local path_sep = package.config:sub(1,1);
@@ -39,17 +40,14 @@
 	local function sanitise_paths(paths)
 		return (paths:gsub("[^;]+;?", filter_relative_paths):gsub(";;+", ";"));
 	end
-	package.path = sanitise_paths(CFG_SOURCEDIR.."/?.lua;"..package.path);
-	package.cpath = sanitise_paths(CFG_SOURCEDIR.."/?.so;"..package.cpath);
+	package.path = (CFG_SOURCEDIR or ".") .. "/?.lua;" .. sanitise_paths(package.path);
+	package.cpath = (CFG_SOURCEDIR or ".") .. "/?.so;" .. sanitise_paths(package.cpath);
 
-	if pcall(dofile, CFG_SOURCEDIR .. "/loader.lua") then
+	if pcall(dofile, (CFG_SOURCEDIR or ".") .. "/loader.lua") then
 		package.loaded["prosody.loader"] = true;
 	else
 		require "prosody.loader";
 	end
-else
-	-- Not installed, e.g. running from a source checkout
-	require "loader";
 end
 
 -- Substitute ~ with path to home directory in data path
--- a/prosodyctl	Mon Feb 09 17:11:52 2026 +0100
+++ b/prosodyctl	Mon Feb 09 18:38:35 2026 +0100
@@ -24,9 +24,9 @@
 	return os.exit(1);
 end
 
-
 -- Tell Lua where to find our libraries
-if CFG_SOURCEDIR then
+-- and ensure that resources in the current directory are not picked up by accident
+do
 	-- Installed instance
 	local function is_relative(path)
 		local path_sep = package.config:sub(1,1);
@@ -39,17 +39,14 @@
 	local function sanitise_paths(paths)
 		return (paths:gsub("[^;]+;?", filter_relative_paths):gsub(";;+", ";"));
 	end
-	package.path = sanitise_paths(CFG_SOURCEDIR.."/?.lua;"..package.path);
-	package.cpath = sanitise_paths(CFG_SOURCEDIR.."/?.so;"..package.cpath);
+	package.path = (CFG_SOURCEDIR or ".") .. "/?.lua;" .. sanitise_paths(package.path);
+	package.cpath = (CFG_SOURCEDIR or ".") .. "/?.so;" .. sanitise_paths(package.cpath);
 
-	if pcall(dofile, CFG_SOURCEDIR .. "/loader.lua") then
+	if pcall(dofile, (CFG_SOURCEDIR or ".") .. "/loader.lua") then
 		package.loaded["prosody.loader"] = true;
 	else
 		require "prosody.loader";
 	end
-else
-	-- Not installed, e.g. running from a source checkout
-	require "loader";
 end
 
 -- Substitute ~ with path to home directory in data path
--- a/tools/migration/prosody-migrator.lua	Mon Feb 09 17:11:52 2026 +0100
+++ b/tools/migration/prosody-migrator.lua	Mon Feb 09 18:38:35 2026 +0100
@@ -15,7 +15,8 @@
 end
 
 -- Tell Lua where to find our libraries
-if CFG_SOURCEDIR then
+-- and ensure that resources in the current directory are not picked up by accident
+do
 	-- Installed instance
 	local function is_relative(path)
 		local path_sep = package.config:sub(1,1);
@@ -28,17 +29,14 @@
 	local function sanitise_paths(paths)
 		return (paths:gsub("[^;]+;?", filter_relative_paths):gsub(";;+", ";"));
 	end
-	package.path = sanitise_paths(CFG_SOURCEDIR.."/?.lua;"..package.path);
-	package.cpath = sanitise_paths(CFG_SOURCEDIR.."/?.so;"..package.cpath);
+	package.path = (CFG_SOURCEDIR or ".") .. "/?.lua;" .. sanitise_paths(package.path);
+	package.cpath = (CFG_SOURCEDIR or ".") .. "/?.so;" .. sanitise_paths(package.cpath);
 
-	if pcall(dofile, CFG_SOURCEDIR .. "/loader.lua") then
+	if pcall(dofile, (CFG_SOURCEDIR or ".") .. "/loader.lua") then
 		package.loaded["prosody.loader"] = true;
 	else
 		require "prosody.loader";
 	end
-else
-	-- Not installed, e.g. running from a source checkout
-	require "loader";
 end
 
 -- Substitute ~ with path to home directory in data path