diff options
author | Hisham <hisham@gobolinux.org> | 2016-12-02 08:56:08 -0200 |
---|---|---|
committer | Peter Melnichenko <mpeterval@gmail.com> | 2017-09-12 20:25:19 +0300 |
commit | 927b11f650e7b60fa92f37dd6d6ba663250f7bd9 (patch) | |
tree | e7b9b0ae9da4cee0233088e57b8d18817849b52a | |
parent | 96cca8d544ec0969b2d7faa700f1bcfef0254eea (diff) | |
download | luarocks-927b11f650e7b60fa92f37dd6d6ba663250f7bd9.tar.gz luarocks-927b11f650e7b60fa92f37dd6d6ba663250f7bd9.tar.bz2 luarocks-927b11f650e7b60fa92f37dd6d6ba663250f7bd9.zip |
Check for specific directories instead of the root dir.
Fixes problem in macOS 10.12.
See http://lua-users.org/lists/lua-l/2016-12/msg00001.html
-rw-r--r-- | src/luarocks/fs/lua.lua | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 41711eab..0a95359a 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -821,28 +821,29 @@ end | |||
821 | -- @return boolean or (boolean, string): true on success, false on failure, | 821 | -- @return boolean or (boolean, string): true on success, false on failure, |
822 | -- plus an error message. | 822 | -- plus an error message. |
823 | function fs_lua.check_command_permissions(flags) | 823 | function fs_lua.check_command_permissions(flags) |
824 | local root_dir = path.root_dir(cfg.rocks_dir) | ||
825 | local ok = true | 824 | local ok = true |
826 | local err = "" | 825 | local err = "" |
827 | for _, dir in ipairs { cfg.rocks_dir, root_dir } do | 826 | for _, dir in ipairs { cfg.rocks_dir, cfg.deploy_lua_dir, cfg.deploy_bin_dir, cfg.deploy_lua_dir } do |
828 | if fs.exists(dir) and not fs.is_writable(dir) then | 827 | if fs.exists(dir) then |
829 | ok = false | 828 | if not fs.is_writable(dir) then |
830 | err = "Your user does not have write permissions in " .. dir | 829 | ok = false |
831 | break | 830 | err = "Your user does not have write permissions in " .. dir |
832 | end | 831 | break |
833 | end | 832 | end |
834 | if ok and not fs.exists(root_dir) then | 833 | else |
835 | local root = fs.root_of(root_dir) | 834 | local root = fs.root_of(dir) |
836 | local parent = root_dir | 835 | local parent = dir |
837 | repeat | 836 | repeat |
838 | parent = dir.dir_name(parent) | 837 | parent = dir.dir_name(parent) |
839 | if parent == "" then | 838 | if parent == "" then |
840 | parent = root | 839 | parent = root |
840 | end | ||
841 | until parent == root or fs.exists(parent) | ||
842 | if not fs.is_writable(parent) then | ||
843 | ok = false | ||
844 | err = dir.." does not exist and your user does not have write permissions in " .. parent | ||
845 | break | ||
841 | end | 846 | end |
842 | until parent == root or fs.exists(parent) | ||
843 | if not fs.is_writable(parent) then | ||
844 | ok = false | ||
845 | err = root_dir.." does not exist and your user does not have write permissions in " .. parent | ||
846 | end | 847 | end |
847 | end | 848 | end |
848 | if ok then | 849 | if ok then |