diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-17 02:04:32 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-17 11:17:06 -0300 |
commit | fb437de4f822c7a1135b2c4a6aa964721c0ae500 (patch) | |
tree | 244b5d3cc22184aee25bede50dc7eaa4361267cb | |
parent | 3612c269f3cd6397c883799b0bea549d5a7d1512 (diff) | |
download | luarocks-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.lua | 6 |
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 |