From ef0dd6bed39f66ef3bcb1ab73c8652ec1ca90575 Mon Sep 17 00:00:00 2001 From: sirdude Date: Mon, 10 Sep 2012 21:01:33 +0000 Subject: [PATCH] A couple of small patches by Thomas Zeiser thomas.zeiser@rrze.uni-erlangen.de The first one adds some checks to make sure a directory is readable before trying to read it. The second reverses the order of perging modules so that they are removed last to first, which maybe seems more intuitive? Kent --- tcl/modulecmd.tcl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tcl/modulecmd.tcl b/tcl/modulecmd.tcl index d02a4b8d..7cad3146 100755 --- a/tcl/modulecmd.tcl +++ b/tcl/modulecmd.tcl @@ -20,7 +20,7 @@ echo "FATAL: module: Could not find tclsh in \$PATH or in standard directories" # # Some Global Variables..... # -regsub {\$[^:]+:\s*(\S+)\s*\$} {$Revision: 1.146 $} {\1}\ +regsub {\$[^:]+:\s*(\S+)\s*\$} {$Revision: 1.147 $} {\1}\ MODULES_CURRENT_VERSION set g_debug 0 ;# Set to 1 to enable debugging set error_count 0 ;# Start with 0 errors @@ -1990,7 +1990,7 @@ proc listModules {dir mod {full_path 1} {sort_order {-dictionary}}\ set modulename [string range $element $sstart end] - if {[file isdirectory $element]} { + if {[file isdirectory $element] && [file readable $element]} { set ModulesVersion "" if {$g_debug} { @@ -2477,7 +2477,7 @@ proc cmdModulePurge {{separator {}}} { if {[info exists env(LOADEDMODULES)]} { set list [split $env(LOADEDMODULES) $separator] - eval cmdModuleUnload $list + eval cmdModuleUnload [reverseList $list] } } @@ -2563,7 +2563,7 @@ proc cmdModuleAvail {{mod {*}}} { } foreach dir [split $env(MODULEPATH) $g_def_separator] { - if {[file isdirectory "$dir"]} { + if {[file isdirectory "$dir"] && [file readable $dir]} { set len [string length $dir] set lrep [expr {($DEF_COLUMNS - $len - 2)/2}] set rrep [expr {$DEF_COLUMNS - $len - 2 - $lrep}]