From 3d6394e0ef7e0e98d3da00449255eb8de70c072e Mon Sep 17 00:00:00 2001 From: Stefan Grundmann Date: Wed, 18 May 2022 21:08:43 +0000 Subject: [PATCH] fix awk script check_name() in extended_bin when the argument to the system calls in check_name awk script is built, the file part must be quoted. if this is not done, the system call will fail whenever the filename contains special characters fix #908 --- priv/templates/extended_bin | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index 3fbee28dd..6e3bd97b0 100644 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -617,10 +617,16 @@ RELX_CONFIG_PATH=$(check_replace_os_vars sys.config "$RELX_CONFIG_PATH") # - missing -name or -sname parameters # If all checks pass, extract the target node name set +e -TMP_NAME_ARG=$(awk 'function check_name(file) +TMP_NAME_ARG=$(awk 'function shell_quote(str) +{ + gsub(/'\''/, "'\''\\'\'''\''", str) + return "'\''" str "'\''" +} + +function check_name(file) { # if file exists, then it should be readable - if (system("test -f "file) == 0 && system("test -r "file) != 0) { + if (system("test -f " shell_quote(file)) == 0 && system("test -r " shell_quote(file)) != 0) { print file" not readable" exit 3 }