-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(tests): terminate find -exec and pass {} — the placeholder step was a no-op #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,7 +137,7 @@ find "$TEST_REPO_PATH" -type f \ | |
| sed -i "s|$placeholder|$value|g" "$file" | ||
| fi | ||
| done | ||
| ' _ "$file" | ||
| ' _ {} \; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 HIGH RISK The shell script inside 'sh -c' is single-quoted, which prevents the parent shell from expanding variables. While adding '{} ;' fixes the find syntax error, variables like $placeholder and $value will be empty inside the subshell. Furthermore, since the script fragment on line 139 concludes with a 'done' statement, using '+' instead of ';' is more efficient as it allows 'find' to batch multiple files into fewer shell invocations. Consider updating the command to pass the variables as arguments: find ... -exec sh -c 'p="$1"; v="$2"; shift 2; for file in "$@"; do ... done' _ "$placeholder" "$value" {} + |
||
|
|
||
| log_pass "All placeholder tokens replaced" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Pass the placeholder values to the child shell.
bash -cdoes not inherit ordinary shell variables. The variables assigned on Lines 18-27 are not exported, so$TEST_REPO_NAME,$TEST_OWNER,$TEST_FORGE,$TEST_PROJECT_NAME,$TEST_DESCRIPTION,$TEST_PRIMARY_LANGUAGE,$TEST_AUTHOR, and$TEST_AUTHOR_EMAILexpand to empty strings in the child shell. The now-activefind -exectherefore deletes most placeholder values while the test can still report success. Export these variables beforefind, or pass them as additionalbash -carguments.Proposed fix
🤖 Prompt for AI Agents