aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2011-11-28 21:10:26 -0200
committerHisham Muhammad <hisham@gobolinux.org>2011-11-28 21:10:26 -0200
commit7b214dd7de60c9dbc5ceba8edbe50477ddfc5da2 (patch)
tree4446f58211b5ac58ceb972c5a3248d423f27b4d4
parent90e5f9a67023cde3ed745a9a82f662ade82a81c1 (diff)
downloadluarocks-7b214dd7de60c9dbc5ceba8edbe50477ddfc5da2.tar.gz
luarocks-7b214dd7de60c9dbc5ceba8edbe50477ddfc5da2.tar.bz2
luarocks-7b214dd7de60c9dbc5ceba8edbe50477ddfc5da2.zip
add extra checks for local permissions
-rw-r--r--src/luarocks/dir.lua2
-rw-r--r--src/luarocks/fs/lua.lua2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/luarocks/dir.lua b/src/luarocks/dir.lua
index 5a8058dc..00a9317f 100644
--- a/src/luarocks/dir.lua
+++ b/src/luarocks/dir.lua
@@ -10,7 +10,7 @@ separator = "/"
10function base_name(pathname) 10function base_name(pathname)
11 assert(type(pathname) == "string") 11 assert(type(pathname) == "string")
12 12
13 local base = pathname:match(".*[/\\]([^/\\]*)") 13 local base = pathname:gsub("[/\\]*$", ""):match(".*[/\\]([^/\\]*)")
14 return base or pathname 14 return base or pathname
15end 15end
16 16
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index ce0877db..2a176259 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -633,7 +633,7 @@ end
633-- plus an error message. 633-- plus an error message.
634function check_command_permissions(flags) 634function check_command_permissions(flags)
635 local root_dir = path.root_dir(cfg.rocks_dir) 635 local root_dir = path.root_dir(cfg.rocks_dir)
636 if not flags["local"] and not fs.is_writable(root_dir) then 636 if not flags["local"] and not (fs.is_writable(root_dir) or fs.is_writable(dir.dir_name(root_dir))) then
637 return nil, "Your user does not have write permissions in " .. root_dir .. 637 return nil, "Your user does not have write permissions in " .. root_dir ..
638 " \n-- you may want to run as a privileged user or use your local tree with --local." 638 " \n-- you may want to run as a privileged user or use your local tree with --local."
639 end 639 end