From d51c4d1027dbb743734f5feb4380d67ca762a8cb Mon Sep 17 00:00:00 2001 From: Cedric Koch-Hofer Date: Wed, 10 Jun 2026 08:13:55 +0000 Subject: [PATCH 1/2] DAOS-18905 build: fix in_list PATH check due to missing word-split $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 --- utils/sl/setup_local.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/sl/setup_local.sh b/utils/sl/setup_local.sh index 5e0099ec397..2b972b1b6b2 100644 --- a/utils/sl/setup_local.sh +++ b/utils/sl/setup_local.sh @@ -1,6 +1,7 @@ #!/bin/bash # /* # * (C) Copyright 2016-2023 Intel Corporation. +# * (C) Copyright 2026 Hewlett Packard Enterprise Development LP # * (C) Copyright 2025 Google LLC # * # * SPDX-License-Identifier: BSD-2-Clause-Patent @@ -87,13 +88,15 @@ added="/ /usr /usr/local" old_path="${PATH//:/ }" echo OLD_PATH is "${old_path}" for item in $list; do - in_list "${!item}" "${added}" + # shellcheck disable=SC2086 + in_list "${!item}" ${added} if [ $? -eq 1 ]; then continue fi export "${item?}" added+=" ${!item}" - in_list "${!item}/bin" "${old_path}" + # shellcheck disable=SC2086 + in_list "${!item}/bin" ${old_path} if [ $? -eq 1 ]; then continue fi @@ -102,7 +105,8 @@ for item in $list; do fi done -in_list "${SL_PREFIX}/bin" "${old_path}" +# shellcheck disable=SC2086 +in_list "${SL_PREFIX}/bin" ${old_path} # shellcheck disable=SC2181 if [ $? -eq 0 ]; then PATH=$SL_PREFIX/bin:$PATH From 16925e48ce59ed1e9ed59ecc3c57139fe2d3654c Mon Sep 17 00:00:00 2001 From: Cedric Koch-Hofer Date: Wed, 10 Jun 2026 09:21:56 +0000 Subject: [PATCH 2/2] DAOS-18905 build: make setup_local in_list checks set -e safe 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 --- utils/sl/setup_local.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/utils/sl/setup_local.sh b/utils/sl/setup_local.sh index 2b972b1b6b2..25b19a89483 100644 --- a/utils/sl/setup_local.sh +++ b/utils/sl/setup_local.sh @@ -89,15 +89,13 @@ old_path="${PATH//:/ }" echo OLD_PATH is "${old_path}" for item in $list; do # shellcheck disable=SC2086 - in_list "${!item}" ${added} - if [ $? -eq 1 ]; then + if ! in_list "${!item}" ${added}; then continue fi export "${item?}" added+=" ${!item}" # shellcheck disable=SC2086 - in_list "${!item}/bin" ${old_path} - if [ $? -eq 1 ]; then + if ! in_list "${!item}/bin" ${old_path}; then continue fi if [ -d "${!item}/bin" ]; then @@ -106,9 +104,7 @@ for item in $list; do done # shellcheck disable=SC2086 -in_list "${SL_PREFIX}/bin" ${old_path} -# shellcheck disable=SC2181 -if [ $? -eq 0 ]; then +if in_list "${SL_PREFIX}/bin" ${old_path}; then PATH=$SL_PREFIX/bin:$PATH fi export PATH