From 8c7cf28bf6e3d72d401d0f8581e3c545bb494bf8 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 12 Mar 2020 15:15:18 +0100 Subject: [PATCH] fix: ``compose`` command line arguments could be eaten When rewriting arguments, any bash builtin's ``echo`` arguments would be removed. Signed-off-by: Valentin Lab --- bin/compose | 10 ++++++---- bin/compose-core | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/compose b/bin/compose index e16781d..5c389d6 100755 --- a/bin/compose +++ b/bin/compose @@ -59,7 +59,7 @@ hash_get() { next-0() { local ans IFS='' read -r -d '' ans && - echo -n "$ans" + printf "%s" "$ans" } @@ -1002,12 +1002,14 @@ run() { [ -t 1 ] && docker_run_opts+=("-t") if [ -n "$DEBUG" ] || [ -n "$DRY_RUN" ]; then - debug "${WHITE}Launching:${NORMAL}" + echo "${WHITE}Launching:${NORMAL}" echo "docker run --rm \\" pretty_print "${docker_run_opts[@]}" | sed_compat 's/^/ /g;s/([^\])$/\1\\\n/g' if [ -z "$ENTER" ]; then - echo " ${COMPOSE_DOCKER_IMAGE} \\" - echo " " "$@" + printf "%s\n" " ${COMPOSE_DOCKER_IMAGE} \\" + printf " " + printf "%s " "$@" + printf "\n" else echo " --entrypoint bash \\" echo " ${COMPOSE_DOCKER_IMAGE}" diff --git a/bin/compose-core b/bin/compose-core index cd4a013..301bed4 100755 --- a/bin/compose-core +++ b/bin/compose-core @@ -3769,7 +3769,7 @@ EOF cached_wget() { - local cache_file="$CACHEDIR/$FUNCNAME.cache.$(echo "$*" | md5_compat)" \ + local cache_file="$CACHEDIR/$FUNCNAME.cache.$(p0 "$@" | md5_compat)" \ url="$1" if [ -e "$cache_file" ]; then cat "$cache_file"