Skip to content

Fix: Quote path variables in shell scripts to handle space characters in directory paths#642

Open
vknaik wants to merge 2 commits intollm-d:mainfrom
vknaik:fix/paths-with-spaces
Open

Fix: Quote path variables in shell scripts to handle space characters in directory paths#642
vknaik wants to merge 2 commits intollm-d:mainfrom
vknaik:fix/paths-with-spaces

Conversation

@vknaik
Copy link

@vknaik vknaik commented Feb 6, 2026

Fixes #641

Problem:

Scripts fail when run from directories containing spaces in their path due to unquoted variables causing word splitting.

Solution:

  • Quoted all path variables in setup/*.sh scripts (6 files)
  • Quoted all path variables in setup/steps/*.sh scripts (10 files)
  • Quoted path variables in util/setup_precommit.sh
  • Ensure proper handling of directory paths containing spaces

Changes:

  • setup/: e2e.sh, env.sh, functions.sh, run.sh, standup.sh, teardown.sh
  • setup/steps/: All 10 step scripts (00-10)
  • util/: setup_precommit.sh

Testing:

Verified scripts can now run from directories with spaces in the path.

Commits:

  • fix: Quote path variables in shell scripts to handle spaces (setup/*.sh)
  • fix: Quote path variables in setup/steps scripts and util/setup_precommit.sh

- Fixed unquoted path variables causing word splitting in paths with spaces
- Updated standup.sh: quoted pushd, realpath, source, find, and sed expressions
- Updated env.sh: quoted source, find, mkdir, rm, cp, touch, ls commands
- Updated functions.sh: quoted extensive path operations (mkdir, rm, cp, touch, cat, ls, find, rsync)
- Updated run.sh: quoted pushd, realpath, source, find, mkdir, rm, ls commands
- Updated teardown.sh: quoted pushd, realpath, source commands
- Updated e2e.sh: quoted pushd, realpath, source, find, ls commands

Resolves issue where standup.sh and other scripts would fail when run from
directories containing spaces in their path.
…mmit.sh

- Fixed unquoted path variables in all setup/steps/*.sh scripts (00-10)
- Fixed util/setup_precommit.sh path variable quoting
- Ensures proper handling of directory paths containing spaces
- Completes the space-handling fixes across the repository

Related to previous commit fixing setup/*.sh scripts
@namasl
Copy link
Collaborator

namasl commented Feb 6, 2026

This PR contains Bash scripts for the various steps which have been deprecated in favor of Python. Please remove the files under setup/steps/.

@vknaik
Copy link
Author

vknaik commented Feb 6, 2026

@namasl You are correct. I will remove the .sh files under setup/steps/ and resubmit the PR. Thx.

for workload_type in ${LLMDBENCH_HARNESS_PROFILE_HARNESS_LIST}; do
llmdbench_execute_cmd "${LLMDBENCH_CONTROL_KCMD} --namespace ${LLMDBENCH_HARNESS_NAMESPACE} delete configmap $workload_type-profiles --ignore-not-found" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
llmdbench_execute_cmd "${LLMDBENCH_CONTROL_KCMD} --namespace ${LLMDBENCH_HARNESS_NAMESPACE} create configmap $workload_type-profiles --from-file=${LLMDBENCH_CONTROL_WORK_DIR}/workload/profiles/${workload_type}" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
llmdbench_execute_cmd "${LLMDBENCH_CONTROL_KCMD} --namespace ${LLMDBENCH_HARNESS_NAMESPACE} create configmap $workload_type-profiles --from-file=\"${LLMDBENCH_CONTROL_WORK_DIR}/workload/profiles/${workload_type}\"" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not functional, but adding back spacing for clarity

Suggested change
llmdbench_execute_cmd "${LLMDBENCH_CONTROL_KCMD} --namespace ${LLMDBENCH_HARNESS_NAMESPACE} create configmap $workload_type-profiles --from-file=\"${LLMDBENCH_CONTROL_WORK_DIR}/workload/profiles/${workload_type}\"" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
llmdbench_execute_cmd "${LLMDBENCH_CONTROL_KCMD} --namespace ${LLMDBENCH_HARNESS_NAMESPACE} create configmap $workload_type-profiles --from-file=\"${LLMDBENCH_CONTROL_WORK_DIR}/workload/profiles/${workload_type}\"" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}


export LLMDBENCH_RUN_EXPERIMENT_ID_PREFIX=""

for treatment in $(ls ${LLMDBENCH_CONTROL_WORK_DIR}/workload/profiles/${workload_type}/*.yaml); do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...spacing

export LLMDBENCH_HARNESS_EXPERIMENT_PROFILE=$(echo $treatment | rev | cut -d '/' -f 1 | rev)

tf=$(cat ${treatment} | grep "#treatment" | tail -1 | $LLMDBENCH_CONTROL_SCMD 's/^#//' || true)
if [[ -f ${LLMDBENCH_CONTROL_WORK_DIR}/workload/profiles/${workload_type}/treatment_list/$tf ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...spacing


local_results_dir=${LLMDBENCH_CONTROL_WORK_DIR}/results/${LLMDBENCH_RUN_EXPERIMENT_RESULTS_DIR_SUFFIX}
local_analysis_dir=${LLMDBENCH_CONTROL_WORK_DIR}/analysis/${LLMDBENCH_RUN_EXPERIMENT_RESULTS_DIR_SUFFIX}
llmdbench_execute_cmd "mkdir -p ${local_results_dir}_${i} && mkdir -p ${local_analysis_dir}_${i}" \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...spacing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell scripts fail when run from a directory with space characters in the directory path

2 participants