Skip to content

Fix MANPATH override in modulefiles by preserving system manpath #2095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

Conversation

Amrithasuresh
Copy link
Contributor

This PR resolves issue #2070 by prefixing a colon (:) to MANPATH.

This preserves system default man pages while still including software-specific manpaths. Without this, modules may override and hide manpages such as man bash, especially on Rocky Linux 9.

@adrianreber
Copy link
Member

Thanks. Have you thought about handling this directly in lmod? Instead of changing every module file, maybe it would make sense to talk to the lmod maintainers if this could be done directly in lmod?

Copy link

Test Results

0 files   - 27  0 suites   - 27   0s ⏱️ -38s
0 tests  - 53  0 ✅  - 49  0 💤  - 4  0 ❌ ±0 
0 runs   - 99  0 ✅  - 93  0 💤  - 6  0 ❌ ±0 

Results for commit f39913b. ± Comparison against base commit 82a24c4.

@Amrithasuresh
Copy link
Contributor Author

Thank you. Will reach out to the lmod.

@adrianreber
Copy link
Member

@Amrithasuresh Looking at the comments in the lmod ticket it seems it could be fixed with a couple of lines in our scripts in /etc/profile.d. Do you want to open a PR to add the missing lines?

@Amrithasuresh
Copy link
Contributor Author

Amrithasuresh commented Apr 8, 2025

@adrianreber Sure. Thanks.

Is it the change here? I will add a line here ohpc/components/admin/lmod/SPECS/lmod.spec

if [ \$EUID -eq 0 ]; then
    export MODULEPATH=%{OHPC_ADMIN}/modulefiles:%{OHPC_MODULES}
else
    export MODULEPATH=%{OHPC_MODULES}
fi

export MANPATH="\${MANPATH:-}:"

export BASH_ENV=%{OHPC_ADMIN}/lmod/lmod/init/bash

@adrianreber
Copy link
Member

You should also handle it in the .csh script. I never used csh myself, so not sure how it would look there.

I am not 100% convinced that export MANPATH="\${MANPATH:-}:" is correct. If run multiple times it will add lot's of : to the MANPATH.

@Amrithasuresh
Copy link
Contributor Author

Thank you for the comment. How about this change here ohpc/components/admin/lmod/SPECS/lmod.spec

bash shell block

if [ \$EUID -eq 0 ]; then
    export MODULEPATH=%{OHPC_ADMIN}/modulefiles:%{OHPC_MODULES}
else
    export MODULEPATH=%{OHPC_MODULES}
fi

if [ -n "\$MANPATH" ]; then
    export MANPATH="\$MANPATH:"
else
    export MANPATH=":"
fi

export BASH_ENV=%{OHPC_ADMIN}/lmod/lmod/init/bash

C shell block

if ( \`id -u\` == "0" ) then
   setenv MODULEPATH "%{OHPC_ADMIN}/modulefiles:%{OHPC_MODULES}"
else
   setenv MODULEPATH "%{OHPC_MODULES}"
endif

if ( $?MANPATH ) then
    setenv MANPATH "${MANPATH}:"
else
    setenv MANPATH=":"
endif

# Initialize modules system
source %{OHPC_ADMIN}/lmod/lmod/init/csh >/dev/null

@adrianreber
Copy link
Member

Not sure if I understand the problem correctly, but looking at the lmod source code it seems to use slightly different code at:

Why are you doing it differently?

@Amrithasuresh
Copy link
Contributor Author

Amrithasuresh commented Apr 11, 2025

I am still learning how to contribute to open source projects, and this is one of my first PRs to OpenHPC. I really appreciate your patience while I am getting familiar with the process. Please check. I will see whether the test is successful or not. If not I will modify accordingly.

Thank you for your time and support.

@adrianreber
Copy link
Member

I am still learning how to contribute to open source projects, and this is one of my first PRs to OpenHPC. I really appreciate your patience while I am getting familiar with the process. Please check. I will see whether the test is successful or not. If not I will modify accordingly.

Thank you for your time and support.

Sure, no problem.

@adrianreber
Copy link
Member

See #2105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants