From e8d656d0dd4fae3f2ba6041a4c2892103df5c1f6 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Wed, 26 Aug 2020 08:00:56 +0200 Subject: [PATCH] Warn when evaluate a nearly-forbidden module Produce a warning message when a module with *nearly-forbidden* is evaluated. Message produced indicate the date time starting when module will effectively be forbidden. --- modulecmd.tcl.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modulecmd.tcl.in b/modulecmd.tcl.in index 6e4963ea..abdb03b5 100644 --- a/modulecmd.tcl.in +++ b/modulecmd.tcl.in @@ -1237,6 +1237,12 @@ proc getForbiddenMsg {mod} { return $msg } +proc getNearlyForbiddenMsg {mod} { + set after [getModuleTagProp $mod nearly-forbidden after] + set msg "Access to module will be denied starting '$after'" + return $msg +} + ######################################################################## # Use a subordinate Tcl interpreter to execute modulefiles # @@ -1427,6 +1433,11 @@ proc execute-modulefile {modfile modname modspec {must_have_cookie 1}} { reportDebug "sourcing $modfile" + # inform that access to module will be soon denied + if {[isModuleTagged $modname nearly-forbidden]} { + reportWarning [getNearlyForbiddenMsg $modname] + } + if {![info exists ::g_modfileUntrackVars]} { # list variable that should not be tracked for saving array set ::g_modfileUntrackVars [list ModulesCurrentModulefile 1\