This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new f5e868e469 GH-46895: [CI][Dev] Fix shellcheck errors in the 
ci/scripts/install_minio.sh (#46896)
f5e868e469 is described below

commit f5e868e4694a11a1033170b2633dc5dd7160e857
Author: Hiroyuki Sato <[email protected]>
AuthorDate: Wed Jun 25 09:26:35 2025 +0900

    GH-46895: [CI][Dev] Fix shellcheck errors in the 
ci/scripts/install_minio.sh (#46896)
    
    ### Rationale for this change
    
    This is the sub issue #44748.
    
    * SC2046: Quote this to prevent word splitting.
    * SC2086: Double quote to prevent globbing and word splitting.
    
    ```
    shellcheck ci/scripts/install_minio.sh
    
    In ci/scripts/install_minio.sh line 37:
    if [ -z ${archs[$arch]} ]; then
            ^-------------^ SC2086 (info): Double quote to prevent globbing and 
word splitting.
    
    Did you mean:
    if [ -z "${archs[$arch]}" ]; then
    
    In ci/scripts/install_minio.sh line 74:
      mkdir -p $(dirname ${output})
               ^------------------^ SC2046 (warning): Quote this to prevent 
word splitting.
                         ^-------^ SC2086 (info): Double quote to prevent 
globbing and word splitting.
    
    Did you mean:
      mkdir -p $(dirname "${output}")
    
    In ci/scripts/install_minio.sh line 76:
        wget -nv --output-document ${output} ${url}
                                   ^-------^ SC2086 (info): Double quote to 
prevent globbing and word splitting.
                                             ^----^ SC2086 (info): Double quote 
to prevent globbing and word splitting.
    
    Did you mean:
        wget -nv --output-document "${output}" "${url}"
    
    In ci/scripts/install_minio.sh line 78:
        curl --fail --location --output ${output} ${url}
                                        ^-------^ SC2086 (info): Double quote 
to prevent globbing and word splitting.
                                                  ^----^ SC2086 (info): Double 
quote to prevent globbing and word splitting.
    
    Did you mean:
        curl --fail --location --output "${output}" "${url}"
    
    In ci/scripts/install_minio.sh line 85:
      download ${prefix}/bin/minio ${url}
               ^-------^ SC2086 (info): Double quote to prevent globbing and 
word splitting.
                                   ^----^ SC2086 (info): Double quote to 
prevent globbing and word splitting.
    
    Did you mean:
      download "${prefix}"/bin/minio "${url}"
    
    In ci/scripts/install_minio.sh line 86:
      chmod +x ${prefix}/bin/minio
               ^-------^ SC2086 (info): Double quote to prevent globbing and 
word splitting.
    
    Did you mean:
      chmod +x "${prefix}"/bin/minio
    
    In ci/scripts/install_minio.sh line 91:
      download ${prefix}/bin/mc ${url}
               ^-------^ SC2086 (info): Double quote to prevent globbing and 
word splitting.
                                ^----^ SC2086 (info): Double quote to prevent 
globbing and word splitting.
    
    Did you mean:
      download "${prefix}"/bin/mc "${url}"
    
    In ci/scripts/install_minio.sh line 92:
      chmod +x ${prefix}/bin/mc
               ^-------^ SC2086 (info): Double quote to prevent globbing and 
word splitting.
    
    Did you mean:
      chmod +x "${prefix}"/bin/mc
    
    For more information:
      https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word 
splitt...
      https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent 
globbing ...
    ```
    
    ### What changes are included in this PR?
    
    * Quote variables.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    No.
    * GitHub Issue: #46895
    
    Authored-by: Hiroyuki Sato <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 .pre-commit-config.yaml     |  1 +
 ci/scripts/install_minio.sh | 16 ++++++++--------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index d1a374b0c7..ef3788d661 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -319,6 +319,7 @@ repos:
           ?^ci/scripts/install_emscripten\.sh$|
           ?^ci/scripts/install_gcs_testbench\.sh$|
           ?^ci/scripts/install_iwyu\.sh$|
+          ?^ci/scripts/install_minio\.sh$|
           ?^ci/scripts/install_ninja\.sh$|
           ?^ci/scripts/install_numpy\.sh$|
           ?^ci/scripts/install_pandas\.sh$|
diff --git a/ci/scripts/install_minio.sh b/ci/scripts/install_minio.sh
index 8685ced0bd..5efa03e82e 100755
--- a/ci/scripts/install_minio.sh
+++ b/ci/scripts/install_minio.sh
@@ -34,7 +34,7 @@ archs=([x86_64]=amd64
        [s390x]=s390x)
 
 arch=$(uname -m)
-if [ -z ${archs[$arch]} ]; then
+if [ -z "${archs[$arch]}" ]; then
   echo "Unsupported architecture: ${arch}"
   exit 0
 fi
@@ -71,23 +71,23 @@ download()
   local output=$1
   local url=$2
 
-  mkdir -p $(dirname ${output})
+  mkdir -p "$(dirname "${output}")"
   if type wget > /dev/null 2>&1; then
-    wget -nv --output-document ${output} ${url}
+    wget -nv --output-document "${output}" "${url}"
   else
-    curl --fail --location --output ${output} ${url}
+    curl --fail --location --output "${output}" "${url}"
   fi
 }
 
 if [[ ! -x ${prefix}/bin/minio ]]; then
   
url="https://dl.min.io/server/minio/release/${platform}-${arch}/archive/${minio_version}";
   echo "Fetching ${url}..."
-  download ${prefix}/bin/minio ${url}
-  chmod +x ${prefix}/bin/minio
+  download "${prefix}/bin/minio" "${url}"
+  chmod +x "${prefix}/bin/minio"
 fi
 if [[ ! -x ${prefix}/bin/mc ]]; then
   
url="https://dl.min.io/client/mc/release/${platform}-${arch}/archive/${mc_version}";
   echo "Fetching ${url}..."
-  download ${prefix}/bin/mc ${url}
-  chmod +x ${prefix}/bin/mc
+  download "${prefix}/bin/mc" "${url}"
+  chmod +x "${prefix}/bin/mc"
 fi

Reply via email to