Bug 1079341

Summary: createmodule scripts incorrectly handles env vars prefixed/suffixed without colon
Product: [Fedora] Fedora Reporter: Michal Trunecka <mtruneck>
Component: environment-modulesAssignee: Orion Poplawski <orion>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: 20CC: ebenes, jsynacek, orion
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: environment-modules-3.2.10-14.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1180139 (view as bug list) Environment:
Last Closed: 2015-03-13 17:13:26 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:

Description Michal Trunecka 2014-03-21 12:50:23 UTC
Description of problem:

createmodule scripts incorrectly handle the variables which old value is prefixed/suffixed with other than colon delimiter in the new env. It could cause problems when updating paths in environment:

# export TESTVAR2=origvalue
# export TESTVAR3=origvalue
# export TESTVAR8=origvalue
# export TESTVAR9=origvalue

# cat testscript.sh
export TESTVAR2=origvalue/suffix
export TESTVAR3=prefix/origvalue
### The following is not so crucial, but still:
export TESTVAR8=prefix/origvalue:
export TESTVAR9=prefix:origvalue:

# /usr/share/Modules/bin/createmodule.sh testscript.sh | tee mymodule
#%Module 1.0
append-path	TESTVAR2	origvalue/suffix
prepend-path	TESTVAR3	prefix/origvalue
prepend-path	TESTVAR8	prefix/
prepend-path	TESTVAR9	prefix:

# module load ./mymodule
# env | grep TESTVAR
TESTVAR3=prefix/origvalue:origvalue
TESTVAR2=origvalue:origvalue/suffix
TESTVAR8=prefix/:origvalue
TESTVAR9=prefix::origvalue



And then the same scenario using the Python script:

In the module:
append-path 	TESTVAR2 		/suffix
prepend-path 	TESTVAR3 		prefix
prepend-path 	TESTVAR8 		prefix
append-path 	TESTVAR8 		.
prepend-path 	TESTVAR8 		prefix
append-path 	TESTVAR8 		.
prepend-path 	TESTVAR9 		prefix
append-path 	TESTVAR9 		.
prepend-path 	TESTVAR9 		prefix
append-path 	TESTVAR9 		.


Expected:
TESTVAR2=origvalue/suffix
TESTVAR3=prefix/origvalue
TESTVAR8=prefix/origvalue:
TESTVAR9=prefix:origvalue:

Given:
TESTVAR2=origvalue:/suffix
TESTVAR3=prefix:origvalue
TESTVAR8=prefix:origvalue:.
TESTVAR9=prefix:origvalue:.



Version-Release number of selected component (if applicable):
environment-modules-3.2.10-8.fc21.x86_64
(applies for all 3.2.10-* )



Expected results:
Either implement better logic to handle these or mark prefixed/suffixed variables without colon as unhandled

Comment 1 Orion Poplawski 2014-03-21 22:46:36 UTC
Hmm, I wonder what bug 976369 is.  Nice to know that these scripts are actually used (or at least attempted to be used).  I'll try to take a look.

Comment 2 Jan Synacek 2014-03-24 11:58:33 UTC
The bug 976369 is a rebase request for environment-modules in RHEL-6. Part of the request was also to add the createmodule* helper scripts. So yes, your scripts are actually in demand:)

Comment 4 Fedora Update System 2015-03-02 20:13:06 UTC
environment-modules-3.2.10-14.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/environment-modules-3.2.10-14.fc20

Comment 5 Fedora Update System 2015-03-04 10:22:50 UTC
Package environment-modules-3.2.10-14.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing environment-modules-3.2.10-14.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-2982/environment-modules-3.2.10-14.fc20
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2015-03-13 17:13:26 UTC
environment-modules-3.2.10-14.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.