Bug 2123487

Summary: Warning message in login if MODULEPATH environment variable is not set
Product: Red Hat Enterprise Linux 8 Reporter: Paulo Andrade <pandrade>
Component: scl-utilsAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: NEW --- QA Contact: Lukáš Zachar <lzachar>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.6CC: ffesti, mcurlej, mdomonko, packaging-team-maint
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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 Paulo Andrade 2022-09-01 19:26:05 UTC
This might happen if for some reason the link /etc/profile.d/modules.sh
is missing or some other problem with alternatives.

/etc/profile.d/scl-init.sh has:

if [ "${MODULEPATH:-}" = "" ]; then
   MODULEPATH=`sed -n 's/[   #].*$//; /./H; $ { x; s/^\n//; s/\n/:/g; p; }' ${MODULESHOME}/init/.modulespath`
fi

but there is no /usr/share/Modules/.modulespath file, that should be now
legacy.

Maybe /etc/profile.d/scl-init.sh should check if that file exist before the
sed command, or, maybe better print a warning telling MODULEPATH is not
defined.

In either case, this is a way to detect problems with alternatives and
missing environment-modules initialization.

This should be a minimal issue, just that some message should still be
printed, but better if not a sed error message about a missing file, like:

sed: can't read /usr/share/Modules/init/.modulespath: No such file or directory

for every shell login.