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
4 changes: 3 additions & 1 deletion tests/e2e/template_instantiation_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ replace_placeholder() {
}

# Replace in all text files
export TEST_REPO_NAME TEST_OWNER TEST_FORGE TEST_PROJECT_NAME \
TEST_DESCRIPTION TEST_PRIMARY_LANGUAGE TEST_AUTHOR TEST_AUTHOR_EMAIL
find "$TEST_REPO_PATH" -type f \
\( -name "*.md" -o -name "*.adoc" -o -name "*.a2ml" -o -name "*.zig" -o -name "*.idr" \
-o -name "Justfile" -o -name "Containerfile" -o -name "*.yml" -o -name "*.yaml" \
Expand All @@ -137,7 +139,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 script block uses variables like "$file", "$placeholder", and "$value" which are not expanded by the outer shell because of the single quotes. While the filename is now passed as {} (which becomes $1 in the subshell), it is not assigned to the 'file' variable used by the sed command. This will cause the command to fail or do nothing as the variables will be empty in the subshell. To fix this, you must either use double quotes (carefully) or pass the variables as additional arguments to the subshell and assign them internally (e.g., sh -c 'file=$1; placeholder=$2; ...' -- "{}" "$placeholder").


log_pass "All placeholder tokens replaced"

Expand Down
Loading