From af2b92b5a922ecdb18c8d4ab202ab84a44125cf2 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Tue, 18 Sep 2012 20:55:12 -0300 Subject: Be stricter in type check to catch errors such as #90. Closes #90. This does not affect any rocks in the repos; they all validate properly with this stricter check. --- src/luarocks/build.lua | 2 ++ src/luarocks/type_check.lua | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 42ae3fd7..e9b3adc1 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua @@ -223,6 +223,8 @@ function build_rockspec(rockspec_file, need_to_fetch, minimal_mode, no_deps) local dest = dir.path(path.install_dir(name, version), copy_dir) fs.make_dir(dest) fs.copy_contents(copy_dir, dest) + else + util.warning("Directory '"..copy_dir.."' not found") end end diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua index 282198f6..28e6e7b9 100644 --- a/src/luarocks/type_check.lua +++ b/src/luarocks/type_check.lua @@ -172,8 +172,8 @@ local function type_check_item(name, item, expected, context) return nil, "Type mismatch on field "..context..name..": expected a number" end elseif expected_type == "string" then - if not tostring(item) then - return nil, "Type mismatch on field "..context..name..": expected a value convertible to string" + if type(item) ~= "string" then + return nil, "Type mismatch on field "..context..name..": expected a string" end if expected ~= "string" then if not item:match("^"..expected.."$") then -- cgit v1.2.3-55-g6feb