mirror of
https://github.com/dockersrc/debian
synced 2026-06-30 11:45:54 -04:00
🐛 Fix __exec_command dropping all arguments after the first 🐛
__exec_command was using ${arg:-} which only captured the first element
of the args array, then ran it through "$shell" $pre_exec "$cmdExec"
which effectively discarded everything after $1.
Running `docker run image sh -c 'go build ...'` would:
1. Set arg=("sh" "-c" "go build ...")
2. Set cmdExec="sh" (only first element)
3. Run bash --login -c "sh" (dropping -c and the actual command)
This broke any Makefile GO_DOCKER pattern that relied on passing multi-arg
commands. Simplified to just `exec "$@"` which passes all args through.
- rootfs/usr/local/etc/docker/functions/entrypoint.sh: rewrite __exec_command
rootfs/usr/local/etc/docker/functions/entrypoint.sh
This commit is contained in:
@@ -968,26 +968,11 @@ __create_env_file() {
|
|||||||
}
|
}
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
__exec_command() {
|
__exec_command() {
|
||||||
local arg=("$@")
|
|
||||||
local exitCode=0
|
local exitCode=0
|
||||||
local cmdExec="${arg:-}"
|
if [ $# -eq 0 ]; then
|
||||||
local pre_exec="--login -c"
|
exec bash -l
|
||||||
local shell bin prog
|
|
||||||
shell=$(type -P bash || type -P dash || type -P ash || type -P sh) 2>/dev/null
|
|
||||||
bin="${arg[0]:-bash}"
|
|
||||||
prog="$(type -P "$bin" 2>/dev/null || echo "$bin")"
|
|
||||||
if type -t "$bin" &>/dev/null; then
|
|
||||||
echo "${exec_message:-Executing command: $cmdExec}"
|
|
||||||
"$shell" $pre_exec "$cmdExec"
|
|
||||||
exitCode=$?
|
|
||||||
elif [ -f "$prog" ]; then
|
|
||||||
echo "$prog is not executable"
|
|
||||||
exitCode=98
|
|
||||||
else
|
|
||||||
echo "$prog does not exist"
|
|
||||||
exitCode=99
|
|
||||||
fi
|
fi
|
||||||
return $exitCode
|
exec "$@"
|
||||||
}
|
}
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
# Setup the server init scripts
|
# Setup the server init scripts
|
||||||
|
|||||||
Reference in New Issue
Block a user