Blame SOURCES/environment-modules-moulespath-initrc.patch

523655
diff --git a/modules-4.5.2/modulecmd.tcl.in b/modulecmd.tcl.in
523655
index 3abd4ad..cf6cb3b 100644
523655
--- a/modules-4.5.2/modulecmd.tcl.in
523655
+++ b/modulecmd.tcl.in
523655
@@ -10564,8 +10564,17 @@ proc cmdModuleAutoinit {} {
523655
    @VERSIONING@   setenv MODULE_VERSION_STACK @MODULES_RELEASE@@MODULES_BUILD@
523655
    @VERSIONING@}
523655
 
523655
-   # initialize default MODULEPATH and LOADEDMODULES
523655
-   if {![info exists ::env(MODULEPATH)] || $::env(MODULEPATH) eq {}} {
523655
+   # initialize MODULEPATH and LOADEDMODULES if found unset
523655
+   if {![info exists ::env(MODULEPATH)]} {
523655
+      setenv MODULEPATH {}
523655
+   }
523655
+   if {![info exists ::env(LOADEDMODULES)]} {
523655
+      setenv LOADEDMODULES {}
523655
+   }
523655
+
523655
+   # initialize user environment if found undefined (both MODULEPATH and
523655
+   # LOADEDMODULES empty)
523655
+   if {$::env(MODULEPATH) eq {} && $::env(LOADEDMODULES) eq {}} {
523655
       # set modpaths defined in modulespath config file if it exists, use file
523655
       # in etcdir if it exists, dot file in initdir elsewhere
523655
       set modulespath [expr {[file exists @etcdir@/modulespath] ?\
523655
@@ -10580,17 +10589,8 @@ proc cmdModuleAutoinit {} {
523655
          }
523655
       }
523655
 
523655
-      if {![info exists ::env(MODULEPATH)]} {
523655
-         setenv MODULEPATH {}
523655
-      }
523655
-   }
523655
-   if {![info exists ::env(LOADEDMODULES)]} {
523655
-      setenv LOADEDMODULES {}
523655
-   }
523655
-
523655
-   # source initialization modulerc if any and if no env already initialized
523655
-   # use initrc file in etcdir if any, modulerc file in initdir otherwise
523655
-   if {$::env(MODULEPATH) eq {} && $::env(LOADEDMODULES) eq {}} {
523655
+      # source initialization modulerc if any and if no env already initialized
523655
+      # use initrc file in etcdir if any, modulerc file in initdir otherwise
523655
       set initrc [expr {[file exists @etcdir@/initrc] ? {@etcdir@/initrc} :\
523655
          {@initdir@/modulerc}}]
523655
       if {[file exists $initrc]} {