I think we need to verify a few things (to make sure we aren't making any incorrect assumptions).
And, I am not trying to insult your inteligence, but these questions have to be re-asked (even if it seems they were answered) just to make sure.
Are you really testing with bash (or is it a bash-like shell - like ksh)?
It is possible (if someone else set up the machine, or by some configuration error) that the bash command actually starts a compatible shell.
What do you get when you run:
bash --version
Can you tell us the OS distribution version of modules (what is the exact name of the package used to install it)?
Also, can you determine what version of tcl the module command is compiled with (run ldd against the binary) - it might not be the same as the version used by tclsh.
What happens if you source the files directly from your shell (do you get any errors, if you do that is probably the issue). One error that would cause a problem is if one of the files being sourced was not readable by you (causing an error that would terminate the eval).
Does the shell you are testing with, support the source command (bash should, but others might not).
It could be the puts command is getting a command not found, and failing the entire "eval"
Also, the sourced files are likely BASH specific, they may be causing an error when they are sourced by the shell you are testing with (or they may have errors in the files), thereby causing the whole eval to fail.
It could also be that you need to add a \n to the puts command (at the start of the string, the module puts may be before it and could be missing the last newline). Or it may need one at the end (perhaps due to the tcl compile options of the module binary).
It would actually be helpful to use "module display" (with the test shell) so you can see what the module is sending to the shell through eval.
And, once you get it working, you should consider updating to the latest release of modules (for one, it is no longer a binary - but rather a tclsh script). The 3.2.10* versions that come with many Linux Distributions (including openSUSE which I mainly use) - is really old and basically unsupported.
On 1/31/2023 1:10 PM, Hernan Cervantes wrote:
> When I comment out the lines with "puts stdout", the variable GMXBIN is set
> correctly. I do not know why. The files being sourced do not use or modify
> that variable.
>
> Now a message, "puts stderr", is shown to the user source manually.
>
>
>
>
> On Fri, Jan 27, 2023 at 6:41 PM Jesse Lucas via Modules-interest <
> mod...@li...> wrote:
>
>> I can't reproduce the problem using your provided modulefile.
>>
>> Perhaps try...
>>
>> modulecmd sh load modelagem/example
>>
>> ...to see what commands are actually being sourced by the shell and in
>> what order.
>>
>> Nothing in your bash setup's $PROMPT_COMMAND that would be unsetting
>> $GMXBIN?
>>
>> What version of Environment Modules are you using?
>>
>> -J
>>
>>
>> On Fri, Jan 27, 2023 at 3:29 PM Hernan Cervantes <her...@gm...>
>> wrote:
>>
>>> Hi there,
>>>
>>> I'm a new user, I have written some modulefile, but one environment variable is not being set in any way!
>>>
>>> the environment-module version is 3.2.10
>>>
>>> TCL_VERSION="8.5"
>>> TCL_PATCH_LEVEL="8.5.13"
>>>
>>> installed in a CentOS 7.9 computer.
>>>
>>> the modulefile content is:
>>> ==============
>>> #%Module 1.0
>>>
>>> set modulefilename "GROMACS"
>>> set modulefilever "5.1.5"
>>>
>>> # On load print component name and version being loaded
>>> if { [ module-info mode load ] } {
>>> puts stderr "Loading modeling program $modulefilename version $modulefilever"
>>> }
>>>
>>> # On `module unload` print component module and version being removed
>>> if { [ module-info mode ] == "unload" || [module-info mode ] == "remove" } {
>>> puts stderr "Removing $modulefilename version $modulefilever"
>>> }
>>>
>>> module-whatis "module whatis"
>>>
>>> ##########################################################
>>> # This is the real configuration part. We save the Gromacs
>>> # things in separate vars, so we can remove them later.
>>> # If you move gromacs, change the first line.
>>> ##########################################################
>>> set GMXPREFIX /opt/softwares/gromacs-5.1.5
>>> setenv GMXPREFIX $GMXPREFIX
>>>
>>> set GMXBIN $GMXPREFIX/bin
>>> setenv GMXBIN $GMXBIN
>>> setenv GMXBIN $GMXBIN
>>>
>>> set GMXLDLIB $GMXPREFIX/lib64
>>> setenv GMXLDLIB $GMXLDLIB
>>>
>>> set GMXMAN $GMXPREFIX/share/man
>>> setenv GMXMAN $GMXMAN
>>>
>>> set GMXDATA $GMXPREFIX/share/gromacs
>>> setenv GMXDATA $GMXDATA
>>>
>>> set GROMACS_DIR $GMXPREFIX
>>> setenv GROMACS_DIR $GROMACS_DIR
>>>
>>> prepend-path LD_LIBRARY_PATH $GMXLDLIB
>>> prepend-path PKG_CONFIG_PATH $GMXLDLIB/pkgconfig
>>> prepend-path PATH $GMXBIN
>>> prepend-path MANPATH $GMXMAN
>>>
>>> puts stderr "GMXBIN = $GMXBIN"
>>> if { [ file exist $GMXBIN/gmx-completion.bash ] } {
>>> puts stdout "source $GMXBIN/gmx-completion.bash"
>>> }
>>>
>>> set namepat $GMXBIN/gmx-completion-*.bash
>>> foreach cfile [ glob $namepat ] {
>>> puts stdout "source $cfile"
>>> }
>>>
>>> setenv GMXBIN $GMXBIN
>>> setenv GMXBIN $GMXBIN
>>> setenv GMXBIN $GMXBIN
>>> setenv GMXBIN $GMXBIN
>>> setenv GMXBIN $GMXBIN
>>> setenv GMXBIN $GMXBIN
>>> setenv GMXBIN $GMXBIN
>>> ===============
>>>
>>> the session transcription, in a bash shell, is:
>>> ======================
>>> [teste02@gfmm01 ~]$ echo $GMXBIN
>>>
>>> [teste02@gfmm01 ~]$ module load modelagem/example
>>> Loading modeling program GROMACS version 5.1.5
>>> GMXBIN = /opt/softwares/gromacs-5.1.5/bin
>>> [teste02@gfmm01 ~]$ echo $GMXBIN
>>>
>>> =====================
>>>
>>> What am I doing wrong?
>>>
>>> Thanks in advance.
>>>
>>> Hernán Cervantes
>>>
>>> _______________________________________________
>>> 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
>>
>
>
>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
>
--
--------------------------------------------------------
The views and opinions expressed above are strictly
those of the author(s). The content of this message has
not been reviewed nor approved by any entity whatsoever.
--------------------------------------------------------
Paul FM Info: http://paulfm.com/~paulfm/
--------------------------------------------------------
|