Skip to content

GH-46763: [CI][Dev] fix shellcheck errors in the ci/scripts/ccache_setup.sh #46766

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

Merged
merged 3 commits into from
Jun 12, 2025

Conversation

hiroyuki-sato
Copy link
Collaborator

@hiroyuki-sato hiroyuki-sato commented Jun 10, 2025

Rationale for this change

This is the sub issue #44748.

  • SC2086: (info): Double quote to prevent globbing and word splitting.
  • SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
shellcheck ci/scripts/ccache_setup.sh

In ci/scripts/ccache_setup.sh line 22:
echo "ARROW_USE_CCACHE=ON" >> $GITHUB_ENV
^-- SC2129 (style): Consider using { cmd1; cmd2; } >> file instead of individual redirects.
                              ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "ARROW_USE_CCACHE=ON" >> "$GITHUB_ENV"


In ci/scripts/ccache_setup.sh line 23:
echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV
                                       ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "CCACHE_COMPILERCHECK=content" >> "$GITHUB_ENV"


In ci/scripts/ccache_setup.sh line 24:
echo "CCACHE_COMPRESS=1" >> $GITHUB_ENV
                            ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "CCACHE_COMPRESS=1" >> "$GITHUB_ENV"


In ci/scripts/ccache_setup.sh line 25:
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
                                 ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "CCACHE_COMPRESSLEVEL=6" >> "$GITHUB_ENV"


In ci/scripts/ccache_setup.sh line 26:
echo "CCACHE_MAXSIZE=1G" >> $GITHUB_ENV
                            ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "CCACHE_MAXSIZE=1G" >> "$GITHUB_ENV"

For more information:
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
  https://www.shellcheck.net/wiki/SC2129 -- Consider using { cmd1; cmd2; } >>...
palolovalley:arrow hsato$ vi ci/scripts/ccache_setup.sh

What changes are included in this PR?

  • SC2086: Quoting like "$GITHUB_ENV"
  • SC2129: combine multiple commands using {}

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

Copy link

⚠️ GitHub issue #46763 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions bot added the awaiting review Awaiting review label Jun 10, 2025
@hiroyuki-sato
Copy link
Collaborator Author

@github-actions crossbow submit -g cpp -g ruby

Copy link

Revision: 74cc885

Submitted crossbow builds: ursacomputing/crossbow @ actions-efb3af9cc5

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-cuda-cpp-ubuntu-22.04-cuda-11.7.1 GitHub Actions
test-debian-12-cpp-amd64 GitHub Actions
test-debian-12-cpp-i386 GitHub Actions
test-debian-ruby GitHub Actions
test-fedora-39-cpp GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-bundled-offline GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions
test-ubuntu-ruby GitHub Actions

@hiroyuki-sato
Copy link
Collaborator Author

msys2_setup.sh used by .github/workflows/cpp.yml and .github/workflows/ruby.yml

So I tried crossbow ruby and cpp

rg -l 'ccache_setup.sh'
ci/scripts/msys2_setup.sh

rg -l 'msys2_setup.sh' .github/workflows/
.github/workflows/cpp.yml
.github/workflows/ruby.yml

@hiroyuki-sato
Copy link
Collaborator Author

@github-actions crossbow submit test-ubuntu-22.04-cpp-bundled

Copy link

Revision: 74cc885

Submitted crossbow builds: ursacomputing/crossbow @ actions-4830b2d151

Task Status
test-ubuntu-22.04-cpp-bundled GitHub Actions

@kou kou requested a review from Copilot June 12, 2025 02:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses shellcheck warnings in the ccache_setup.sh script by quoting the environment variable and grouping the echo commands, and it updates the pre-commit configuration to include the new script.

  • Quote $GITHUB_ENV and wrap echo statements in a grouped redirect block in ci/scripts/ccache_setup.sh
  • Add ci/scripts/ccache_setup.sh to the shell hook patterns in .pre-commit-config.yaml

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ci/scripts/ccache_setup.sh Combined multiple echo statements into a single { ... } >> "$GITHUB_ENV" block and added quoting
.pre-commit-config.yaml Included the new ccache_setup.sh script in the shell hook file patterns

@kou
Copy link
Member

kou commented Jun 12, 2025

msys2_setup.sh used by .github/workflows/cpp.yml and .github/workflows/ruby.yml

Why is msys2_setup.sh related to this PR? This PR focus on ccache_setup.sh.

@kou
Copy link
Member

kou commented Jun 12, 2025

Ah, msys2_setup.sh calls ccache_setup.sh.

@kou
Copy link
Member

kou commented Jun 12, 2025

msys2_setup.sh used by .github/workflows/cpp.yml and .github/workflows/ruby.yml

So I tried crossbow ruby and cpp

We don't use Crossbow for .github/workflows/. So we don't need to use Crossbow here. Instead, we should run .github/workflow/{cpp,ruby}.yml:

diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
index 8c4388fc0f..106cc1fd86 100644
--- a/.github/workflows/cpp.yml
+++ b/.github/workflows/cpp.yml
@@ -29,6 +29,7 @@ on:
       - '.github/workflows/cpp.yml'
       - 'ci/conda_env_*'
       - 'ci/docker/**'
