Skip to content

[CI][Dev] Fix shellcheck errors in the ci/scripts/r_windows_build.sh #50803

Description

@hiroyuki-sato

Describe the enhancement requested

This is the sub issue #44748.

  • SC2011: Use find -print0 or find -exec to better handle non-alphanumeric filenames.
  • SC2034: foo appears unused. Verify it or export it.
  • SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options.
  • SC2046: Quote this to prevent word splitting.
  • SC2086: Double quote to prevent globbing and word splitting.
  • SC2155: Declare and assign separately to avoid masking return values.
  • SC2223: This default assignment may cause DoS due to globbing. Quote it.
shellcheck ci/scripts/r_windows_build.sh

In ci/scripts/r_windows_build.sh line 22:
: ${ARROW_HOME:=$(pwd)}
  ^-------------------^ SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.


In ci/scripts/r_windows_build.sh line 24:
export ARROW_HOME="$(cd "${ARROW_HOME}" && pwd)"
       ^--------^ SC2155 (warning): Declare and assign separately to avoid masking return values.


In ci/scripts/r_windows_build.sh line 28:
RWINLIB_LIB_DIR="lib"
^-------------^ SC2034 (warning): RWINLIB_LIB_DIR appears unused. Verify use (or export if used externally).


In ci/scripts/r_windows_build.sh line 29:
: ${MINGW_ARCH:="mingw32 mingw64 ucrt64"}
  ^-- SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.


In ci/scripts/r_windows_build.sh line 33:
cp $ARROW_HOME/ci/scripts/PKGBUILD .
   ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp "$ARROW_HOME"/ci/scripts/PKGBUILD .


In ci/scripts/r_windows_build.sh line 37:
VERSION=$(grep Version $ARROW_HOME/r/DESCRIPTION | cut -d " " -f 2)
                       ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
VERSION=$(grep Version "$ARROW_HOME"/r/DESCRIPTION | cut -d " " -f 2)


In ci/scripts/r_windows_build.sh line 50:
ls *.xz | xargs -n 1 tar -xJf
^-- SC2011 (warning): Use 'find .. -print0 | xargs -0 ..' or 'find .. -exec .. +' to allow non-alphanumeric filenames.
   ^-- SC2035 (info): Use ./*glob* or -- *glob* so names with dashes won't become options.


In ci/scripts/r_windows_build.sh line 51:
mkdir -p $DST_DIR
         ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
mkdir -p "$DST_DIR"


In ci/scripts/r_windows_build.sh line 54:
if [ ! -d $DST_DIR/include ]; then
          ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
if [ ! -d "$DST_DIR"/include ]; then


In ci/scripts/r_windows_build.sh line 55:
  mv $(echo $MINGW_ARCH | cut -d ' ' -f 1)/include $DST_DIR
     ^-- SC2046 (warning): Quote this to prevent word splitting.
            ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                   ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mv $(echo "$MINGW_ARCH" | cut -d ' ' -f 1)/include "$DST_DIR"


In ci/scripts/r_windows_build.sh line 63:
  ls $MSYS_LIB_DIR/mingw64/lib/
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  ls "$MSYS_LIB_DIR"/mingw64/lib/


In ci/scripts/r_windows_build.sh line 65:
  mkdir -p $DST_DIR/lib/x64
           ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mkdir -p "$DST_DIR"/lib/x64


In ci/scripts/r_windows_build.sh line 67:
  mv mingw64/lib/*.a $DST_DIR/lib/x64
                     ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mv mingw64/lib/*.a "$DST_DIR"/lib/x64


In ci/scripts/r_windows_build.sh line 69:
  cp $MSYS_LIB_DIR/mingw64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/x64
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                       ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  cp "$MSYS_LIB_DIR"/mingw64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "$DST_DIR"/lib/x64


In ci/scripts/r_windows_build.sh line 74:
  ls $MSYS_LIB_DIR/mingw32/lib/
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  ls "$MSYS_LIB_DIR"/mingw32/lib/


In ci/scripts/r_windows_build.sh line 75:
  mkdir -p $DST_DIR/lib/i386
           ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mkdir -p "$DST_DIR"/lib/i386


In ci/scripts/r_windows_build.sh line 76:
  mv mingw32/lib/*.a $DST_DIR/lib/i386
                     ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mv mingw32/lib/*.a "$DST_DIR"/lib/i386


In ci/scripts/r_windows_build.sh line 77:
  cp $MSYS_LIB_DIR/mingw32/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/i386
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                       ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  cp "$MSYS_LIB_DIR"/mingw32/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "$DST_DIR"/lib/i386


In ci/scripts/r_windows_build.sh line 82:
  ls $MSYS_LIB_DIR/ucrt64/lib/
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  ls "$MSYS_LIB_DIR"/ucrt64/lib/


In ci/scripts/r_windows_build.sh line 83:
  mkdir -p $DST_DIR/lib/x64-ucrt
           ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mkdir -p "$DST_DIR"/lib/x64-ucrt


In ci/scripts/r_windows_build.sh line 84:
  mv ucrt64/lib/*.a $DST_DIR/lib/x64-ucrt
                    ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  mv ucrt64/lib/*.a "$DST_DIR"/lib/x64-ucrt


In ci/scripts/r_windows_build.sh line 85:
  cp $MSYS_LIB_DIR/ucrt64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a $DST_DIR/lib/x64-ucrt
     ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                                                                      ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
  cp "$MSYS_LIB_DIR"/ucrt64/lib/lib{snappy,zstd,lz4,brotli*,bz2,crypto,curl,ss*,utf8proc,re2,nghttp2}.a "$DST_DIR"/lib/x64-ucrt


In ci/scripts/r_windows_build.sh line 89:
zip -r ${DST_DIR}.zip $DST_DIR
       ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                      ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
zip -r "${DST_DIR}".zip "$DST_DIR"


In ci/scripts/r_windows_build.sh line 93:
cp ${DST_DIR}.zip ../libarrow.zip
   ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp "${DST_DIR}".zip ../libarrow.zip

For more information:
  https://www.shellcheck.net/wiki/SC2011 -- Use 'find .. -print0 | xargs -0 ....
  https://www.shellcheck.net/wiki/SC2034 -- RWINLIB_LIB_DIR appears unused. V...
  https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...

Component(s)

Continuous Integration

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions