diff mbox series

[v1] automation: avoid globbering the docker run args

Message ID 20210708145650.8961-1-olaf@aepfle.de (mailing list archive)
State New
Headers show
Series [v1] automation: avoid globbering the docker run args | expand

Commit Message

Olaf Hering July 8, 2021, 2:56 p.m. UTC
containerize bash -c './configure && make' fails due to shell expansion.

Collect all arguments for the script and pass them verbatim to the
docker run command.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 automation/scripts/containerize | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andrew Cooper July 9, 2021, 11:48 a.m. UTC | #1
On 08/07/2021 15:56, Olaf Hering wrote:
> containerize bash -c './configure && make' fails due to shell expansion.
>
> Collect all arguments for the script and pass them verbatim to the
> docker run command.
>
> Signed-off-by: Olaf Hering <olaf@aepfle.de>

Acked-by: Andrew Cooper <andew.cooper3@citrix.com>
diff mbox series

Patch

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 59edf0ba40..7682ccd347 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -47,10 +47,10 @@  case "_${CONTAINER_UID0}" in
 esac
 
 # Save the commands for future use
-cmd=$@
+cmd=("$@")
 
 # If no command was specified, just drop us into a shell if we're interactive
-[ $# -eq 0 ] && tty -s && cmd="/bin/bash"
+[ $# -eq 0 ] && tty -s && cmd=("/bin/bash")
 
 # Are we in an interactive terminal?
 tty -s && termint=t
@@ -104,4 +104,4 @@  exec ${docker_cmd} run \
     ${CONTAINER_ARGS} \
     -${termint}i --rm -- \
     ${CONTAINER} \
-    ${cmd}
+    "${cmd[@]}"