aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2024-02-17 02:04:32 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-02-17 11:17:06 -0300
commitfb437de4f822c7a1135b2c4a6aa964721c0ae500 (patch)
tree244b5d3cc22184aee25bede50dc7eaa4361267cb
parent3612c269f3cd6397c883799b0bea549d5a7d1512 (diff)
downloadluarocks-fb437de4f822c7a1135b2c4a6aa964721c0ae500.tar.gz
luarocks-fb437de4f822c7a1135b2c4a6aa964721c0ae500.tar.bz2
luarocks-fb437de4f822c7a1135b2c4a6aa964721c0ae500.zip
fix(build): add some validation to the build table
LuaRocks does not validate the contents of the build table because each backend defines it on this own. These validations should be enough to address #1477, but ideally each bundled `build` backend should have its own validator like the one on `luarocks.type.rockspec`. Fixes #1477.
-rw-r--r--src/luarocks/build/builtin.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua
index cd4d4486..33e19c6b 100644
--- a/src/luarocks/build/builtin.lua
+++ b/src/luarocks/build/builtin.lua
@@ -321,7 +321,13 @@ function builtin.run(rockspec, no_install)
321 local sources = info.sources 321 local sources = info.sources
322 if info[1] then sources = info end 322 if info[1] then sources = info end
323 if type(sources) == "string" then sources = {sources} end 323 if type(sources) == "string" then sources = {sources} end
324 if type(sources) ~= "table" then
325 return nil, "error in rockspec: module '" .. name .. "' entry has no 'sources' list"
326 end
324 for _, source in ipairs(sources) do 327 for _, source in ipairs(sources) do
328 if type(source) ~= "string" then
329 return nil, "error in rockspec: module '" .. name .. "' does not specify source correctly."
330 end
325 local object = source:gsub("%.[^.]*$", "."..cfg.obj_extension) 331 local object = source:gsub("%.[^.]*$", "."..cfg.obj_extension)
326 if not object then 332 if not object then
327 object = source.."."..cfg.obj_extension 333 object = source.."."..cfg.obj_extension