Skip to content
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

[ci] fix some shellcheck errors in scripts #6504

Closed

Conversation

shreyash2002
Copy link

@shreyash2002 shreyash2002 commented Jun 24, 2024

Contributes to #6498

  • fixed SC0286 (info): Double quote to prevent globbing and word splitting

…icrosoft#6498)

- Errors-  SC2086 (info) : Double quote to prevent globbing and word splitting
…t#6498)

- Fixed SC2086 (info): Double quote to prevent globbing and word splitting.
…icrosoft#6498)

- fixed  SC2086 (info): Double quote to prevent globbing and word splitting.
@shreyash2002
Copy link
Author

@microsoft-github-policy-service agree

@shreyash2002 shreyash2002 changed the title [ci] enforce shellchecks checks in (trigger_dispatch_run.sh); (set_commit_status.sh); (install_clang_devel.sh) [ci] enforce shellchecks checks in (trigger_dispatch_run.sh); (set_commit_status.sh); (install_clang_devel.sh) fixes #6498 Jun 24, 2024
@shreyash2002
Copy link
Author

hi @jameslamb
i've resolved shellchecks check error in three files. all of them had SC0286 check error.

@jameslamb jameslamb changed the title [ci] enforce shellchecks checks in (trigger_dispatch_run.sh); (set_commit_status.sh); (install_clang_devel.sh) fixes #6498 [ci] fix some shellcheck errors in scripts Jun 24, 2024
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to contribute to LightGBM!

I've requested some changes here. I've also made some edits:

  • removed fixed #6498 from the PR title... this does not FIX that issue, it just helps make some progress towards it
  • added a link to [ci] enforce 'shellcheck' checks #6498 in the PR description... please always do this when you contribute here and your contribution relates to other discussions in the project

.ci/install-clang-devel.sh Outdated Show resolved Hide resolved
- Used double quotes around entire word as suggested 
-  microsoft#6498
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

thanks for your help, please see my recent suggestions

Comment on lines +42 to +50
"llvm-${CLANG_VERSION}"-dev \
"llvm-${CLANG_VERSION}"-tools \
"libomp-${CLANG_VERSION}"-dev \
"libc++-${CLANG_VERSION}"-dev \
"libc++abi-${CLANG_VERSION}"-dev \
"libclang-common-${CLANG_VERSION}"-dev \
"libclang-${CLANG_VERSION}"-dev \
"libclang-cpp${CLANG_VERSION}"-dev \
"libunwind-${CLANG_VERSION}"-dev
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"llvm-${CLANG_VERSION}"-dev \
"llvm-${CLANG_VERSION}"-tools \
"libomp-${CLANG_VERSION}"-dev \
"libc++-${CLANG_VERSION}"-dev \
"libc++abi-${CLANG_VERSION}"-dev \
"libclang-common-${CLANG_VERSION}"-dev \
"libclang-${CLANG_VERSION}"-dev \
"libclang-cpp${CLANG_VERSION}"-dev \
"libunwind-${CLANG_VERSION}"-dev
"llvm-${CLANG_VERSION}-dev" \
"llvm-${CLANG_VERSION}-tools" \
"libomp-${CLANG_VERSION}-dev" \
"libc++-${CLANG_VERSION}-dev" \
"libc++abi-${CLANG_VERSION}-dev" \
"libclang-common-${CLANG_VERSION}-dev" \
"libclang-${CLANG_VERSION}-dev" \
"libclang-cpp${CLANG_VERSION}-dev" \
"libunwind-${CLANG_VERSION}-dev"

Please don't leave quotes in the middle of these words, as I asked in #6504 (comment).


# overwriting the stuff in /usr/bin is simpler and more reliable than
# updating PATH, LD_LIBRARY_PATH, etc.
cp --remove-destination /usr/lib/llvm-${CLANG_VERSION}/bin/* /usr/bin/
cp --remove-destination /usr/lib/llvm-"${CLANG_VERSION}"/bin/* /usr/bin/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
cp --remove-destination /usr/lib/llvm-"${CLANG_VERSION}"/bin/* /usr/bin/
cp --remove-destination "$(echo /usr/lib/llvm-${CLANG_VERSION}/bin/*)" /usr/bin/

--arg pr_branch "$(echo $pr | jq '.head.ref')" \
--arg pr_number "$(echo "$pr" | jq '.number')" \
--arg pr_sha "$(echo "$pr" | jq '.head.sha')" \
--arg pr_branch "$(echo "$pr" | jq '.head.ref')" \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Putting double quotes inside other double quotes like this requires escaping. To avoid that, please revert these changes and instead add the following comment on line 37 (directly above data=$():

# shellcheck disable=SC0286

@jameslamb
Copy link
Collaborator

@shreyash2002 are you planning to return to this pull request? Do you need any help?

@StrikerRUS
Copy link
Collaborator

.ci/install-clang-devel.sh was removed, .ci/set_commit_status.sh and .ci/trigger_dispatch_run.sh were fixed in #6621.

@shreyash2002 Thanks for your work here! Please pick up any other issue to contribute if you wish.

@StrikerRUS StrikerRUS closed this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants