From 9204178818838035eac73de567fab4cb4fff71da Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 21 Jan 2015 10:40:08 -0200 Subject: Discard excess characters when a tool gives out an octal mode string that's too long. Fixes #53. --- src/luarocks/fs/lua.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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) -- LuaPosix (as of 5.1.15) does not support octal notation... if mode:sub(1,1) == "0" then local new_mode = {} - for c in mode:sub(2):gmatch(".") do + for c in mode:sub(-3):gmatch(".") do table.insert(new_mode, octal_to_rwx[c]) end mode = table.concat(new_mode) -- cgit v1.2.3-55-g6feb