🐛 Fix sh/bash -c invocations losing their interpreter name 🐛

- rootfs/usr/local/bin/entrypoint.sh: the `*/bin/sh | */bin/bash | bash |
  sh | shell)` case branch unconditionally shifted away $1 before calling
  __exec_command "$@", which does a bare `exec "$@"`. For `docker run
  image sh -c 'cmd'` this turned the exec into `exec -c cmd` (command not
  found, exit 127) instead of `exec sh -c 'cmd'` — the interpreter name is
  required as the exec'd program itself, not just a case-match keyword.
  Only shift when $1 is literally "shell" (a keyword, not an executable
  name); "sh"/"bash"/"*/bin/sh"/"*/bin/bash" must be passed through intact.
  Verified `bash -n` passes and `docker run casjaysdev/go:latest sh -c
  "..."` now runs the command instead of erroring. Found while running the
  full functional test pass after the previous START_SERVICES gate fix
  (commit 6de223133c).
This commit is contained in:
2026-07-27 16:36:12 -04:00
parent 6de223133c
commit ab4251e480
+4 -2
View File
@@ -626,9 +626,11 @@ procs)
[ -n "$ps" ] && printf '%s\n%s\n' "Found the following processes" "$ps" | tr '\n' ' '
exit $?
;;
# Launch shell
# Launch shell — do not shift here: "sh -c 'cmd'" / "bash -c 'cmd'" needs the
# interpreter name kept as argv[0] for __exec_command's `exec "$@"` to work;
# shifting it away turned "sh -c 'cmd'" into `exec -c cmd` (command not found)
*/bin/sh | */bin/bash | bash | sh | shell)
shift 1
[ "$1" = "shell" ] && shift 1
__exec_command "$@"
exit $?
;;