Skip to content

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

Closed
pratyushadk wants to merge 1 commit into
apache:mainfrom
pratyushadk:GH-50803-fix-shellcheck-r-windows-build
Closed

pratyushadk wants to merge 1 commit into
apache:mainfrom
pratyushadk:GH-50803-fix-shellcheck-r-windows-build

Conversation

@pratyushadk

@pratyushadk pratyushadk commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Rationale for this change

This is a sub-issue of #44748.

Fix all errors reported by shellcheck in ci/scripts/r_windows_build.sh.

What changes are included in this PR?

The following shellcheck error codes are addressed:

  • SC2223: Quoted the default variable assignments (: ${VAR:=...} → : "${VAR:=...}") to prevent unintended globbing on lines 22 and 29.
  • SC2155: Split export ARROW_HOME="$(cd ...)" into two separate lines (declare, then export) to avoid masking the return value of the cd subshell.
  • SC2034: Removed the unused variable RWINLIB_LIB_DIR="lib" which was declared but never referenced anywhere in the script.
  • SC2086: Double-quoted all variable references used in path operations to prevent globbing and word splitting.
  • SC2011 + SC2035: Replaced ls *.xz | xargs -n 1 tar -xJf with find . -maxdepth 1 -name "*.xz" -print0 | xargs -0 -n 1 tar -xJf to safely handle non-alphanumeric filenames and prevent glob arguments from being treated as flags.
  • SC2046: Quoted the command substitution $(echo "$MINGW_ARCH" | cut ...) in the mv call to prevent word splitting on the result.

Are these changes tested?

Verified by running shellcheck v0.11.0 against the modified file locally. The tool now exits with code 0 (no warnings or errors).

No functional logic was changed — all modifications are quoting and idiom improvements only.

Copilot AI lite review requested due to automatic review settings August 4, 2026 13:14
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses ShellCheck-reported issues in ci/scripts/r_windows_build.sh to improve safety around quoting, default assignments, and filename handling in CI packaging steps for the Windows R build artifacts.

Changes:

  • Quote parameter default assignments and path-related variable expansions to avoid globbing/word-splitting (SC2223, SC2086, SC2046).
  • Split export VAR="$(...)" into assignment + export to avoid masking return values (SC2155) and remove an unused variable (SC2034).
  • Replace ls *.xz | xargs ... with a find ... -print0 | xargs -0 ... pattern to handle non-alphanumeric filenames safely (SC2011, SC2035).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review Awaiting review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants