From 76c8ffe82bef5bb09f6b8b09cdc42898c56fca94 Mon Sep 17 00:00:00 2001 From: Xavier Delaruelle Date: Tue, 19 Dec 2023 07:18:02 +0100 Subject: [PATCH] Add conflict unload failed msg at end of conun unload Rather reporting conflict unload error message in a global conflict error management in cmdModuleLoad after modulefile evaluation, report such error directly where it occurs in cmdModuleUnload. A more precise error message is obtained as the exact module name, version and variant is reported rather module specification passed to conflict definition. Error message is also reported in the correct event order rather at the end. --- .hunspell.en.dic | 1 + tcl/report.tcl.in | 8 ++++++++ tcl/subcmd.tcl.in | 12 ++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.hunspell.en.dic b/.hunspell.en.dic index a99eefd5..8e12e58e 100644 --- a/.hunspell.en.dic +++ b/.hunspell.en.dic @@ -328,6 +328,7 @@ compopt config configs contrib +conun cov cp cr diff --git a/tcl/report.tcl.in b/tcl/report.tcl.in index a3c81233..22681498 100644 --- a/tcl/report.tcl.in +++ b/tcl/report.tcl.in @@ -102,6 +102,14 @@ proc __reportErrorAndExit {message} { error $message {} MODULES_ERR_RENDERED } +proc reportErrorOrWarningIfForced {message} { + if {[getState force]} { + reportWarning $message + } else { + reportError $message + } +} + proc reportInternalBug {message {modfile {}} {title {Module ERROR}}} { reportError [formatInternalBugMsg $message $modfile] 0 $title me } diff --git a/tcl/subcmd.tcl.in b/tcl/subcmd.tcl.in index baf1a6ee..4ffeddcc 100644 --- a/tcl/subcmd.tcl.in +++ b/tcl/subcmd.tcl.in @@ -1320,17 +1320,13 @@ proc cmdModuleLoad {context uasked tryload loadany tag_list args} { if {$report_con && [info exists conmsg]} { reportWarning $conmsg } - # raise conun-specific msg to top level if attempted - if {$retisconun} { - reportWarning [getErrConUnMsg $moddecconlist] 1 - } } elseif {$doescon} { if {$retisconun} { if {[info exists conmsg]} { reportError $conmsg } - # raise conun-specific msg to top level if attempted - knerror [getErrConUnMsg $moddecconlist] + # conun-specific msg has already been reported + knerror {} } else { knerror $conmsg } @@ -1823,6 +1819,10 @@ proc cmdModuleUnload {context match auto force onlyureq onlyndep args} { reportError "Unload of switched-off [getModuleDesignation\ loaded $modname] failed" } + conun { + reportErrorOrWarningIfForced [getErrConUnMsg\ + [getModuleDesignation loaded $modname]] + } } }