Closed drmargarido closed 5 years ago
Thanks for the bug fix!
A quick grep over the LuaRocks codebase shows that they’ve switched to LuaPosix functions, I’d rather follow their lead. http://luaposix.github.io/luaposix/modules/posix.html#chmod
spec/fs_spec.lua
36: fs.execute("chmod -r " .. fs.Q(path))
44: fs.execute("chmod -w " .. fs.Q(path))
52: fs.execute("chmod -x " .. fs.Q(path))
spec/util/test_env.lua
640: execute_bool("chmod og-wx ~/.ssh/authorized_keys")
src/luarocks/fs/lua.lua
399: return posix.chmod(dest, fullattrs)
933: local err = posix.chmod(filename, perms)
I’d escape the whole path, just in case.
Do you want to fix this, or should I do it? If you do, you can rebase force-push to this branch.
Thanks!
I can fix it, thanks for the feedback.
… and I can’t compile LuaPosix. https://github.com/luaposix/luaposix/issues/320
My installation of luaposix also failed initially with luarocks so I used their luke file to install it -> https://github.com/luaposix/luaposix/tree/master/build-aux
I think I’m gonna go with
diff --git a/src/scripts/debian.lua b/src/scripts/debian.lua
index 24ddf8e..e3b1578 100644
--- a/src/scripts/debian.lua
+++ b/src/scripts/debian.lua
@@ -109,7 +109,8 @@ function s.script(project)
"love '"..loveFileDeb:gsub("'", "\\'").."'\n",
true
)
- assert(fs.chmod(tempDir.."/usr/bin/"..project.package, "+x"))
+ assert(fs.set_permissions(fs.Q(tempDir.."/usr/bin/"..project.package)),
+ "exec", "all") -- 755
-- /usr/share/games/${PACKAGE}/${LOVE_FILE}
copyFile(project.releaseDirectory.."/"..script.loveFile, loveFileDeb, true)
Yes, that's better
I get weird results with chmod and fs.Q
. If there is a sample file test
, all it does is putting quotes around the parameter.
cfg = require("luarocks.core.cfg")
cfg.init()
fs = require("luarocks.fs")
fs.init()
fs.set_permissions("test", "exec", "all") -- works
fs.set_permissions("'test'", "exec", "all") -- does not work
Changed chmod call to an execute call because fs.chmod was removed from luarocks.fs in version 3.