From 820c15298caddfa06d1005f06011a73a570d822b Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Thu, 18 Jan 2024 20:33:52 -0800 Subject: [PATCH] add note about issue 1191 and shell requoting or special chars --- bin/docker_entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh index 74e7a3a9..21d89f49 100755 --- a/bin/docker_entrypoint.sh +++ b/bin/docker_entrypoint.sh @@ -180,9 +180,11 @@ if [[ "$1" == /* || "$1" == "bash" || "$1" == "sh" || "$1" == "echo" || "$1" == # "docker run archivebox /bin/bash -c '...'" # "docker run archivebox cat /VERSION.txt" exec gosu "$PUID" /bin/bash -c "exec $(printf ' %q' "$@")" + # WARNING: make sure to test extensively if you change this line, there are many edge-cases with nested quotes, special character, etc. # printf requotes shell parameters properly https://stackoverflow.com/a/39463371/2156113 # gosu spawns an ephemeral bash process owned by archivebox user (bash wrapper is needed to load env vars, PATH, and setup terminal TTY) # outermost exec hands over current process ID to inner bash process, inner exec hands over inner bash PID to user's command + # - https://github.com/ArchiveBox/ArchiveBox/issues/1191 else # handle "docker run archivebox add some subcommand --with=args abc" by calling archivebox to run as args as CLI subcommand # e.g. "docker run archivebox help"