Skip to content

Commit eecc738

Browse files
committed
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
1 parent 2b40a69 commit eecc738

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

priv/templates/extended_bin

+8-2
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,16 @@ RELX_CONFIG_PATH=$(check_replace_os_vars sys.config "$RELX_CONFIG_PATH")
617617
# - missing -name or -sname parameters
618618
# If all checks pass, extract the target node name
619619
set +e
620-
TMP_NAME_ARG=$(awk 'function check_name(file)
620+
TMP_NAME_ARG=$(awk 'function shell_quote(str)
621+
{
622+
gsub(/'\''/,"'\'\\\\\'\''", str);
623+
return "'\''" str "'\''"
624+
}
625+
626+
function check_name(file)
621627
{
622628
# if file exists, then it should be readable
623-
if (system("test -f "file) == 0 && system("test -r "file) != 0) {
629+
if (system("test -f " shell_quote(file)) == 0 && system("test -r " shell_quote(file)) != 0) {
624630
print file" not readable"
625631
exit 3
626632
}

0 commit comments

Comments
 (0)