Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1233223

Summary: createmodule scripts incorrectly handles env vars prefixed/suffixed without colon
Product: Red Hat Enterprise Linux 7 Reporter: Karel Srot <ksrot>
Component: environment-modulesAssignee: Jan Synacek <jsynacek>
Status: CLOSED ERRATA QA Contact: Stefan Kremen <skremen>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: skremen
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Helper scripts shipped with environment-modules incorrectly handled environmental variables that were prefixed or suffixed with other delimiter than a colon. Consequence: Generated modules contained environment variables with incorrect values. Fix: Logic of the helper scripts was enhanced. Result: Modules are now generated with correct environment variables.
Story Points: ---
Clone Of: 1180139 Environment:
Last Closed: 2015-11-19 04:39: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:
Bug Depends On:    
Bug Blocks: 1180139    

Description Karel Srot 2015-06-18 13:23:44 UTC
Seems to be present in RHEL-7 too, environment-modules-3.2.10-8.el7

+++ This bug was initially created as a clone of Bug #1180139 +++

RHEL6 clone of bug 1079341
Tested with environment-modules-3.2.10-2.el6

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 6 errata-xmlrpc 2015-11-19 04:39:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2193.html