Repository navigation
fix(shell): avoid empty and repeated library path entries in env.sh - #397
Draft
Elvand-Lie wants to merge 1 commit into
Draft
Elvand-Lie wants to merge 1 commit into
Elvand-Lie wants to merge 1 commit into
Conversation
Guard library paths before prepending and add a separator only for nonempty values. Exercise the rendered POSIX template with unset, empty and preset library paths. Signed-off-by: Elvand Lie Nababan <elvandlie@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which GitHub issue does this PR close?
Closes #396
Why is this needed?
Sourcing env.sh with an unset or empty library path adds a current directory search entry. Sourcing it again duplicates the WasmEdge library directory.
What does this PR change?
Guard LD_LIBRARY_PATH and DYLD_LIBRARY_PATH with the same containment pattern used for PATH, and add a separator only when the existing value is nonempty.
How has this been tested?
The new test in shell_test sources the rendered script in sh with unset, empty and preset values, once and twice, for Linux and a simulated Darwin branch. It fails on master and passes with the fix. Ubuntu 24.04 installation and loader checks were repeated with the fixed binary. Rust 1.99.1: cargo fmt, Clippy with warnings denied, cargo test (184 passed, 2 ignored), and ShellCheck passed.
Anything else?
The Darwin branch was exercised with a shell uname function on Linux; native macOS was not run.