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
This commit is contained in:
2 files changed
+9
-1
No files matched your search
@@ -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=$?
|
||||
|
||||
Reference in new issue
Block a user