aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2021-11-08 07:52:23 -0300
committerHisham Muhammad <hisham@gobolinux.org>2021-11-08 07:52:23 -0300
commit11ddae641f9f23a01291443bf2569104edb855e1 (patch)
treeaa9b8afd48e98ab87b4f69efaacdd7327cc6a4eb
parenta630ba108e05e0f15e8823eaa0853ab6671acf0a (diff)
downloadluarocks-11ddae641f9f23a01291443bf2569104edb855e1.tar.gz
luarocks-11ddae641f9f23a01291443bf2569104edb855e1.tar.bz2
luarocks-11ddae641f9f23a01291443bf2569104edb855e1.zip
win32: icacls fix for usernames with spaces
-rw-r--r--src/luarocks/fs/win32/tools.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua
index 5d98e526..80f07866 100644
--- a/src/luarocks/fs/win32/tools.lua
+++ b/src/luarocks/fs/win32/tools.lua
@@ -275,8 +275,18 @@ function tools.set_permissions(filename, mode, scope)
275 if not ok then 275 if not ok then
276 return false, "Failed setting permission " .. mode .. " for " .. scope 276 return false, "Failed setting permission " .. mode .. " for " .. scope
277 end 277 end
278
278 -- Grant permissions available only to the current user 279 -- Grant permissions available only to the current user
279 ok = fs.execute_quiet(vars.ICACLS .. " " .. fs.Q(filename) .. " /inheritance:d /grant %USERNAME%:" .. my_perms) 280 ok = fs.execute_quiet(vars.ICACLS .. " " .. fs.Q(filename) .. " /inheritance:d /grant \"%USERNAME%\":" .. my_perms)
281
282 -- This may not be necessary if the above syntax is correct,
283 -- but I couldn't really test the extra quotes above, so if that
284 -- fails we try again with the syntax used in previous releases
285 -- just to be on the safe side
286 if not ok then
287 ok = fs.execute_quiet(vars.ICACLS .. " " .. fs.Q(filename) .. " /inheritance:d /grant %USERNAME%:" .. my_perms)
288 end
289
280 if not ok then 290 if not ok then
281 return false, "Failed setting permission " .. mode .. " for " .. scope 291 return false, "Failed setting permission " .. mode .. " for " .. scope
282 end 292 end