Thanks Martin for this observation.
I will move this code from these shell init scripts into the modulecmd.tcl
autoinit process, so it will be more easy to avoid duplicate entries and to
output environment variable changes with special character correctly
escaped.
I have made an issue to work on this for next release [1].
Regards,
Xavier
[1] https://github.com/cea-hpc/modules/issues/462
Le jeu. 2 juin 2022 à 11:33, Bloecker, Martin <
Mar...@am...> a écrit :
> All,
>
>
>
> Just another observation: Shouldn’t there also be double quotes in the
> path assignment statement (i.e. line #2) to correctly handle the (probably
> seldom) case that either MODULES_ROOT or PATH do reference directories with
> whitespace in their names?
>
>
>
> Regards,
>
>
>
> Martin B.
>
>
>
> *From:* Xavier Delaruelle <xav...@gm...>
> *Sent:* Donnerstag, 2. Juni 2022 06:43
> *To:* Environment Modules usage and discussion. <
> mod...@li...>
> *Subject:* Re: [Modules] [**EXTERNAL**] Re: PATH grows by @bindir@ every
> time modules is initialized
>
>
>
> *[---EXTERNAL---] *
>
>
>
> This PATH initialization code does not expect a variable reference in the
> @bindir@ value. It should be ok for the bash initialization script to
> change that to double quote on your setup. I am not sure that this will
> work properly for the other kind of shell initialization script (tcsh,
> fish, etc).
>
>
>
> Regards,
>
> Xavier
>
>
>
> Le mer. 1 juin 2022 à 23:02, D'Anjou, Martin via Modules-interest <
> mod...@li...> a écrit :
>
> In my case, the pattern is expanded to:
>
>
>
> if [[ ! ":$PATH:" =~ ':${MODULES_ROOT}/modules-tcl/bin:' ]]; then
>
> PATH=${MODULES_ROOT}/modules-tcl/bin${PATH:+:}$PATH; export PATH
>
> fi
>
>
>
> And the single quote around the right-hand-side operand of the =~ operator
> explains why the condition does not work in my case.
>
>
>
> So my only question is with regards to the quoting of the right-hand-side
> operand. According to the git log, it has always been with single quotes.
> when I change it to double quotes, it runs as intended (and the PATH does
> not grow). This is an installation I inherited.
>
>
>
> Should it be double-quotes instead of single-quote?
>
> What do you think?
>
>
>
> Martin
> ------------------------------
>
> *From:* Xavier Delaruelle <xav...@gm...>
> *Sent:* Wednesday, June 1, 2022 1:41 PM
> *To:* Environment Modules usage and discussion. <
> mod...@li...>
> *Subject:* [**EXTERNAL**] Re: [Modules] PATH grows by @bindir@ every time
> modules is initialized
>
>
>
> Hi Martin,
>
>
>
> When installing Modules the @bindir@ pattern is replaced by the
> configured location for Modules utilities. In the bash initialization
> script produced (init/bash generated from init/bash.in [bash.in]
> <https://urldefense.com/v3/__http:/bash.in__;!!OSsGDw!OvzT2vTXisLJ436Wx1FPwnuBOMHznXuPozQ-POhdMnjwQL_BDh7AeJ7zrdMlrnn404RHCUrwqpMRP2d8W71SQG0p$>)
> this bin location is then added to the PATH.
>
>
>
> The code you spot is made to avoid adding this bin location if it is
> already defined in the PATH.
>
>
>
> Could you please describe how Modules is built and installed on your side
> and how it is initialized and what value of PATH you obtain after this
> initialization.
>
>
>
> Regards,
>
> Xavier
>
>
>
> Le mer. 1 juin 2022 à 16:58, Martin d'Anjou <mar...@gm...> a
> écrit :
>
> Hi,
>
>
>
> My PATH keeps growing with the same value of @bindir@ over and over when
> modules is repeatedly initialized, and I suspect that the code below is the
> reason. So inside modules-tcl/init/bash.in [bash.in]
> <https://urldefense.com/v3/__http:/bash.in__;!!OSsGDw!OvzT2vTXisLJ436Wx1FPwnuBOMHznXuPozQ-POhdMnjwQL_BDh7AeJ7zrdMlrnn404RHCUrwqpMRP2d8W71SQG0p$>,
> I would like to know the purpose of this code [github.com]
> <https://urldefense.com/v3/__https:/github.com/cea-hpc/modules/blob/c1fd4dc12f591bb877f392d7307151640573d443/init/bash.in*L68-L72__;Iw!!OSsGDw!OvzT2vTXisLJ436Wx1FPwnuBOMHznXuPozQ-POhdMnjwQL_BDh7AeJ7zrdMlrnn404RHCUrwqpMRP2d8W-xC0w3j$>
> :
>
>
> @setbinpath@ if [[ ! ":$PATH:" =~ ':@bindir@:' ]]; then
> @setbinpath@@prependbinpath@ PATH=@bindir@${PATH:+:}$PATH
> @setbinpath@@appendbinpath@ PATH=$PATH${PATH:+:}@bindir@
> @setbinpath@ export PATH
> @setbinpath@ fi
>
>
>
> Thanks,
>
> Martin
>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
> [lists.sourceforge.net]
> <https://urldefense.com/v3/__https:/lists.sourceforge.net/lists/listinfo/modules-interest__;!!OSsGDw!OvzT2vTXisLJ436Wx1FPwnuBOMHznXuPozQ-POhdMnjwQL_BDh7AeJ7zrdMlrnn404RHCUrwqpMRP2d8W2H7zimz$>
>
> _______________________________________________
> 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
>
|