Skip to content

Commit

Permalink
fix awk script check_name() in extended_bin
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sg2342 committed May 19, 2022
1 parent 2b40a69 commit 3d6394e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions priv/templates/extended_bin
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3d6394e

Please sign in to comment.