aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2024-03-04 12:17:56 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-03-05 15:58:45 +0000
commit78d40e304be182b7e07be449ebda668b8b9d0fcd (patch)
tree4df133a573797e77dc1eab3f47d6a42b37a9f91f /spec
parent527b112738ce17fe93289ed879a2b84437fc5c40 (diff)
downloadluarocks-78d40e304be182b7e07be449ebda668b8b9d0fcd.tar.gz
luarocks-78d40e304be182b7e07be449ebda668b8b9d0fcd.tar.bz2
luarocks-78d40e304be182b7e07be449ebda668b8b9d0fcd.zip
fix: check permissions before trying to lock
This should provide a better error message.
Diffstat (limited to 'spec')
-rw-r--r--spec/quick/build.q76
1 files changed, 52 insertions, 24 deletions
diff --git a/spec/quick/build.q b/spec/quick/build.q
index 55bb7519..7cbc526b 100644
--- a/spec/quick/build.q
+++ b/spec/quick/build.q
@@ -79,11 +79,16 @@ a_rock 1.0
79================================================================================ 79================================================================================
80TEST: fails if no permissions to access the specified tree #unix 80TEST: fails if no permissions to access the specified tree #unix
81 81
82RUN: luarocks build --tree=/usr ./a_rock-1.0.1-rockspec 82RUN: luarocks build --tree=/usr ./a_rock-1.0-1.rockspec
83EXIT: 4 83EXIT: 2
84STDERR: 84STDERR:
85-------------------------------------------------------------------------------- 85--------------------------------------------------------------------------------
86requires exclusive write access 86You may want to run as a privileged user,
87or use --local to install into your local tree
88or run 'luarocks config local_by_default true' to make --local the default.
89
90(You may need to configure your Lua package paths
91to use the local tree, see 'luarocks path --help')
87-------------------------------------------------------------------------------- 92--------------------------------------------------------------------------------
88 93
89We show the OS permission denied error, so we don't show the --force-lock 94We show the OS permission denied error, so we don't show the --force-lock
@@ -96,33 +101,66 @@ try --force-lock
96 101
97NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec 102NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
98 103
99RUN: luarocks build --tree=/usr ./a_rock-1.0.1-rockspec --force-lock 104
100EXIT: 4 105
101STDERR: 106================================================================================
107TEST: fails if tree is locked, --force-lock overrides #unix
108
109FILE: a_rock-1.0-1.rockspec
102-------------------------------------------------------------------------------- 110--------------------------------------------------------------------------------
103requires exclusive write access 111rockspec_format = "3.0"
112package = "a_rock"
113version = "1.0-1"
114source = {
115 url = "file://%{url(%{fixtures_dir})}/a_rock.lua"
116}
117description = {
118 summary = "An example rockspec",
119}
120dependencies = {
121 "lua >= 5.1"
122}
123build = {
124 modules = {
125 build = "a_rock.lua"
126 },
127}
104-------------------------------------------------------------------------------- 128--------------------------------------------------------------------------------
105 129
106We show the OS permission denied error, so we don't show the --force-lock 130FILE: %{testing_tree}/lockfile.lfs
107message. 131--------------------------------------------------------------------------------
132dummy lock file for testing
133--------------------------------------------------------------------------------
108 134
109NOT_STDERR: 135RUN: luarocks build --tree=%{testing_tree} ./a_rock-1.0-1.rockspec
136EXIT: 4
137STDERR:
110-------------------------------------------------------------------------------- 138--------------------------------------------------------------------------------
139requires exclusive write access
111try --force-lock 140try --force-lock
112-------------------------------------------------------------------------------- 141--------------------------------------------------------------------------------
113 142
114NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec 143RUN: luarocks build --tree=%{testing_tree} ./a_rock-1.0-1.rockspec --force-lock
144EXIT: 0
115 145
116 146
117 147
118================================================================================ 148================================================================================
119TEST: fails if no permissions to access the parent #unix 149TEST: fails if no permissions to access the parent #unix
120 150
121RUN: luarocks build --tree=/usr/invalid ./a_rock-1.0.1-rockspec 151RUN: luarocks build --tree=/usr/invalid ./a_rock-1.0-1.rockspec
122EXIT: 4 152EXIT: 2
123STDERR: 153STDERR:
124-------------------------------------------------------------------------------- 154--------------------------------------------------------------------------------
125requires exclusive write access 155Error: /usr/invalid/lib/luarocks/rocks-%{lua_version} does not exist
156and your user does not have write permissions in /usr
157
158You may want to run as a privileged user,
159or use --local to install into your local tree
160or run 'luarocks config local_by_default true' to make --local the default.
161
162(You may need to configure your Lua package paths
163to use the local tree, see 'luarocks path --help')
126-------------------------------------------------------------------------------- 164--------------------------------------------------------------------------------
127 165
128We show the OS permission denied error, so we don't show the --force-lock 166We show the OS permission denied error, so we don't show the --force-lock
@@ -135,16 +173,6 @@ try --force-lock
135 173
136NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec 174NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
137 175
138RUN: luarocks build --tree=/usr/invalid ./a_rock-1.0.1-rockspec --force-lock
139EXIT: 4
140STDERR:
141--------------------------------------------------------------------------------
142requires exclusive write access
143failed to force the lock
144--------------------------------------------------------------------------------
145
146NOT_EXISTS: %{testing_sys_rocks}/a_rock/1.0-1/a_rock-1.0-1.rockspec
147
148 176
149 177
150================================================================================ 178================================================================================