Bug 1326075

Summary: Lmod packages prevent the correct function of `module use`, upon further bash/csh invocations
Product: [Fedora] Fedora EPEL Reporter: Fotis Georgatos <fotis>
Component: LmodAssignee: Orion Poplawski <orion>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: orion
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Lmod-6.3.4-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-29 20:47:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Set Fedora defaults from Lmod's init scripts none

Description Fotis Georgatos 2016-04-11 18:09:43 UTC
Description of problem:
Lmod packages prevent the correct function of `module use`, upon further bash invocations
due to this being hardwired in the .spec:
```
echo 'export MODULEPATH=%{_sysconfdir}/modulefiles:%{_datadir}/modulefiles:%{_datadir}/Modules/modulefiles' > %{buildroot}%{_sysconfdir}/profile.d/00-modulepath.sh
echo 'setenv MODULEPATH %{_sysconfdir}/modulefiles:%{_datadir}/modulefiles:%{_datadir}/Modules/modulefiles' > %{buildroot}%{_sysconfdir}/profile.d/00-modulepath.csh
```

Version-Release number of selected component (if applicable):
6.x.y (all)

How reproducible:
always. 

Steps to Reproduce:

just try:
$ echo $MODULEPATH
$ module use $HOME/privatemodules
$ bash
$ echo $MODULEPATH ## it gets reset in a very unwanted way, because of `bash`


Actual results:
Two same $MODULEPATH outputs

Expected results:
$MODULEPATH gets reset

Additional info:

Comment 1 Fotis Georgatos 2016-04-11 18:10:29 UTC
fyi.
the solution to this could be to use a guard variable, similar to what is described here:
http://lmod.readthedocs.org/en/latest/045_transition.html#an-example-of-how-this-can-be-done-in-your-bash-startup-scripts

ie. once somebody has defined MODULEPATH already, do not touch it anymore.

Comment 2 Diego Menéndez 2016-04-25 15:12:50 UTC
Created attachment 1150532 [details]
Set Fedora defaults from Lmod's init scripts

The attached patch sets Fedora default values for MODULEPATH from within Lmod's init/profile and init/cshrc startup files, linked from /etc/profile.d/z00_lmod.sh and /etc/profile.d/z00_lmod.csh respectively.

Lmod is designed to set those values only during the user's first login shell (using MODULEPATH_ROOT as a flag) to keep MODULEPATH's current value through subshells.

/etc/00-modulepath.sh and /etc/00-modulepath.csh should be eliminated because they reset MODULEPATH.

Comment 3 Orion Poplawski 2016-04-25 17:39:29 UTC
We need 00-modulepath to sync the initial MODULEPATH between environment-modules and Lmod, but you are correct that it shouldn't reset it.  I think I've go a fix.

Comment 4 Fedora Update System 2016-04-25 17:54:46 UTC
Lmod-6.3.1-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-81e9d1896a

Comment 5 Fedora Update System 2016-04-26 00:19:34 UTC
Lmod-6.3.1-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-81e9d1896a

Comment 6 Fedora Update System 2016-04-26 16:18:18 UTC
Lmod-6.3.1-2.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-81e9d1896a

Comment 7 Fedora Update System 2016-04-27 00:51:35 UTC
Lmod-6.3.1-2.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-81e9d1896a

Comment 8 Fedora Update System 2016-04-27 02:42:44 UTC
Lmod-6.3.1-3.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-81e9d1896a

Comment 9 Fedora Update System 2016-04-28 02:25:04 UTC
Lmod-6.3.1-3.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-81e9d1896a

Comment 10 Fedora Update System 2016-05-12 22:58:48 UTC
Lmod-6.3.4-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-60ef85e569

Comment 11 Fedora Update System 2016-05-15 06:22:14 UTC
Lmod-6.3.4-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-60ef85e569

Comment 12 Fedora Update System 2016-05-29 20:47:19 UTC
Lmod-6.3.4-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.