+      - 'ci/scripts/ccache_setup.sh'
       - 'ci/scripts/cpp_*'
       - 'ci/scripts/install_azurite.sh'
       - 'ci/scripts/install_gcs_testbench.sh'
@@ -45,6 +46,7 @@ on:
       - '.github/workflows/cpp.yml'
       - 'ci/conda_env_*'
       - 'ci/docker/**'
+      - 'ci/scripts/ccache_setup.sh'
       - 'ci/scripts/cpp_*'
       - 'ci/scripts/install_azurite.sh'
       - 'ci/scripts/install_gcs_testbench.sh'
diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml
index 3df63568e9..e982afde91 100644
--- a/.github/workflows/cpp_extra.yml
+++ b/.github/workflows/cpp_extra.yml
@@ -27,6 +27,7 @@ on:
       - '.github/workflows/cpp_extra.yml'
       - 'ci/conda_env_*'
       - 'ci/docker/**'
+      - 'ci/scripts/ccache_setup.sh'
       - 'ci/scripts/cpp_*'
       - 'ci/scripts/install_azurite.sh'
       - 'ci/scripts/install_gcs_testbench.sh'
@@ -45,6 +46,7 @@ on:
       - '.github/workflows/cpp_extra.yml'
       - 'ci/conda_env_*'
       - 'ci/docker/**'
+      - 'ci/scripts/ccache_setup.sh'
       - 'ci/scripts/cpp_*'
       - 'ci/scripts/install_azurite.sh'
       - 'ci/scripts/install_gcs_testbench.sh'
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
index 8cb16049f0..af52e73320 100644
--- a/.github/workflows/ruby.yml
+++ b/.github/workflows/ruby.yml
@@ -29,6 +29,7 @@ on:
       - '.github/workflows/ruby.yml'
       - 'ci/docker/**'
       - 'ci/scripts/c_glib_*'
+      - 'ci/scripts/ccache_setup.sh'
       - 'ci/scripts/cpp_*'
       - 'ci/scripts/msys2_*'
       - 'ci/scripts/ruby_*'
@@ -43,6 +44,7 @@ on:
       - '.github/workflows/ruby.yml'
       - 'ci/docker/**'
       - 'ci/scripts/c_glib_*'
+      - 'ci/scripts/ccache_setup.sh'
       - 'ci/scripts/cpp_*'
       - 'ci/scripts/msys2_*'
       - 'ci/scripts/ruby_*'

…che_setup.sh

Co-Authored-by: Sutou Kouhei <kou@ clear-code.com>
@hiroyuki-sato
Copy link
Collaborator Author

Thanks. I applied suggested change. Should we separate .github/workflow/* change?

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

@kou kou merged commit e00c01a into apache:main Jun 12, 2025
28 of 29 checks passed
@kou kou removed the awaiting review Awaiting review label Jun 12, 2025
@github-actions github-actions bot added the awaiting merge Awaiting merge label Jun 12, 2025
@hiroyuki-sato hiroyuki-sato deleted the topic/fix-shellcheck-ccache_setup branch June 12, 2025 05:22
Copy link

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit e00c01a.

There were 71 benchmark results with an error:

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them.

alinaliBQ pushed a commit to Bit-Quill/arrow that referenced this pull request Jun 17, 2025
…che_setup.sh (apache#46766)

### Rationale for this change

This is the sub issue apache#44748.

* SC2086: (info): Double quote to prevent globbing and word splitting.
* SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.

```
shellcheck ci/scripts/ccache_setup.sh

In ci/scripts/ccache_setup.sh line 22:
echo "ARROW_USE_CCACHE=ON" >> $GITHUB_ENV
^-- SC2129 (style): Consider using { cmd1; cmd2; } >> file instead of individual redirects.
                              ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "ARROW_USE_CCACHE=ON" >> "$GITHUB_ENV"

In ci/scripts/ccache_setup.sh line 23:
echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV
                                       ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "CCACHE_COMPILERCHECK=content" >> "$GITHUB_ENV"

In ci/scripts/ccache_setup.sh line 24:
echo "CCACHE_COMPRESS=1" >> $GITHUB_ENV
                            ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "CCACHE_COMPRESS=1" >> "$GITHUB_ENV"

In ci/scripts/ccache_setup.sh line 25:
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
                                 ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "CCACHE_COMPRESSLEVEL=6" >> "$GITHUB_ENV"

In ci/scripts/ccache_setup.sh line 26:
echo "CCACHE_MAXSIZE=1G" >> $GITHUB_ENV
                            ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
echo "CCACHE_MAXSIZE=1G" >> "$GITHUB_ENV"

For more information:
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
  https://www.shellcheck.net/wiki/SC2129 -- Consider using { cmd1; cmd2; } >>...
palolovalley:arrow hsato$ vi ci/scripts/ccache_setup.sh
```

### What changes are included in this PR?

* SC2086: Quoting  like "$GITHUB_ENV"
* SC2129: combine multiple commands using `{}`

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.

* GitHub Issue: apache#46763

Authored-by: Hiroyuki Sato <hiroysato@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting merge Awaiting merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants