From 31ee4664790b1a773c6c36e1c6e868adf1b0a27b Mon Sep 17 00:00:00 2001 From: eabdullin Date: Tue, 14 Nov 2023 19:06:26 +0000 Subject: [PATCH] import UBI environment-modules-4.5.2-4.el8 --- ...nt-modules-module-switch-mod-modvers.patch | 44 +++++++++++++++++++ SPECS/environment-modules.spec | 6 ++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 SOURCES/environment-modules-module-switch-mod-modvers.patch diff --git a/SOURCES/environment-modules-module-switch-mod-modvers.patch b/SOURCES/environment-modules-module-switch-mod-modvers.patch new file mode 100644 index 0000000..037f40d --- /dev/null +++ b/SOURCES/environment-modules-module-switch-mod-modvers.patch @@ -0,0 +1,44 @@ +From 741f2e6b61b2c574e9c6972d3633653c26bb143a Mon Sep 17 00:00:00 2001 +From: Xavier Delaruelle +Date: Mon, 10 Aug 2020 19:22:46 +0200 +Subject: [PATCH] Skip module switch conflict set if old matches new + +`module switch` command used in modulefile is sometimes used to ensure a +given version of a module is loaded. Currently loaded version of this +module is unloaded to replace it by the designated specific version. +This use case does not cope with the conflict declaration that is set +over switched-off module specification. To support this use case, +conflict definition is skipped if swapped-off module specification +matches (includes) swapped-on module specification. + +Fixes #355 +--- + modulecmd.tcl.in | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/modulecmd.tcl.in b/modulecmd.tcl.in +index 3abd4ad9a..8658b90bd 100644 +--- a/modulecmd.tcl.in ++++ b/modulecmd.tcl.in +@@ -9482,11 +9482,16 @@ proc cmdModuleSwitch {uasked old {new {}}} { + # mentionned on this module switch command set in a modulefile + set orig_auto_handling [getConf auto_handling] + if {!$uasked && $argold ne {}} { +- # temporarily disable auto handling just to record deps, not to try to +- # load or unload them (already tried) +- setConf auto_handling 0 +- catch {conflict $argold} +- setConf auto_handling $orig_auto_handling ++ # skip conflict declaration if old spec matches new as in this case ++ # switch means *replace loaded version of mod by this specific version* ++ lassign [getPathToModule $new] newmodfile newmod ++ if {$newmod eq {} || ![modEq $argold $newmod eqstart]} { ++ # temporarily disable auto handling just to record deps, not to try ++ # to load or unload them (already tried) ++ setConf auto_handling 0 ++ catch {conflict $argold} ++ setConf auto_handling $orig_auto_handling ++ } + } + + # attempt load and depre reload only if unload succeed diff --git a/SPECS/environment-modules.spec b/SPECS/environment-modules.spec index 4283ab8..0915a2c 100644 --- a/SPECS/environment-modules.spec +++ b/SPECS/environment-modules.spec @@ -3,7 +3,7 @@ Name: environment-modules Version: 4.5.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Provides dynamic modification of a user's environment Group: System Environment/Base @@ -13,6 +13,7 @@ Source0: http://downloads.sourceforge.net/modules/modules-%{version}.tar. Patch0001: environment-modules-configure.patch Patch0002: environment-modules-moulespath-initrc.patch Patch0003: environment-modules-profilesh-misdetects-login-shell.patch +Patch0004: environment-modules-module-switch-mod-modvers.patch BuildRequires: tcl-devel, libX11-devel BuildRequires: dejagnu, sed, procps, hostname, man, less @@ -192,6 +193,9 @@ fi %changelog +* Mon Apr 24 2023 Lukáš Zaoral - 4.5.2-4 +- Fix `module switch mod mod/vers` module loading (#2189252) + * Wed Sep 21 2022 Lukáš Zaoral - 4.5.2-3 - Fix profile.sh login shell misdetection (#1815047)