aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-01-21 10:40:08 -0200
committerHisham Muhammad <hisham@gobolinux.org>2015-01-21 10:40:08 -0200
commit9204178818838035eac73de567fab4cb4fff71da (patch)
treefa4ec261417191bf8692358e190303a9d5b100c2
parent9702239587aa24b3cfe3bd5f81e3a6a4f5450723 (diff)
downloadluarocks-9204178818838035eac73de567fab4cb4fff71da.tar.gz
luarocks-9204178818838035eac73de567fab4cb4fff71da.tar.bz2
luarocks-9204178818838035eac73de567fab4cb4fff71da.zip
Discard excess characters when a tool gives out
an octal mode string that's too long. Fixes #53.
-rw-r--r--src/luarocks/fs/lua.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua
index b2619051..b3d3f6f1 100644
--- a/src/luarocks/fs/lua.lua
+++ b/src/luarocks/fs/lua.lua
@@ -732,7 +732,7 @@ function fs_lua.chmod(file, mode)
732 -- LuaPosix (as of 5.1.15) does not support octal notation... 732 -- LuaPosix (as of 5.1.15) does not support octal notation...
733 if mode:sub(1,1) == "0" then 733 if mode:sub(1,1) == "0" then
734 local new_mode = {} 734 local new_mode = {}
735 for c in mode:sub(2):gmatch(".") do 735 for c in mode:sub(-3):gmatch(".") do
736 table.insert(new_mode, octal_to_rwx[c]) 736 table.insert(new_mode, octal_to_rwx[c])
737 end 737 end
738 mode = table.concat(new_mode) 738 mode = table.concat(new_mode)