aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Baynham <sdbaynham@gmail.com>2019-10-10 06:27:43 -0700
committerHisham Muhammad <hisham@gobolinux.org>2019-12-02 14:16:33 -0300
commitea5788380b408894e8a7b0d165bf535d1a3fbe51 (patch)
tree167979a9528911a593bc89cabcbc141a67eca531
parent27c09f27b22b26463e7e6b47431d539c7e496c6e (diff)
downloadluarocks-ea5788380b408894e8a7b0d165bf535d1a3fbe51.tar.gz
luarocks-ea5788380b408894e8a7b0d165bf535d1a3fbe51.tar.bz2
luarocks-ea5788380b408894e8a7b0d165bf535d1a3fbe51.zip
Add quotes around usernames to handle usernames with space on Windows
-rw-r--r--spec/fs_spec.lua6
-rw-r--r--src/luarocks/fs/win32/tools.lua4
2 files changed, 5 insertions, 5 deletions
diff --git a/spec/fs_spec.lua b/spec/fs_spec.lua
index 0acca613..e3643f78 100644
--- a/spec/fs_spec.lua
+++ b/spec/fs_spec.lua
@@ -39,7 +39,7 @@ describe("Luarocks fs test #unit", function()
39 39
40 local make_unreadable = function(path) 40 local make_unreadable = function(path)
41 if is_win then 41 if is_win then
42 fs.execute("icacls " .. fs.Q(path) .. " /inheritance:d /deny %USERNAME%:(R)") 42 fs.execute("icacls " .. fs.Q(path) .. " /inheritance:d /deny \"%USERNAME%\":(R)")
43 else 43 else
44 fs.execute("chmod -r " .. fs.Q(path)) 44 fs.execute("chmod -r " .. fs.Q(path))
45 end 45 end
@@ -47,7 +47,7 @@ describe("Luarocks fs test #unit", function()
47 47
48 local make_unwritable = function(path) 48 local make_unwritable = function(path)
49 if is_win then 49 if is_win then
50 fs.execute("icacls " .. fs.Q(path) .. " /inheritance:d /deny %USERNAME%:(W,M)") 50 fs.execute("icacls " .. fs.Q(path) .. " /inheritance:d /deny \"%USERNAME%\":(W,M)")
51 else 51 else
52 fs.execute("chmod -w " .. fs.Q(path)) 52 fs.execute("chmod -w " .. fs.Q(path))
53 end 53 end
@@ -55,7 +55,7 @@ describe("Luarocks fs test #unit", function()
55 55
56 local make_unexecutable = function(path) 56 local make_unexecutable = function(path)
57 if is_win then 57 if is_win then
58 fs.execute("icacls " .. fs.Q(path) .. " /inheritance:d /deny %USERNAME%:(X)") 58 fs.execute("icacls " .. fs.Q(path) .. " /inheritance:d /deny \"%USERNAME%\":(X)")
59 else 59 else
60 fs.execute("chmod -x " .. fs.Q(path)) 60 fs.execute("chmod -x " .. fs.Q(path))
61 end 61 end
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua
index f9468517..57e8c80e 100644
--- a/src/luarocks/fs/win32/tools.lua
+++ b/src/luarocks/fs/win32/tools.lua
@@ -239,7 +239,7 @@ function tools.set_permissions(filename, mode, scope)
239 return false, "Could not take ownership of the given file" 239 return false, "Could not take ownership of the given file"
240 end 240 end
241 -- Grant the current user the proper rights 241 -- Grant the current user the proper rights
242 ok = fs.execute_quiet(vars.ICACLS .. " " .. fs.Q(filename) .. " /inheritance:d /grant:r %USERNAME%:" .. perms) 242 ok = fs.execute_quiet(vars.ICACLS .. " " .. fs.Q(filename) .. " /inheritance:d /grant:r \"%USERNAME%\":" .. perms)
243 if not ok then 243 if not ok then
244 return false, "Failed setting permission " .. mode .. " for " .. scope 244 return false, "Failed setting permission " .. mode .. " for " .. scope
245 end 245 end
@@ -267,7 +267,7 @@ function tools.set_permissions(filename, mode, scope)
267 return false, "Failed setting permission " .. mode .. " for " .. scope 267 return false, "Failed setting permission " .. mode .. " for " .. scope
268 end 268 end
269 -- Grant permissions available only to the current user 269 -- Grant permissions available only to the current user
270 ok = fs.execute_quiet(vars.ICACLS .. " " .. fs.Q(filename) .. " /inheritance:d /grant %USERNAME%:" .. my_perms) 270 ok = fs.execute_quiet(vars.ICACLS .. " " .. fs.Q(filename) .. " /inheritance:d /grant \"%USERNAME%\":" .. my_perms)
271 if not ok then 271 if not ok then
272 return false, "Failed setting permission " .. mode .. " for " .. scope 272 return false, "Failed setting permission " .. mode .. " for " .. scope
273 end 273 end