| 1 |
############################################################################## |
| 2 |
# Modules Revision 3.0 |
| 3 |
# Providing a flexible user environment |
| 4 |
# |
| 5 |
# File: modules.20-locate/%M% |
| 6 |
# Revision: %I% |
| 7 |
# First Edition: 2017/04/18 |
| 8 |
# Last Mod.: %U%, %G% |
| 9 |
# |
| 10 |
# Authors: Xavier Delaruelle, [email protected] |
| 11 |
# |
| 12 |
# Description: Testuite testsequence |
| 13 |
# Command: load, display, whatis, avail |
| 14 |
# Modulefiles: |
| 15 |
# Sub-Command: |
| 16 |
# |
| 17 |
# Comment: %C{ |
| 18 |
# Localization of the modulefile when access rights to get to it |
| 19 |
# does not allow it |
| 20 |
# }C% |
| 21 |
# |
| 22 |
############################################################################## |
| 23 |
|
| 24 |
# cannot test access if cannot change file permission |
| 25 |
if {!$is_file_perms_editable} { |
| 26 |
send_user "\tskipping access tests as file permissions cannot be changed\n" |
| 27 |
# cannot test access if superuser privileges are in use |
| 28 |
} elseif {$tcl_platform(user) eq "root"} { |
| 29 |
send_user "\tskipping access tests as tests are run by superuser\n" |
| 30 |
# cannot test access if restricted file permissions have no effect |
| 31 |
} elseif {$is_locked_dir_file_readable && $is_locked_file_readable} { |
| 32 |
send_user "\tskipping access tests as locked files or directories are still readable\n" |
| 33 |
} else { |
| 34 |
|
| 35 |
# do not consider built cache files (if any) to find available modules |
| 36 |
ignore_modulecache_if_built |
| 37 |
|
| 38 |
# |
| 39 |
# Variables for this test |
| 40 |
# |
| 41 |
|
| 42 |
# ensure avail tests are made using in depth mode |
| 43 |
setenv_var MODULES_AVAIL_INDEPTH 1 |
| 44 |
|
| 45 |
set m1 "loc_rc6/1.2" |
| 46 |
set lm1 "$m1" |
| 47 |
set lmf1 "$modpath/$lm1" |
| 48 |
set m2 "loc_rc6/bar" |
| 49 |
set lm2 "$lm1" |
| 50 |
set lmf2 "$modpath/$lm2" |
| 51 |
set m3 "loc_rc6/new" |
| 52 |
set lm3 "$lm1" |
| 53 |
set lmf3 "$modpath/$lm3" |
| 54 |
set m4 "loc_rc3" |
| 55 |
set lm4 "$m4/1.0" |
| 56 |
set lmf4 "$modpath/$lm4" |
| 57 |
set m5 "loc_rc1" |
| 58 |
set lm5 "$m5/2.0" |
| 59 |
set lmf5 "$modpath/$lm5" |
| 60 |
set rlm5 "$m5/1.0" |
| 61 |
set rlmf5 "$modpath/$rlm5" |
| 62 |
set rlmf5re "$modpathre/$rlm5" |
| 63 |
set m6 "loc_rc1" |
| 64 |
set lm6 "$m6/1.0" |
| 65 |
set lmf6 "$modpath/$lm6" |
| 66 |
set m7 "loc_rc7" |
| 67 |
set lm7 "$m7/0.9" |
| 68 |
set lmf7 "$modpath/$lm7" |
| 69 |
set m8 "$m2" |
| 70 |
set lmrc8 "$modpath/loc_rc6/.modulerc" |
| 71 |
set m9 "$m3" |
| 72 |
set lmrc9 "$modpath/loc_rc6/.modulerc" |
| 73 |
set m10 "$m4" |
| 74 |
set lmrc10 "$modpath/$m4/.modulerc" |
| 75 |
set rlm10 "$m10/3.0" |
| 76 |
set rlmf10 "$modpath/$rlm10" |
| 77 |
set rlmf10re "$modpathre/$rlm10" |
| 78 |
set m11 "$modpath.deep/plain/dir2/1.0" |
| 79 |
set m12 "$m1" |
| 80 |
set lmd12 [file dirname $lmf1] |
| 81 |
set m13 "$m2" |
| 82 |
set lmd13 [file dirname $lmf2] |
| 83 |
set m14 "$m3" |
| 84 |
set lmd14 [file dirname $lmf3] |
| 85 |
set m15 "$m4" |
| 86 |
set lmd15 [file dirname $lmf4] |
| 87 |
set m16 "$m5" |
| 88 |
set lmd16 [file dirname $lmf5] |
| 89 |
|
| 90 |
set m17 "symlink/1.2" |
| 91 |
set lm17 "$m17" |
| 92 |
set lmf17 "$modpath/$lm17" |
| 93 |
set m18 "symlink/bar" |
| 94 |
set lm18 "$lm17" |
| 95 |
set lmf18 "$modpath/$lm18" |
| 96 |
set m19 "symlink/new" |
| 97 |
set lm19 "$lm17" |
| 98 |
set lmf19 "$modpath/$lm19" |
| 99 |
set m20 "$m17" |
| 100 |
set lmd20 [file dirname $lmf17] |
| 101 |
set m21 "$m18" |
| 102 |
set lmd21 [file dirname $lmf18] |
| 103 |
set m22 "$m19" |
| 104 |
set lmd22 [file dirname $lmf19] |
| 105 |
|
| 106 |
# work on virtual modules |
| 107 |
set m23 "loc_rcv1/1.2" |
| 108 |
set lmrc23 "$modpath/loc_rcv1/.modulerc" |
| 109 |
set m24 "$m23" |
| 110 |
set lmf24 "$modpath/loc_rcv1/.common" |
| 111 |
set m25 "loc_rcv1" |
| 112 |
set lmf25 "$lmf24" |
| 113 |
set m26 "loc_rcv2" |
| 114 |
set lm26 "$m26/2.0" |
| 115 |
set lmf26 "$modpath/$m26/.common" |
| 116 |
set rlm26 "$m26/1.5" |
| 117 |
set rlmf26 "$env(TESTSUITEDIR)/virttargets/loc_rcv" |
| 118 |
set rlmf26re [regsub -all "\(\[.+?\]\)" $rlmf26 {\\\1}] |
| 119 |
set m27 "loc_rcv2" |
| 120 |
set lmf27 "$env(TESTSUITEDIR)/virttargets/loc_rcv" |
| 121 |
set m28 "$m24" |
| 122 |
set lmd28 [file dirname $lmf24] |
| 123 |
set m29 "$rlm26" |
| 124 |
set lmf29 "$env(TESTSUITEDIR)/virttargets/loc_rcv" |
| 125 |
set lmf29re [regsub -all "\(\[.+?\]\)" $lmf29 {\\\1}] |
| 126 |
set lmd29 [file dirname $lmf29] |
| 127 |
|
| 128 |
|
| 129 |
set pheader "$modlin $modpathre $modlin" |
| 130 |
set theader "$modpathre:" |
| 131 |
set access_msg "$error_msgs: Permission denied on" |
| 132 |
set hide_perms "ugo-rx" |
| 133 |
|
| 134 |
# |
| 135 |
# Test access to modulefile when access not granted on this modulefile |
| 136 |
# |
| 137 |
|
| 138 |
change_file_perms $lmf1 $hide_perms |
| 139 |
|
| 140 |
testouterr_cmd "sh" "load $m1" "ERR" "$access_msg '$lmf1'" |
| 141 |
testouterr_cmd "sh" "display $m1" "ERR" "$access_msg '$lmf1'" |
| 142 |
testouterr_cmd "sh" "whatis $m1" "ERR" "$access_msg '$lmf1'" |
| 143 |
testouterr_cmd "sh" "avail -t $m1" "OK" "" |
| 144 |
|
| 145 |
restore_file_perms $lmf1 |
| 146 |
|
| 147 |
skip_if_quick_mode |
| 148 |
|
| 149 |
# |
| 150 |
# Test access to alias when access not granted on target modulefile |
| 151 |
# |
| 152 |
|
| 153 |
change_file_perms $lmf2 $hide_perms |
| 154 |
|
| 155 |
testouterr_cmd "sh" "load $m2" "ERR" "$access_msg '$lmf2'" |
| 156 |
testouterr_cmd "sh" "display $m2" "ERR" "$access_msg '$lmf2'" |
| 157 |
testouterr_cmd "sh" "whatis $m2" "ERR" "$access_msg '$lmf2'" |
| 158 |
# alias defined so it appears even if access to target modulefile is denied |
| 159 |
testouterr_cmd_re "sh" "avail -t $m2" "OK" "$theader\n$m2\\(@\\)" |
| 160 |
|
| 161 |
restore_file_perms $lmf2 |
| 162 |
|
| 163 |
# |
| 164 |
# Test access to symbol when access not granted on target modulefile |
| 165 |
# |
| 166 |
|
| 167 |
change_file_perms $lmf3 $hide_perms |
| 168 |
|
| 169 |
testouterr_cmd "sh" "load $m3" "ERR" "$access_msg '$lmf3'" |
| 170 |
testouterr_cmd "sh" "display $m3" "ERR" "$access_msg '$lmf3'" |
| 171 |
testouterr_cmd "sh" "whatis $m3" "ERR" "$access_msg '$lmf3'" |
| 172 |
# symbol is attached to the modulefile so it does not appear if the access |
| 173 |
# to the target modulefile is denied |
| 174 |
testouterr_cmd "sh" "avail -t $m3" "OK" "" |
| 175 |
|
| 176 |
restore_file_perms $lmf3 |
| 177 |
|
| 178 |
# |
| 179 |
# Test access to default symbol when access not granted on target modulefile |
| 180 |
# |
| 181 |
|
| 182 |
change_file_perms $lmf4 $hide_perms |
| 183 |
|
| 184 |
# shout error as if we were trying to access the symbol directly |
| 185 |
testouterr_cmd "sh" "load $m4" "ERR" "$access_msg '$lmf4'" |
| 186 |
testouterr_cmd "sh" "display $m4" "ERR" "$access_msg '$lmf4'" |
| 187 |
# no error on whatis/avail, other versions are listed |
| 188 |
testouterr_cmd_re "sh" "whatis $m4" "OK" "$pheader\n\\s+$m4/2.0: $m4/2.0\n\\s+$m4/3.0: $m4/3.0" |
| 189 |
testouterr_cmd_re "sh" "avail -t $m4" "OK" "$theader\n$m4/2.0\\(\[a-z:\]+\\)\n$m4/3.0\\(\[a-z:\]+\\)" |
| 190 |
|
| 191 |
restore_file_perms $lmf4 |
| 192 |
|
| 193 |
# |
| 194 |
# Test access to implicit default modulefile when access not granted on target |
| 195 |
# modulefile |
| 196 |
# |
| 197 |
|
| 198 |
change_file_perms $lmf5 $hide_perms |
| 199 |
|
| 200 |
if {[is_conf_enabled advversspec implicitdefault]} { |
| 201 |
lappend ans [list set __MODULES_LMALTNAME $rlm5&loc_rc1/foo&as|loc_rc1/default&as|loc_rc1/latest] |
| 202 |
} else { |
| 203 |
lappend ans [list set __MODULES_LMALTNAME $rlm5&loc_rc1/foo] |
| 204 |
} |
| 205 |
lappend ans [list set _LMFILES_ $rlmf5] |
| 206 |
lappend ans [list set LOADEDMODULES $rlm5] |
| 207 |
lappend ans [list set testsuite yes] |
| 208 |
|
| 209 |
# another implicit default is chosen |
| 210 |
testouterr_cmd "sh" "load $m5" [if_implicitdefault $ans ERR] [if_implicitdefault {} "$err_nodefault'$m5'"] |
| 211 |
testouterr_cmd_re "sh" "display $m5" [if_implicitdefault OK ERR] [if_implicitdefault "$modlin\n$rlmf5re:\n\nmodule-whatis\t$rlm5\nsetenv\t\ttestsuite yes\n$modlin" "$err_nodefault'$m6'"] |
| 212 |
testouterr_cmd_re "sh" "whatis $m5" "OK" "$pheader\n\\s+$rlm5: $rlm5" |
| 213 |
testouterr_cmd_re "sh" "avail -t $m5" "OK" "$theader\n$rlm5\\(\[a-z:\]+\\)" |
| 214 |
|
| 215 |
# keep file permissions as it is for next test |
| 216 |
|
| 217 |
# |
| 218 |
# Test access to implicit default modulefile when access not granted on target |
| 219 |
# modulefile and there is no other implicit default available |
| 220 |
# |
| 221 |
|
| 222 |
change_file_perms $lmf6 $hide_perms |
| 223 |
|
| 224 |
# nothing found |
| 225 |
testouterr_cmd "sh" "load $m6" "ERR" "$err_path'$m6'" |
| 226 |
testouterr_cmd "sh" "display $m6" "ERR" "$err_path'$m6'" |
| 227 |
testouterr_cmd "sh" "whatis $m6" "ERR" "$err_path'$m6'" |
| 228 |
testouterr_cmd "sh" "avail -t $m6" "OK" "" |
| 229 |
|
| 230 |
restore_file_perms $lmf6 |
| 231 |
restore_file_perms $lmf5 |
| 232 |
|
| 233 |
# |
| 234 |
# Test access to implicit default alias when access not granted on target modulefile |
| 235 |
# |
| 236 |
|
| 237 |
change_file_perms $lmf7 $hide_perms |
| 238 |
|
| 239 |
# shout error as if we were trying to access the alias directly |
| 240 |
testouterr_cmd "sh" "load $m7" "ERR" [if_implicitdefault "$access_msg '$lmf7'" "$err_nodefault'$m7'"] |
| 241 |
testouterr_cmd "sh" "display $m7" "ERR" [if_implicitdefault "$access_msg '$lmf7'" "$err_nodefault'$m7'"] |
| 242 |
# no error on whatis/avail, other versions are listed |
| 243 |
testouterr_cmd_re "sh" "whatis $m7" "OK" "$pheader\n\\s+$m7/1.2: $m7/1.2" |
| 244 |
# alias defined so it appears even if access to target modulefile is denied |
| 245 |
testouterr_cmd_re "sh" "avail -t $m7" "OK" "$theader\n$m7/1\\(@\\)\n$m7/1.2\n$m7/bar\\(@\\)" |
| 246 |
|
| 247 |
restore_file_perms $lmf7 |
| 248 |
|
| 249 |
# |
| 250 |
# Test access to alias when access not granted on modulerc defining it |
| 251 |
# |
| 252 |
|
| 253 |
change_file_perms $lmrc8 $hide_perms |
| 254 |
|
| 255 |
# cannot locate module |
| 256 |
testouterr_cmd "sh" "load $m8" "ERR" "$err_path'$m8'" |
| 257 |
testouterr_cmd "sh" "display $m8" "ERR" "$err_path'$m8'" |
| 258 |
testouterr_cmd "sh" "whatis $m8" "ERR" "$err_path'$m8'" |
| 259 |
testouterr_cmd "sh" "avail -t $m8" "OK" "" |
| 260 |
|
| 261 |
restore_file_perms $lmrc8 |
| 262 |
|
| 263 |
# |
| 264 |
# Test access to symbol when access not granted on modulerc defining it |
| 265 |
# |
| 266 |
|
| 267 |
change_file_perms $lmrc9 $hide_perms |
| 268 |
|
| 269 |
# cannot locate module |
| 270 |
testouterr_cmd "sh" "load $m9" "ERR" "$err_path'$m9'" |
| 271 |
testouterr_cmd "sh" "display $m9" "ERR" "$err_path'$m9'" |
| 272 |
testouterr_cmd "sh" "whatis $m9" "ERR" "$err_path'$m9'" |
| 273 |
testouterr_cmd "sh" "avail -t $m9" "OK" "" |
| 274 |
|
| 275 |
restore_file_perms $lmrc9 |
| 276 |
|
| 277 |
# |
| 278 |
# Test access to default symbol when access not granted on modulerc defining it |
| 279 |
# |
| 280 |
|
| 281 |
change_file_perms $lmrc10 $hide_perms |
| 282 |
|
| 283 |
set ans [list] |
| 284 |
if {[is_conf_enabled advversspec implicitdefault]} { |
| 285 |
lappend ans [list set __MODULES_LMALTNAME $rlm10&as|$m10/default&as|$m10/latest] |
| 286 |
} |
| 287 |
lappend ans [list set _LMFILES_ $rlmf10] |
| 288 |
lappend ans [list set LOADEDMODULES $rlm10] |
| 289 |
lappend ans [list set testsuite yes] |
| 290 |
|
| 291 |
# another implicit default is chosen |
| 292 |
testouterr_cmd "sh" "load $m10" [if_implicitdefault $ans ERR] [if_implicitdefault {} "$err_nodefault'$m10'"] |
| 293 |
testouterr_cmd_re "sh" "display $m10" [if_implicitdefault OK ERR] [if_implicitdefault "$modlin\n$rlmf10re:\n\nmodule-whatis\t$rlm10\nsetenv\t\ttestsuite yes\n$modlin" "$err_nodefault'$m10'"] |
| 294 |
testouterr_cmd_re "sh" "whatis $m10" "OK" "$pheader\n\\s+$m10/1.0: $m10/1.0\n\\s+$m10/2.0: $m10/2.0\n\\s+$m10/3.0: $m10/3.0" |
| 295 |
testouterr_cmd_re "sh" "avail -t $m10" "OK" "$theader\n$m10/1.0\n$m10/2.0\n$m10/3.0" |
| 296 |
|
| 297 |
restore_file_perms $lmrc10 |
| 298 |
|
| 299 |
# |
| 300 |
# Test access to full path modulefile when access not granted on this modulefile |
| 301 |
# |
| 302 |
|
| 303 |
change_file_perms $m11 $hide_perms |
| 304 |
|
| 305 |
# cannot locate module |
| 306 |
testouterr_cmd "sh" "load $m11" "ERR" "$access_msg '$m11'" |
| 307 |
testouterr_cmd "sh" "display $m11" "ERR" "$access_msg '$m11'" |
| 308 |
# no whatis/avail test as it relies only on MODULEPATH search |
| 309 |
|
| 310 |
restore_file_perms $m11 |
| 311 |
|
| 312 |
# |
| 313 |
# Test access to modulefile when access not granted on its upper directory |
| 314 |
# |
| 315 |
|
| 316 |
change_file_perms $lmd12 $hide_perms |
| 317 |
|
| 318 |
# cannot locate module |
| 319 |
testouterr_cmd "sh" "load $m12" "ERR" "$err_path'$m12'" |
| 320 |
testouterr_cmd "sh" "display $m12" "ERR" "$err_path'$m12'" |
| 321 |
testouterr_cmd "sh" "whatis $m12" "ERR" "$err_path'$m12'" |
| 322 |
testouterr_cmd "sh" "avail -t $m12" "OK" "" |
| 323 |
|
| 324 |
restore_file_perms $lmd12 |
| 325 |
|
| 326 |
# |
| 327 |
# Test access to alias when access not granted on its upper directory |
| 328 |
# |
| 329 |
|
| 330 |
change_file_perms $lmd13 $hide_perms |
| 331 |
|
| 332 |
# cannot locate module |
| 333 |
testouterr_cmd "sh" "load $m13" "ERR" "$err_path'$m13'" |
| 334 |
testouterr_cmd "sh" "display $m13" "ERR" "$err_path'$m13'" |
| 335 |
testouterr_cmd "sh" "whatis $m13" "ERR" "$err_path'$m13'" |
| 336 |
testouterr_cmd "sh" "avail -t $m13" "OK" "" |
| 337 |
|
| 338 |
restore_file_perms $lmd13 |
| 339 |
|
| 340 |
# |
| 341 |
# Test access to symbol when access not granted on its upper directory |
| 342 |
# |
| 343 |
|
| 344 |
change_file_perms $lmd14 $hide_perms |
| 345 |
|
| 346 |
# cannot locate module |
| 347 |
testouterr_cmd "sh" "load $m14" "ERR" "$err_path'$m14'" |
| 348 |
testouterr_cmd "sh" "display $m14" "ERR" "$err_path'$m14'" |
| 349 |
testouterr_cmd "sh" "whatis $m14" "ERR" "$err_path'$m14'" |
| 350 |
testouterr_cmd "sh" "avail -t $m14" "OK" "" |
| 351 |
|
| 352 |
restore_file_perms $lmd14 |
| 353 |
|
| 354 |
# |
| 355 |
# Test access to default symbol when access not granted on its upper directory |
| 356 |
# |
| 357 |
|
| 358 |
change_file_perms $lmd15 $hide_perms |
| 359 |
|
| 360 |
# permission denied on directory |
| 361 |
testouterr_cmd "sh" "load $m15" "ERR" "$access_msg '$lmd15'" |
| 362 |
testouterr_cmd "sh" "display $m15" "ERR" "$access_msg '$lmd15'" |
| 363 |
testouterr_cmd "sh" "whatis $m15" "ERR" "$access_msg '$lmd15'" |
| 364 |
testouterr_cmd "sh" "avail -t $m15" "OK" "" |
| 365 |
|
| 366 |
restore_file_perms $lmd15 |
| 367 |
|
| 368 |
# |
| 369 |
# Test access to implicit default modulefile when access not granted on its |
| 370 |
# upper directory |
| 371 |
# |
| 372 |
|
| 373 |
change_file_perms $lmd16 $hide_perms |
| 374 |
|
| 375 |
# permission denied on directory |
| 376 |
testouterr_cmd "sh" "load $m16" "ERR" "$access_msg '$lmd16'" |
| 377 |
testouterr_cmd "sh" "display $m16" "ERR" "$access_msg '$lmd16'" |
| 378 |
testouterr_cmd "sh" "whatis $m16" "ERR" "$access_msg '$lmd16'" |
| 379 |
testouterr_cmd "sh" "avail -t $m16" "OK" "" |
| 380 |
|
| 381 |
restore_file_perms $lmd16 |
| 382 |
|
| 383 |
# |
| 384 |
# Test access to symlink modulefile when access not granted on this modulefile |
| 385 |
# |
| 386 |
|
| 387 |
change_file_perms $lmf17 $hide_perms |
| 388 |
|
| 389 |
testouterr_cmd "sh" "load $m17" "ERR" "$access_msg '$lmf17'" |
| 390 |
testouterr_cmd "sh" "display $m17" "ERR" "$access_msg '$lmf17'" |
| 391 |
testouterr_cmd "sh" "whatis $m17" "ERR" "$access_msg '$lmf17'" |
| 392 |
testouterr_cmd "sh" "avail -t $m17" "OK" "" |
| 393 |
|
| 394 |
restore_file_perms $lmf17 |
| 395 |
|
| 396 |
# |
| 397 |
# Test access to alias when access not granted on target symlink modulefile |
| 398 |
# |
| 399 |
|
| 400 |
change_file_perms $lmf18 $hide_perms |
| 401 |
|
| 402 |
testouterr_cmd "sh" "load $m18" "ERR" "$access_msg '$lmf18'" |
| 403 |
testouterr_cmd "sh" "display $m18" "ERR" "$access_msg '$lmf18'" |
| 404 |
testouterr_cmd "sh" "whatis $m18" "ERR" "$access_msg '$lmf18'" |
| 405 |
# alias defined so it appears even if access to target modulefile is denied |
| 406 |
testouterr_cmd_re "sh" "avail -t $m18" "OK" "$theader\n$m18\\(@\\)" |
| 407 |
|
| 408 |
restore_file_perms $lmf18 |
| 409 |
|
| 410 |
# |
| 411 |
# Test access to symbol when access not granted on target symlink modulefile |
| 412 |
# |
| 413 |
|
| 414 |
change_file_perms $lmf19 $hide_perms |
| 415 |
|
| 416 |
testouterr_cmd "sh" "load $m19" "ERR" "$access_msg '$lmf19'" |
| 417 |
testouterr_cmd "sh" "display $m19" "ERR" "$access_msg '$lmf19'" |
| 418 |
testouterr_cmd "sh" "whatis $m19" "ERR" "$access_msg '$lmf19'" |
| 419 |
# symbol is attached to the modulefile so it does not appear if the access |
| 420 |
# to the target modulefile is denied |
| 421 |
testouterr_cmd "sh" "avail -t $m19" "OK" "" |
| 422 |
|
| 423 |
restore_file_perms $lmf19 |
| 424 |
|
| 425 |
# |
| 426 |
# Test access to modulefile when access not granted on symlink target directory |
| 427 |
# |
| 428 |
|
| 429 |
change_file_perms $lmd20 $hide_perms |
| 430 |
|
| 431 |
# cannot locate module |
| 432 |
testouterr_cmd "sh" "load $m20" "ERR" "$err_path'$m20'" |
| 433 |
testouterr_cmd "sh" "display $m20" "ERR" "$err_path'$m20'" |
| 434 |
testouterr_cmd "sh" "whatis $m20" "ERR" "$err_path'$m20'" |
| 435 |
testouterr_cmd "sh" "avail -t $m20" "OK" "" |
| 436 |
|
| 437 |
restore_file_perms $lmd20 |
| 438 |
|
| 439 |
# |
| 440 |
# Test access to alias when access not granted on symlink target directory |
| 441 |
# |
| 442 |
|
| 443 |
change_file_perms $lmd21 $hide_perms |
| 444 |
|
| 445 |
# cannot locate module |
| 446 |
testouterr_cmd "sh" "load $m21" "ERR" "$err_path'$m21'" |
| 447 |
testouterr_cmd "sh" "display $m21" "ERR" "$err_path'$m21'" |
| 448 |
testouterr_cmd "sh" "whatis $m21" "ERR" "$err_path'$m21'" |
| 449 |
testouterr_cmd "sh" "avail -t $m21" "OK" "" |
| 450 |
|
| 451 |
restore_file_perms $lmd21 |
| 452 |
|
| 453 |
# |
| 454 |
# Test access to symbol when access not granted on symlink target directory |
| 455 |
# |
| 456 |
|
| 457 |
change_file_perms $lmd22 $hide_perms |
| 458 |
|
| 459 |
# cannot locate module |
| 460 |
testouterr_cmd "sh" "load $m22" "ERR" "$err_path'$m22'" |
| 461 |
testouterr_cmd "sh" "display $m22" "ERR" "$err_path'$m22'" |
| 462 |
testouterr_cmd "sh" "whatis $m22" "ERR" "$err_path'$m22'" |
| 463 |
testouterr_cmd "sh" "avail -t $m22" "OK" "" |
| 464 |
|
| 465 |
restore_file_perms $lmd22 |
| 466 |
|
| 467 |
# |
| 468 |
# Test access to virtual module when access not granted on modulerc defining it |
| 469 |
# |
| 470 |
|
| 471 |
change_file_perms $lmrc23 $hide_perms |
| 472 |
|
| 473 |
# cannot locate module |
| 474 |
testouterr_cmd "sh" "load $m23" "ERR" "$err_path'$m23'" |
| 475 |
testouterr_cmd "sh" "display $m23" "ERR" "$err_path'$m23'" |
| 476 |
testouterr_cmd "sh" "whatis $m23" "ERR" "$err_path'$m23'" |
| 477 |
testouterr_cmd "sh" "avail -t $m23" "OK" "" |
| 478 |
|
| 479 |
restore_file_perms $lmrc23 |
| 480 |
|
| 481 |
# |
| 482 |
# Test access to virtual module when access not granted on its target file |
| 483 |
# |
| 484 |
|
| 485 |
change_file_perms $lmf24 $hide_perms |
| 486 |
|
| 487 |
testouterr_cmd "sh" "load $m24" "ERR" "$access_msg '$lmf24'" |
| 488 |
testouterr_cmd "sh" "display $m24" "ERR" "$access_msg '$lmf24'" |
| 489 |
testouterr_cmd "sh" "whatis $m24" "ERR" "$access_msg '$lmf24'" |
| 490 |
testouterr_cmd "sh" "avail -t $m24" "OK" "" |
| 491 |
|
| 492 |
restore_file_perms $lmf24 |
| 493 |
|
| 494 |
# |
| 495 |
# Test access to default symbol when access not granted on virtual target file |
| 496 |
# |
| 497 |
|
| 498 |
change_file_perms $lmf25 $hide_perms |
| 499 |
|
| 500 |
# shout error as if we were trying to access the symbol directly |
| 501 |
testouterr_cmd "sh" "load $m25" "ERR" "$access_msg '$lmf25'" |
| 502 |
testouterr_cmd "sh" "display $m25" "ERR" "$access_msg '$lmf25'" |
| 503 |
# no error on whatis/avail, other versions are listed |
| 504 |
testouterr_cmd_re "sh" "whatis $m25" "OK" "$pheader\n\\s+$m25/1.1: $m25/1.1" |
| 505 |
testouterr_cmd_re "sh" "avail -t $m25" "OK" "$theader\n$m25/1\\(@\\)\n$m25/1.1\n$m25/bar\\(@\\)" |
| 506 |
|
| 507 |
restore_file_perms $lmf25 |
| 508 |
|
| 509 |
# |
| 510 |
# Test access to implicit default (a virtual module) when access not granted on |
| 511 |
# its target file |
| 512 |
# |
| 513 |
|
| 514 |
change_file_perms $lmf26 $hide_perms |
| 515 |
|
| 516 |
set ans [list] |
| 517 |
if {[is_conf_enabled advversspec implicitdefault]} { |
| 518 |
lappend ans [list set __MODULES_LMALTNAME $rlm26&as|$m26/default&as|$m26/latest] |
| 519 |
} |
| 520 |
lappend ans [list set _LMFILES_ $rlmf26] |
| 521 |
lappend ans [list set LOADEDMODULES $rlm26] |
| 522 |
lappend ans [list set testsuite yes] |
| 523 |
|
| 524 |
# another implicit default is chosen |
| 525 |
testouterr_cmd "sh" "load $m26" [if_implicitdefault $ans ERR] [if_implicitdefault {} "$err_nodefault'$m26'"] |
| 526 |
testouterr_cmd_re "sh" "display $m26" [if_implicitdefault OK ERR] [if_implicitdefault "$modlin\n$rlmf26re:\n\nmodule-whatis\t$rlm26\nsetenv\t\ttestsuite yes\n$modlin" "$err_nodefault'$m26'"] |
| 527 |
testouterr_cmd_re "sh" "whatis $m26" "OK" "$pheader\n\\s+$rlm26: $rlm26" |
| 528 |
testouterr_cmd_re "sh" "avail -t $m26" "OK" "$theader\n$rlm26" |
| 529 |
|
| 530 |
# keep file permissions as it is for next test |
| 531 |
|
| 532 |
# |
| 533 |
# Test access to implicit default (a virtual module) when access not granted on |
| 534 |
# its target file and there is no other implicit default available |
| 535 |
# |
| 536 |
|
| 537 |
change_file_perms $lmf27 $hide_perms |
| 538 |
|
| 539 |
# nothing found |
| 540 |
testouterr_cmd "sh" "load $m27" "ERR" "$err_path'$m27'" |
| 541 |
testouterr_cmd "sh" "display $m27" "ERR" "$err_path'$m27'" |
| 542 |
testouterr_cmd "sh" "whatis $m27" "ERR" "$err_path'$m27'" |
| 543 |
testouterr_cmd "sh" "avail -t $m27" "OK" "" |
| 544 |
|
| 545 |
restore_file_perms $lmf27 |
| 546 |
restore_file_perms $lmf26 |
| 547 |
|
| 548 |
# |
| 549 |
# Test access to virtual module when access not granted on its upper directory |
| 550 |
# |
| 551 |
|
| 552 |
change_file_perms $lmd28 $hide_perms |
| 553 |
|
| 554 |
# cannot locate module |
| 555 |
testouterr_cmd "sh" "load $m28" "ERR" "$err_path'$m28'" |
| 556 |
testouterr_cmd "sh" "display $m28" "ERR" "$err_path'$m28'" |
| 557 |
testouterr_cmd "sh" "whatis $m28" "ERR" "$err_path'$m28'" |
| 558 |
testouterr_cmd "sh" "avail -t $m28" "OK" "" |
| 559 |
|
| 560 |
restore_file_perms $lmd28 |
| 561 |
|
| 562 |
# |
| 563 |
# Test access to virtual module when access not granted on upper directory of |
| 564 |
# its target file, located in a different directory |
| 565 |
# |
| 566 |
|
| 567 |
change_file_perms $lmd29 $hide_perms |
| 568 |
|
| 569 |
# different result if a file in a locked directory still readable on this system |
| 570 |
if {$is_locked_dir_file_readable} { |
| 571 |
set ans [list] |
| 572 |
lappend ans [list set _LMFILES_ $lmf29] |
| 573 |
lappend ans [list set LOADEDMODULES $m29] |
| 574 |
lappend ans [list set testsuite yes] |
| 575 |
|
| 576 |
testouterr_cmd "sh" "load $m29" $ans "" |
| 577 |
testouterr_cmd_re "sh" "display $m29" "OK" "$modlin\n$lmf29re:\n\nmodule-whatis\t$m29\nsetenv\t\ttestsuite yes\n$modlin" |
| 578 |
testouterr_cmd_re "sh" "whatis $m29" "OK" "$pheader\n\\s+$m29: $m29" |
| 579 |
testouterr_cmd_re "sh" "avail -t $m29" "OK" "$theader\n$m29" |
| 580 |
} else { |
| 581 |
# cannot locate module |
| 582 |
testouterr_cmd "sh" "load $m29" "ERR" "$access_msg '$lmf29'" |
| 583 |
testouterr_cmd "sh" "display $m29" "ERR" "$access_msg '$lmf29'" |
| 584 |
testouterr_cmd "sh" "whatis $m29" "ERR" "$access_msg '$lmf29'" |
| 585 |
testouterr_cmd "sh" "avail -t $m29" "OK" "" |
| 586 |
} |
| 587 |
|
| 588 |
restore_file_perms $lmd29 |
| 589 |
|
| 590 |
# |
| 591 |
# Cleanup |
| 592 |
# |
| 593 |
|
| 594 |
reset_test_env |
| 595 |
|
| 596 |
} |