Skip to content
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

Update to make sure that Local jobs run in fresh environment #2338

Merged
merged 4 commits into from
May 16, 2024

Conversation

egede
Copy link
Member

@egede egede commented May 13, 2024

No description provided.

mesmith75
mesmith75 previously approved these changes May 13, 2024
Copy link
Contributor

@mesmith75 mesmith75 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only hesitation is some of the odd function stuff you get in el9. For example:

BASH_FUNC_ml%%=() {  module ml "$@"
}
BASH_FUNC_which%%=() {  ( alias;
 eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@
}
BASH_FUNC_module%%=() {  local _mlredir=1;
 if [ -n "${MODULES_REDIRECT_OUTPUT+x}" ]; then
 if [ "$MODULES_REDIRECT_OUTPUT" = '0' ]; then
 _mlredir=0;
 else
 if [ "$MODULES_REDIRECT_OUTPUT" = '1' ]; then
 _mlredir=1;
 fi;
 fi;
 fi;
 case " $@ " in 
 *' --no-redirect '*)
 _mlredir=0
 ;;
 *' --redirect '*)
 _mlredir=1
 ;;
 esac;
 if [ $_mlredir -eq 0 ]; then
 _module_raw "$@";
 else
 _module_raw "$@" 2>&1;
 fi
}
BASH_FUNC_scl%%=() {  if [ "$1" = "load" -o "$1" = "unload" ]; then
 eval "module $@";
 else
 /usr/bin/scl "$@";
 fi
}
BASH_FUNC__module_raw%%=() {  eval "$(/usr/bin/tclsh '/usr/share/Modules/libexec/modulecmd.tcl' bash "$@")";
 _mlstatus=$?;
 return $_mlstatus
}
_=/usr/bin/printenv

is this taken care of appropriately?

@egede
Copy link
Member Author

egede commented May 14, 2024

Thanks @mesmith75 . Indeed functions were not dealt with correctly. And also while the login was run again, the environment was in fact not cleaned. Update should protect against both of these cases. A test is added as well.

@egede egede requested a review from mesmith75 May 14, 2024 01:01
@mesmith75
Copy link
Contributor

I think this looks good. In general though I am not a big fan of these gymnastics we do with converting environments to dicts etc. Python has an environ object which should deal with this kind of thing seamlessly, although I think it would be a considerable effort to rework everything.

@egede egede merged commit 6ac6327 into develop May 16, 2024
10 checks passed
@egede egede deleted the LocalEnvFix branch May 16, 2024 23:00
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