DAOS-18905 build: fix in_list PATH check due to missing word-split#18482
Open
knard38 wants to merge 2 commits into
Open
DAOS-18905 build: fix in_list PATH check due to missing word-split#18482knard38 wants to merge 2 commits into
knard38 wants to merge 2 commits into
Conversation
$old_path and $added were quoted when passed to in_list, causing the entire space-separated string to be treated as a single argument. As a result in_list never found a match and $SL_PREFIX/bin was always prepended to PATH, even when already present. Remove the quotes so the shell word-splits the list into individual arguments, and suppress the SC2086 shellcheck warning at each call site. Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
|
Ticket title is ' |
After fixing the in_list callers to pass word-split lists, the helper can again return 1 for the expected found case. Callers that source setup_local.sh under set -e then abort before the following status check. Use in_list directly in if conditions so the expected found/not-found statuses do not trip set -e. Signed-off-by: Cedric Koch-Hofer <cedric.koch-hofer@hpe.com>
daltonbohning
approved these changes
Jun 10, 2026
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.
Description
This PR fixes two related issues in
utils/sl/setup_local.sh.Commit 1 — word-split bug (
d51c4d1027)setup_local.shuses thein_listhelper to avoid prepending$SL_PREFIX/bintoPATHwhen it is already present. The guard was broken because$old_path(and$added) were quoted when passed toin_list, so the entire colon-to-space-converted PATH string was passed as a single argument instead of being word-split into individual directories. As a resultin_listnever found a match and$SL_PREFIX/binwas unconditionally prepended every timesetup_local.shwas sourced — even in the same shell session.The same quoting mistake affected both the per-prefix loop (
${added},${old_path}) and the finalSL_PREFIX/bincheck (${old_path}).Commit 2 — latent
set -ehazard (16925e48ce)Once the word-split fix is in place,
in_listcorrectly returns1for the "found" case. However,in_listwas called as a standalone statement with its exit code checked afterward via$?. Scripts that sourcesetup_local.shunderset -e(e.g.utils/rpms/build_packages.sh) abort immediately on that non-zero return before the$?check runs.This was a latent design flaw independent of the quoting bug:
in_listshould always be called inside anifcondition, not as a standalone statement with$?checked afterward. It surfaced here because fixing the quoting madein_listactually return1for the first time, triggering the abort in callers likeutils/rpms/build_packages.sh— which is why the initial CI run on this PR showed build failures. The two commits are kept separate intentionally: the second independently documents theset -ehazard so it is findable ingit logon its own. No explicit validation is needed — the CI passing on the second run is sufficient evidence.Validation
Both steps below must be run from the repo root (where
.build_vars.shlives after a successful build), assetup_local.shlooks for that file relative to$PWD.1. Without the fix — check out the base branch before this patch (commit
05984ffd13):2. With the fix — check out the tip of this branch (commit
16925e48ce):Without the fix the install entry count grows by one on every source. With the fix it stays constant.
Steps for the author:
After all prior steps are complete: