mirror of
https://github.com/envmodules/modules.git
synced 2026-06-18 00:06:53 +08:00
No error raise on empty arg list for load
To cope with initadd behavior that require at least an empty 'module load' line in startup files. (fix SF bug#88)
This commit is contained in:
@@ -33,7 +33,7 @@ echo "FATAL: module: Could not find tclsh in \$PATH or in standard directories"
|
||||
#
|
||||
# Some Global Variables.....
|
||||
#
|
||||
set MODULES_CURRENT_VERSION 1.883
|
||||
set MODULES_CURRENT_VERSION 1.884
|
||||
set MODULES_CURRENT_RELEASE_DATE "2017-06-13"
|
||||
set g_debug 0 ;# Set to 1 to enable debugging
|
||||
set error_count 0 ;# Start with 0 errors
|
||||
@@ -752,9 +752,9 @@ proc module {command args} {
|
||||
|
||||
switch -regexp -- $command {
|
||||
{^(add|lo)} {
|
||||
if {[llength $args] == 0} {
|
||||
set errormsg "Unexpected number of args for 'load' command"
|
||||
} else {
|
||||
# no error raised on empty argument list to cope with
|
||||
# initadd command that may expect this behavior
|
||||
if {[llength $args] > 0} {
|
||||
pushCommandName "load"
|
||||
if {$topcall || $mode eq "load"} {
|
||||
eval cmdModuleLoad $args
|
||||
|
||||
@@ -44,23 +44,25 @@ if { $verbose > 0 } {
|
||||
send_user "\tChecking commands against wrong argument number...\n"
|
||||
}
|
||||
|
||||
# empty argument list on load command does not lead to error (nop)
|
||||
testouterr_cmd "sh" "load" "" ""
|
||||
|
||||
# unexpected number of arguments leads to error code
|
||||
testouterr_cmd "sh" "load" "$err_sh" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "bash" "load" "$err_sh" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "ksh" "load" "$err_sh" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "zsh" "load" "$err_sh" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "csh" "load" "$err_csh" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "tcsh" "load" "$err_csh" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "fish" "load" "$err_fish" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "tcl" "load" "$err_tcl" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "perl" "load" "$err_perl" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "python" "load" "$err_python" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "lisp" "load" "$err_lisp" "${bad_arg1}load${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "sh" "unload" "$err_sh" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "bash" "unload" "$err_sh" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "ksh" "unload" "$err_sh" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "zsh" "unload" "$err_sh" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "csh" "unload" "$err_csh" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "tcsh" "unload" "$err_csh" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "fish" "unload" "$err_fish" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "tcl" "unload" "$err_tcl" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "perl" "unload" "$err_perl" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "python" "unload" "$err_python" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "lisp" "unload" "$err_lisp" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
|
||||
# only check sh shell for the remaining test, as we already test above
|
||||
# that every supported shells respond correctly to error raise
|
||||
|
||||
testouterr_cmd "sh" "unload" "$err_sh" "${bad_arg1}unload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "sh" "reload foo" "$err_sh" "${bad_arg1}reload${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "sh" "source" "$err_sh" "${bad_arg1}source${bad_arg2}\n$type_help"
|
||||
testouterr_cmd "sh" "switch" "$err_sh" "${bad_arg1}switch${bad_arg2}\n$type_help"
|
||||
|
||||
Reference in New Issue
Block a user