Skip to content

fix(update): iterate compose services as an array to avoid word-splitting - #3502

Open
patil2001 wants to merge 1 commit into
Osmantic:mainfrom
patil2001:fix/health-loop-service-array
Open

fix(update): iterate compose services as an array to avoid word-splitting#3502
patil2001 wants to merge 1 commit into
Osmantic:mainfrom
patil2001:fix/health-loop-service-array

Conversation

@patil2001

Copy link
Copy Markdown
Contributor

Summary

cmd_health in ods-update.sh captured the output of docker compose ps --services in a scalar variable and iterated it with for service in $services. docker compose ps --services emits one service name per line, so the unquoted expansion word-splits on whitespace: any service whose name contains a space is torn into fragments and probed as a partial name, producing a false unknown/unhealthy report.

This change reads the service list into an array with mapfile and iterates over whole elements, so multi-word service names stay intact. The empty-case check now uses the array length.

Test plan

  • bash -n ods/ods-update.sh
  • On a running stack, the health check reports each service correctly; add a service whose name contains a space and confirm it is no longer split.

Fixes #3339

…ting

cmd_health stored the 'docker compose ps --services' output in a scalar and
iterated it with 'for service in $services', which word-splits service names
on whitespace. Any service whose name contains a space was split into tokens
and probed as a fragment, reporting a false unhealthy status.

Read the service list into an array with mapfile and iterate over whole
elements so multi-word service names stay intact.

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

Labels

None yet

1 participant