-
Couldn't load subscription status.
- Fork 14
Fix issues for LD_LIBRARY_PATH via EESSI module
#114
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
base: main
Are you sure you want to change the base?
Conversation
|
bot: build repo:eessi.io-2023.06-software instance:eessi-bot-mc-aws for:arch=x86_64/amd/zen2 |
|
New job on instance
|
|
New job on instance
|
|
bot: build repo:eessi.io-2023.06-software instance:eessi-bot-mc-aws for:arch=x86_64/amd/zen2 |
|
New job on instance
|
|
New job on instance
|
LD_LIBRARY_PATH via EESSI moduleLD_LIBRARY_PATH via EESSI module
|
bot: build repo:eessi.io-2023.06-software instance:eessi-bot-mc-aws for:arch=x86_64/amd/zen2 |
|
New job on instance
|
|
New job on instance
|
| -- remove any standard paths that can interfere with the compat layer | ||
| remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/lib") | ||
| remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/lib64") | ||
| remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/lib") | ||
| remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/lib64") | ||
| remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/local/lib") | ||
| remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/local/lib64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, didn't you intend to remove from LD_LIBRARY_PATH here? I.e. now, you are essentially leaving LD_LIBRARY_PATH unsanitized, while you're cleaning EESSI_DEFAULT_HOST_LD_LIBRARY_PATH (which I think you meant to keep as a the original value so you can restore later)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, I see that your test passes, I just don't understand how... I don't think it should pass with the current code...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We make a copy of LD_LIBRARY_PATH, clean it up, and then use push_env to update LD_LIBRARY_PATH. This means after loading the module the LD_LIBRARY_PATH has the sanitised value. On unload, the original value get's restored
|
|
||
| -- Filter system paths from LD_LIBRARY_PATH | ||
| -- Needs to be reversible so first make a copy | ||
| append_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", os.getenv("LD_LIBRARY_PATH") or "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be an append_path? Should't it just overwrite? What if at the start EESSI_DEFAULT_HOST_LD_LIBRARY_PATH=/foo and LD_LIBRARY_PATH=/bar. I think what you want is that after unloading LD_LIBRARY_PATH=/bar, but with the current setup, it would be LD_LIBRARY_PATH=/foo:/bar no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Lmod documentation it explicitly says to use append_path when initialising a path-like variable (which we are doing here), and indeed if you don't it doesn't work properly (I tried).
I think you are not quite following what is happening here:
- We make a copy of the initial value of the original
LD_LIBRARY_PATH - We sanitize the copy
- We use
pushenvto setLD_LIBRARY_PATHto the sanitized value. - Using
pushenvmeans the approach is reversible. If we had worked directly onLD_LIBRARY_PATHunloading would not restore the original environment (the path would remain sanitized)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it help to do more extensive commenting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point about EESSI_DEFAULT_HOST_LD_LIBRARY_PATH, but it is not expected that it exists. Maybe the right way to imply that is by naming it_EESSI_DEFAULT_HOST_LD_LIBRARY_PATH_ and verifying it is not set (os.getenv(_EESSI_DEFAULT_HOST_LD_LIBRARY_PATH_)should be nil)
Compat layer binaries are not rpathed, so if host locations like
/usr/libare inLD_LIBRARY_PATHthings will break. Fix this in theEESSImodule.See https://gitlab.com/eessi/support/-/issues/198 for a lot of context.