From c3a4b79e6ee398668484573d3410f034187bbe36 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 11 Oct 2026 04:33:08 -0400 Subject: [PATCH] fix: preserve arguments such as --version and -n when running commands over ssh xargs without a command runs /bin/echo per word, which interprets --version, --help, -n, -e and -E as its own options. Use printf with a NUL delimiter instead. Closes #9120 --- dokku | 2 +- tests/unit/core_2.bats | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dokku b/dokku index 4c3609258..c11550b80 100755 --- a/dokku +++ b/dokku @@ -118,7 +118,7 @@ if [[ -n "$SSH_ORIGINAL_COMMAND" ]]; then exit_code=$? set +f else - readarray -t -O "${#ssh_arg_array[@]}" ssh_arg_array < <(printf '%s' "$SSH_ORIGINAL_COMMAND" | xargs -n 1) + readarray -d '' -O "${#ssh_arg_array[@]}" ssh_arg_array < <(printf '%s' "$SSH_ORIGINAL_COMMAND" | xargs -r printf '%s\0') set -f $0 "${ssh_arg_array[@]}" exit_code=$? diff --git a/tests/unit/core_2.bats b/tests/unit/core_2.bats index a0f7a4591..2efe0e25c 100644 --- a/tests/unit/core_2.bats +++ b/tests/unit/core_2.bats @@ -37,6 +37,14 @@ teardown() { assert_success } +@test "(core) ssh arguments are passed through unchanged" { + run ssh "dokku@$DOKKU_DOMAIN" fakecommand --version --help -n -e -E + echo "output: $output" + echo "status: $status" + assert_failure + assert_output_contains '`fakecommand --version --help -n -e -E` is not a dokku command.' +} + @test "(core) urls (non-ssl)" { assert_urls "http://${TEST_APP}.${DOKKU_DOMAIN}"