Hello Laurent,
Root name is set as "[lindex [file split $modname] 0]", so it is the
word before the first / character.
I will clarify that in the module switch documentation.
Best,
Xavier
Le mer. 19 nov. 2025 à 02:39, Laurent BESSON
<lau...@ea...> a écrit :
>
> Maybe documentation could be more clear on what is actually a « root name ».
>
>
>
> From my initial understanding, when I source the following lines :
>
>
>
> module switch others/texlive/2022
>
> module switch others/nodejs/16.17.1
>
>
>
> I was expexting the root name of these two modules to be respectively :
>
>
>
> others/texlive
>
> others/nodejs
>
>
>
> So the second « module switch others/nodejs/16.17.1» command was not supposed to « unload » the first module « others/texlive/2022 » as they do not share the same « root name »
>
>
>
> Apparently, I’m wrong. What is the real algorithm to define the « root name » of a module ?
>
>
>
> Best regards,
>
> Laurent.
>
>
>
> De : Xavier Delaruelle <xav...@gm...>
> Envoyé : mardi 18 novembre 2025 17:28
> À : Environment Modules usage and discussion. <mod...@li...>
> Objet : Re: [Modules] unload/load versus switch
>
>
>
> Hello Laurent
>
>
>
> This is due to the fact that your modules share same apps or others root name.
>
>
>
> If you enable the new conflict_unload option you may simply module loaded the target module.
>
>
>
> Cheers,
>
> Xavier
>
>
>
> Le mar. 18 nov. 2025, 10:16, Laurent BESSON <lau...@ea...> a écrit :
>
> Hello dear Modules community,
>
>
>
> Naively, I thought « module switch » would be a nice , more compact, way of writing « module unload / module load ». But either I stumbled on a bug or Modules does not work as I expected 😊
>
>
>
> Here is the context. I was previously sourcing this script :
>
>
>
> module unload others/texlive
>
> module load others/texlive
>
>
>
> module unload apps/python
>
> module load apps/python/3.9.6
>
>
>
> module unload apps/fltExport
>
> module load apps/fltExport/v2.017
>
>
>
> module unload others/nodejs
>
> module load others/nodejs/16.17 .1
>
>
>
> So I thought it would be nice, more readable, to write it this way :
>
>
>
> module switch others/texlive/2022
>
> module switch apps/python/3.9.6
>
> module switch apps/fltExport/v2.017
>
> module switch others/nodejs/16.17.1
>
>
>
> But, when starting from a fresh terminal where no tool has been set, It ends up with these 2 modules only:
>
>
>
> … 1) apps/fltExport/v2.017 2) others/nodejs/16.17.1
>
>
>
> I was expecting to have loaded also « others/texlive » and « apps/python/3.9.6 ».
>
>
>
> So I read the documentation with more attention on the « switch » command. It says :
>
>
>
> Switch loaded modulefile1 with modulefile2. If modulefile1 is not specified, then it is assumed to be the currently loaded module with the same root name as modulefile2.
>
>
>
> So it seems that when I run « module switch apps/fltExport/v2.017 », it unload the first module that match the « root name »and it unloads« apps » thus unload « apps/python/3.9.6 »
>
>
>
> Do I understand it correctly ? Is it the expected behavior ?
>
> In fact, I thought Modules would try to unload « apps/fltExport/<any version> » when running « module switch apps/fltExport/v2.017 ».
>
>
>
> What do you think ?
>
>
>
> Best regards,
>
> Laurent.
>
>
>
> PS : I found an intermediate syntax that works :
>
>
>
> module switch others/texlive others/texlive/2022
>
> module switch apps/python apps/python/3.9.6
>
> module switch apps/fltExport apps/fltExport/v2.017
>
> module switch others/nodejs others/nodejs/16.17.1
>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
|