Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/e2e/template_instantiation_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ find "$TEST_REPO_PATH" -type f \
sed -i "s|$placeholder|$value|g" "$file"
fi
done
' _ "$file"
' _ {} \;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 HIGH RISK

The logic within the find -exec subshell will fail to execute as intended for two reasons:

  1. Variables like $placeholder and $value do not expand inside single quotes and will be empty in the subshell.
  2. The variable "$file" is unassigned in this scope. You should use the positional parameter $1 which receives the value from {}.

Refactor the command to pass the required variables as arguments:

find ... -exec sh -c 'placeholder="$1"; value="$2"; file="$3"; sed -i "s|$placeholder|$value|g" "$file"' _ "$placeholder" "$value" {} \;


log_pass "All placeholder tokens replaced"

Expand Down
Loading