Skip to content

GH-50609: [CI][Dev] Fix shellcheck errors in the ci/scripts/r_deps.sh#50610

Open
hiroyuki-sato wants to merge 4 commits into
apache:mainfrom
hiroyuki-sato:topic/shellcheck-r_deps
Open

GH-50609: [CI][Dev] Fix shellcheck errors in the ci/scripts/r_deps.sh#50610
hiroyuki-sato wants to merge 4 commits into
apache:mainfrom
hiroyuki-sato:topic/shellcheck-r_deps

Conversation

@hiroyuki-sato

@hiroyuki-sato hiroyuki-sato commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Rationale for this change

This is the sub issue #44748.

  • SC2027: The surrounding quotes actually unquote this. Remove or escape them.
  • SC2086: Double quote to prevent globbing and word splitting.
  • SC2223: This default assignment may cause DoS due to globbing. Quote it.
shellcheck ci/scripts/r_deps.sh

In ci/scripts/r_deps.sh line 21:
: ${R_BIN:=R}
  ^---------^ SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.


In ci/scripts/r_deps.sh line 23:
: ${R_PRUNE_DEPS:=FALSE}
  ^--------------------^ SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.


In ci/scripts/r_deps.sh line 24:
R_PRUNE_DEPS=`echo $R_PRUNE_DEPS | tr '[:upper:]' '[:lower:]'`
             ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.
                   ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
R_PRUNE_DEPS=$(echo "$R_PRUNE_DEPS" | tr '[:upper:]' '[:lower:]')


In ci/scripts/r_deps.sh line 26:
: ${R_DUCKDB_DEV:=FALSE}
  ^--------------------^ SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.


