-
Notifications
You must be signed in to change notification settings - Fork 20
fix: update script to use quotes around dirname for better path handling #146
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
Conversation
WalkthroughThis change updates several shell scripts by modifying how they determine their own directory path. Specifically, it adds double quotes around the Changes
Possibly related PRs
Poem
β¨ Finishing Touches
πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
π§Ή Nitpick comments (5)
compiled_starters/cpp/.codecrafters/run.sh (1)
11-11
: Wrap theexec
path in quotes to fully prevent word splitting
Quoting$0
insidedirname
is a great improvement, but the resulting substitution$(dirname "$0")/build/git
is still unquoted in theexec
call. If the script lives in a directory with spaces, the path may be split into multiple arguments. Wrap the entire command substitution and the trailing/build/git
in quotes:-exec $(dirname "$0")/build/git "$@" +exec "$(dirname "$0")/build/git" "$@"π§° Tools
πͺ Shellcheck (0.10.0)
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
solutions/cpp/01-gg4/code/your_program.sh (1)
25-25
: Quote the substituted path in theexec
invocation
You've correctly quoted$0
indirname
, but the expanded path remains unquoted when passed toexec
. To handle directories with spaces, wrap it in quotes:-exec $(dirname "$0")/build/git "$@" +exec "$(dirname "$0")/build/git" "$@"π§° Tools
πͺ Shellcheck (0.10.0)
[warning] 25-25: Quote this to prevent word splitting.
(SC2046)
starter_templates/cpp/code/.codecrafters/run.sh (1)
11-11
: Fully quote theexec
argument to avoid splitting on spaces
While quoting$0
indirname
handles spaces in the script name, the composite path still needs quoting in theexec
call. Apply:-exec $(dirname "$0")/build/git "$@" +exec "$(dirname "$0")/build/git" "$@"π§° Tools
πͺ Shellcheck (0.10.0)
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
solutions/cpp/01-gg4/code/.codecrafters/run.sh (1)
11-11
: Ensure the command substitution is quoted inexec
To fully guard against word splitting, wrap the expanded path in quotes:-exec $(dirname "$0")/build/git "$@" +exec "$(dirname "$0")/build/git" "$@"π§° Tools
πͺ Shellcheck (0.10.0)
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
compiled_starters/cpp/your_program.sh (1)
25-25
: Quote the resulting path in theexec
call
The inner$0
is quoted fordirname
, but the final path should also be quoted when passed toexec
. Update to:-exec $(dirname "$0")/build/git "$@" +exec "$(dirname "$0")/build/git" "$@"π§° Tools
πͺ Shellcheck (0.10.0)
[warning] 25-25: Quote this to prevent word splitting.
(SC2046)
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (5)
compiled_starters/cpp/.codecrafters/run.sh
(1 hunks)compiled_starters/cpp/your_program.sh
(1 hunks)solutions/cpp/01-gg4/code/.codecrafters/run.sh
(1 hunks)solutions/cpp/01-gg4/code/your_program.sh
(1 hunks)starter_templates/cpp/code/.codecrafters/run.sh
(1 hunks)
π§° Additional context used
πͺ Shellcheck (0.10.0)
solutions/cpp/01-gg4/code/your_program.sh
[warning] 25-25: Quote this to prevent word splitting.
(SC2046)
starter_templates/cpp/code/.codecrafters/run.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
solutions/cpp/01-gg4/code/.codecrafters/run.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
compiled_starters/cpp/.codecrafters/run.sh
[warning] 11-11: Quote this to prevent word splitting.
(SC2046)
compiled_starters/cpp/your_program.sh
[warning] 25-25: Quote this to prevent word splitting.
(SC2046)
β° Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: test_course_definition / test (zig)
- GitHub Check: test_course_definition / test (kotlin)
- GitHub Check: test_course_definition / test (java)
- GitHub Check: test_course_definition / test (haskell)
- GitHub Check: test_course_definition / test (go)
- GitHub Check: test_course_definition / test (cpp)
- GitHub Check: test_course_definition / test (c)
Summary by CodeRabbit