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

While adding \; and {} fixes the find syntax, the command remains a no-op. The variables $placeholder and $value are not expanded by the parent shell because they are enclosed in a single-quoted string. Furthermore, the filename {} is passed to the subshell as a positional parameter, but the script tries to reference it as $file, which is undefined.

To fix this, pass the variables as arguments to the subshell:

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

Alternatively, use {} + for better performance if processing many files.


log_pass "All placeholder tokens replaced"

Expand Down
Loading