In ci/scripts/r_deps.sh line 27:
R_DUCKDB_DEV=`echo $R_DUCKDB_DEV | tr '[:upper:]' '[:lower:]'`
             ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`.
                   ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
R_DUCKDB_DEV=$(echo "$R_DUCKDB_DEV" | tr '[:upper:]' '[:lower:]')


In ci/scripts/r_deps.sh line 31:
pushd ${source_dir}
      ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
pushd "${source_dir}"


In ci/scripts/r_deps.sh line 33:
if [ ${R_PRUNE_DEPS} = "true" ]; then
     ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
if [ "${R_PRUNE_DEPS}" = "true" ]; then


In ci/scripts/r_deps.sh line 46:
${R_BIN} -e "options(warn=2); install.packages('remotes'); remotes::install_cran(c('glue', 'rcmdcheck', 'sys')); remotes::install_deps(INSTALL_opts = '"${INSTALL_ARGS}"')"
                                                                                                                                                        ^-------------^ SC2027 (warning): The surrounding quotes actually unquote this. Remove or escape them.
                                                                                                                                                        ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
${R_BIN} -e "options(warn=2); install.packages('remotes'); remotes::install_cran(c('glue', 'rcmdcheck', 'sys')); remotes::install_deps(INSTALL_opts = '""${INSTALL_ARGS}""')"


In ci/scripts/r_deps.sh line 49:
if [ ${R_DUCKDB_DEV} == "true" ]; then
     ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
if [ "${R_DUCKDB_DEV}" == "true" ]; then


In ci/scripts/r_deps.sh line 55:
${R_BIN} -e "remotes::install_deps(dependencies = TRUE, INSTALL_opts = '"${INSTALL_ARGS}"')"
                                                                         ^-------------^ SC2027 (warning): The surrounding quotes actually unquote this. Remove or escape them.
                                                                         ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
${R_BIN} -e "remotes::install_deps(dependencies = TRUE, INSTALL_opts = '""${INSTALL_ARGS}""')"

For more information:
  https://www.shellcheck.net/wiki/SC2027 -- The surrounding quotes actually u...
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
  https://www.shellcheck.net/wiki/SC2223 -- This default assignment may cause...

What changes are included in this PR?

  • SC2027: Remove redundant quotes.
  • SC2086: Quote variable expansions.
  • SC2223: Quote default variable assignments.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot added the awaiting review Awaiting review label Jul 23, 2026
@kou kou added the CI: Extra: R Run extra R CI label Jul 23, 2026
@kou

kou commented Jul 23, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit -g r

Comment thread ci/scripts/r_deps.sh Outdated
@github-actions

Copy link
Copy Markdown

Revision: 48a4a03

Submitted crossbow builds: ursacomputing/crossbow @ actions-a93615c8b7

Task Status
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-r-alpine-linux-cran GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-fedora-clang GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-sanitizers GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-m1-san GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-offline-maximal GitHub Actions
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-r-wasm GitHub Actions

@github-actions github-actions Bot added awaiting changes Awaiting changes awaiting change review Awaiting change review and removed awaiting review Awaiting review awaiting changes Awaiting changes labels Jul 23, 2026
@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@github-actions crossbow submit -g r

@github-actions

Copy link
Copy Markdown

Revision: 85f2b3e

Submitted crossbow builds: ursacomputing/crossbow @ actions-47fe7ddf85

Task Status
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-r-alpine-linux-cran GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-fedora-clang GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-sanitizers GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-m1-san GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-offline-maximal GitHub Actions
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-r-wasm GitHub Actions

@kou

kou commented Jul 24, 2026

Copy link
Copy Markdown
Member

Let's wait for #50587 before we merge this because the current R related CI jobs are broken.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Jul 24, 2026
@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

Thanks I got it.

@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

Since #47404 also modifies .pre-commit-config.yaml, there may be a merge conflict if either PR is merged first. If that happens, I'll rebase this PR again.

@hiroyuki-sato
hiroyuki-sato force-pushed the topic/shellcheck-r_deps branch from 85f2b3e to fab7f57 Compare July 24, 2026 12:34
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jul 24, 2026
@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

#47404 has been merged, so I rebased this PR.

@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@github-actions crossbow submit -g r

Comment thread .pre-commit-config.yaml
hooks:
- id: shellcheck
alias: shell
# TODO: Remove this when we fix all lint failures

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

from my understanding we are close to having this. Is the idea to have a follow up and remove this list afterwards. I am unsure if there has been new shell scripts created since this list was built.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@raulcd

Once I fix the remaining six files in ci/scripts, we should be able to remove that part.

  • ci/scripts/r_docker_configure.sh: SC2006 SC2046 SC2086 SC2223
  • ci/scripts/r_install_system_dependencies.sh: SC2006 SC2223
  • ci/scripts/r_sanitize.sh: SC2086 SC2155 SC2223
  • ci/scripts/r_test.sh: SC1091 SC2086 SC2223
  • ci/scripts/r_valgrind.sh: SC2046 SC2086 SC2223
  • ci/scripts/r_windows_build.sh: SC2011 SC2034 SC2035 SC2046 SC2086 SC2155 SC2223

We’re almost there 😄

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Jul 24, 2026
@github-actions

Copy link
Copy Markdown

Revision: fab7f57

Submitted crossbow builds: ursacomputing/crossbow @ actions-bc2d28fb9f

Task Status
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-r-alpine-linux-cran GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-fedora-clang GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-sanitizers GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-m1-san GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-offline-maximal GitHub Actions
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-r-wasm GitHub Actions

@hiroyuki-sato

hiroyuki-sato commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

Is the failure of the Python / AMD64 macOS 15-intel Python 3 (pull_request) CI job related to this PR?

It passed before the rebase, so I suspect the failure may be unrelated to this PR.

https://github.com/apache/arrow/actions/runs/30093588302/job/89482235673?pr=50610#step:11:210

=================================== FAILURES ===================================
________________________ test_write_dataset_s3_put_only ________________________
[gw0] darwin -- Python 3.11.9 /Library/Frameworks/Python.framework/Versions/3.11/bin/python

s3_server = {'connection': ('127.0.0.1', 49384, 'arrow', 'apachearrow'), 'process': <Popen: returncode: None args: ['minio', '--co......>, 'tempdir': local('/private/var/folders/8j/3c4g2vh16vgc8j40cj25qfqh0000gn/T/pytest-of-runner/pytest-0/popen-gw0')}

    @pytest.mark.parquet
    @pytest.mark.s3
    def test_write_dataset_s3_put_only(s3_server):
        # [ARROW-15892] Testing the create_dir flag which will restrict
        # creating a new directory for writing a dataset. This is
        # required while writing a dataset in s3 where we have very
        # limited permissions and thus we can directly write the dataset
        # without creating a directory.
        from pyarrow.fs import S3FileSystem
    
        # write dataset with s3 filesystem
        host, port, _, _ = s3_server['connection']
    
>       _configure_s3_limited_user(s3_server, _minio_put_only_policy,
                                   'test_dataset_limited_user', 'limited123')

/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyarrow/tests/test_dataset.py:5206: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyarrow/tests/util.py:417: in _configure_s3_limited_user
    _run_mc_command(mcdir, 'admin', 'policy', 'attach',
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyarrow/tests/util.py:366: in _run_mc_command
    retval = proc.wait(10)
             ^^^^^^^^^^^^^
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py:1264: in wait
    return self._wait(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Popen: returncode: -13 args: ['mc', '-C', '/private/var/folders/8j/3c4g2vh1...>
timeout = 10

    def _wait(self, timeout):
        """Internal implementation of wait() on POSIX."""
        if self.returncode is not None:
            return self.returncode
    
        if timeout is not None:
            endtime = _time() + timeout
            # Enter a busy loop if we have a timeout.  This busy loop was
            # cribbed from Lib/threading.py in Thread.wait() at r71065.
            delay = 0.0005 # 500 us -> initial delay of 1 ms
            while True:
                if self._waitpid_lock.acquire(False):
                    try:
                        if self.returncode is not None:
                            break  # Another thread waited.
                        (pid, sts) = self._try_wait(os.WNOHANG)
                        assert pid == self.pid or pid == 0
                        if pid == self.pid:
                            self._handle_exitstatus(sts)
                            break
                    finally:
                        self._waitpid_lock.release()
                remaining = self._remaining_time(endtime)
                if remaining <= 0:
>                   raise TimeoutExpired(self.args, timeout)
E                   subprocess.TimeoutExpired: Command '['mc', '-C', '/private/var/folders/8j/3c4g2vh16vgc8j40cj25qfqh0000gn/T/pytest-of-runner/pytest-0/popen-gw0/mc', 'admin', 'policy', 'attach', 'myminio/', 'no-create-buckets', '--user', 'test_dataset_limited_user']' timed out after 10 seconds

/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py:2045: TimeoutExpired
----------------------------- Captured stdout call -----------------------------
Cmd: mc -C /private/var/folders/8j/3c4g2vh16vgc8j40cj25qfqh0000gn/T/pytest-of-runner/pytest-0/popen-gw0/mc alias set myminio http://127.0.0.1:49384/ arrow apachearrow
  Return: 0
  Stdout: Added `myminio` successfully.

  Stderr: 
Cmd: mc -C /private/var/folders/8j/3c4g2vh16vgc8j40cj25qfqh0000gn/T/pytest-of-runner/pytest-0/popen-gw0/mc admin user add myminio/ test_dataset_limited_user limited123
  Return: 0
  Stdout: Added user `test_dataset_limited_user` successfully.

  Stderr: 
Cmd: mc -C /private/var/folders/8j/3c4g2vh16vgc8j40cj25qfqh0000gn/T/pytest-of-runner/pytest-0/popen-gw0/mc admin policy create myminio/ no-create-buckets /private/var/folders/8j/3c4g2vh16vgc8j40cj25qfqh0000gn/T/pytest-of-runner/pytest-0/popen-gw0/limited-buckets-policy.json
  Return: 0
  Stdout: Created policy `no-create-buckets` successfully.

  Stderr: 
=============================== warnings summary ===============================

@raulcd

raulcd commented Jul 24, 2026

Copy link
Copy Markdown
Member

Error is unrelated, is a flaky timeout with minio:

 >                   raise TimeoutExpired(self.args, timeout)
E                   subprocess.TimeoutExpired: Command '['mc', '-C', '/private/var/folders/8j/3c4g2vh16vgc8j40cj25qfqh0000gn/T/pytest-of-runner/pytest-0/popen-gw0/mc', 'admin', 'policy', 'attach', 'myminio/', 'no-create-buckets', '--user', 'test_dataset_limited_user']' timed out after 10 seconds

/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/subprocess.py:2045: TimeoutExpired

@kou

kou commented Jul 24, 2026

Copy link
Copy Markdown
Member

Could you rebase again for #50587?

@hiroyuki-sato
hiroyuki-sato force-pushed the topic/shellcheck-r_deps branch from fab7f57 to 11523fd Compare July 24, 2026 23:37
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Jul 24, 2026
@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@github-actions crossbow submit -g r

@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@kou @raulcd Thank you for your comment. rebased

@github-actions

Copy link
Copy Markdown

Revision: 11523fd

Submitted crossbow builds: ursacomputing/crossbow @ actions-b355b52d7d

Task Status
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-r-alpine-linux-cran GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-fedora-clang GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-sanitizers GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-m1-san GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-offline-maximal GitHub Actions
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-r-wasm GitHub Actions

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

Labels

awaiting change review Awaiting change review CI: Extra: R Run extra R CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants