TACC / Lmod

Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy
http://lmod.readthedocs.org
Other
499 stars 128 forks source link

Incorrect path set when using profile.fish #682

Closed andreichalapco closed 10 months ago

andreichalapco commented 11 months ago

To give a bit of a context. When installing lmod with dnf package manager on fedora and start using the bash shell echoing $MODULEPATH yields

/usr/share/modulefiles/ ... 

(which is the right path for finding some modules).

After ln -s of .../profile.fish in the fish config file... I only get for echo $MODULEPATH:

/usr/share/modulefiles/Linux /usr/share/modulefiles/Core /usr/share/lmod/lmod/modulefiles/Core

(Can't find my modules just with this ... )

Desktop (please complete the following information):

rtmclay commented 11 months ago

I do not run fish so you will need to help debug this. I looked at the init/profile.fish.in, which becomes profile.fish when installing. Inside init/profile.fish.in it has:

set -xg MODULEPATH (@PKGV@/libexec/addto --append MODULEPATH $MODULEPATH_ROOT/$LMOD_sys $MODULEPATH_ROOT/Core)
set -xg MODULEPATH (@PKGV@/libexec/addto --append MODULEPATH @PKGV@/modulefiles/Core)

This should just append

  /usr/share/modulefiles/Linux /usr/share/modulefiles/Core /usr/share/lmod/lmod/modulefiles/Core

to the current value of MODULEPATH

Here are some ideas why you are not getting the correct value of MODULEPATH:

  1. the variable MODULEPATH is has a value but is not exported so the "addto" function won't know the "/usr/share/modulefiles" value
  2. The profile.fish file is "sourced" first before wherever MODULEPATH gets the value and that place doesn't modify the value of MODULEPATH if it already has a value.
  3. The fish startup doesn't know anything about the startup files in /etc/profile.d so it doesn't get the system startup value of /usr/share/modulefiles.

I suspect that the last idea is the problem. Lmod has standard locations where it looks for modulefiles. Namely the ones that you see. So you can either modify the /etc/profile.fish file to match your location of /usr/share/modulefiles or create a file /etc/lmod/.modulepath:

/usr/share/modulefiles
andreichalapco commented 11 months ago

What happens if I just change the script to:

set -xg MODULEPATH (@PKGV@/libexec/addto --append MODULEPATH $MODULEPATH_ROOT $MODULEPATH_ROOT/$LMOD_sys $MODULEPATH_ROOT/Core)

This will basically just add the MODULEPATH_ROOT to the module paths ... where the search needs to be conducted

andreichalapco commented 11 months ago

What I also noticed ... that in the /etc/profile.d/ there is the 00-modulepath.sh ... which exports /usr/share/modulefiles. This I think won't be runned when fish shell is sourced

rtmclay commented 11 months ago

Yes, as far as I know, /etc/profile.d/00-modulepath.sh is NOT sourced by fish. It is not written in fish. As for changing profile.fish.in I think that you can set it like this:

set -xg MODULEPATH (@PKGV@/libexec/addto --append MODULEPATH /usr/share/modulepath)
rtmclay commented 10 months ago

O.K. to close this issue?