- 
                Notifications
    You must be signed in to change notification settings 
- 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?
Changes from all commits
d7c62c3
              ff7192f
              e09c480
              b87ff12
              627be08
              8ebad08
              a8382c7
              5f2c89b
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -210,6 +210,22 @@ if os.getenv("EESSI_MODULE_STICKY") then | |
| load_message = load_message .. " (requires '--force' option to unload or purge)" | ||
| end | ||
|  | ||
| -- 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 "") | ||
| -- on unload the variable will no longer exist | ||
| if mode() == "load" then | ||
| -- 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") | ||
| 
      Comment on lines
    
      +218
     to 
      +224
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused, didn't you intend to remove from  There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. We make a copy of  | ||
| end | ||
| -- now we can use pushenv to retain/restore the original value | ||
| pushenv ("LD_LIBRARY_PATH", os.getenv("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH") or "") | ||
|  | ||
| if mode() == "load" then | ||
| LmodMessage(load_message) | ||
| end | ||
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 startEESSI_DEFAULT_HOST_LD_LIBRARY_PATH=/fooandLD_LIBRARY_PATH=/bar. I think what you want is that after unloadingLD_LIBRARY_PATH=/bar, but with the current setup, it would beLD_LIBRARY_PATH=/foo:/barno?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_pathwhen 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:
LD_LIBRARY_PATHpushenvto setLD_LIBRARY_PATHto the sanitized value.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?
Uh oh!
There was an error while loading. Please reload this page.
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 benil)