Skip to content

GH-46673: [CI][R][Docs] Accept empty INSTALL_ARGS again - #46682

Merged
kou merged 7 commits into
apache:mainfrom
hiroyuki-sato:topic/fix-r-doc-build
Jun 3, 2025
Merged

kou merged 7 commits into
apache:mainfrom
hiroyuki-sato:topic/fix-r-doc-build

Conversation

@hiroyuki-sato

@hiroyuki-sato hiroyuki-sato commented Jun 3, 2025 •

Copy link
Copy Markdown
Collaborator

Rationale for this change

This PR fixes the bug introduced in #46527.

If the environment variable INSTALL_ARGS doesn't set,
the R command should execute,
CMD INSTALL arrow*tar.gz.

After #46527 change, It executed
CMD INSTALL '' arrow*tar.gz

What changes are included in this PR?

Split INSTALL_ARGS to R_INSTALL_ARGS as array and use "${R_INSTALL_ARGS[@]}".

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@github-actions

github-actions Bot commented Jun 3, 2025

Copy link
Copy Markdown

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

@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@github-actions crossbow submit debian-docs

@github-actions

github-actions Bot commented Jun 3, 2025

Copy link
Copy Markdown
Unable to match any tasks for `debian-docs`
The Archery job run can be found at: https://github.com/apache/arrow/actions/runs/15406293591

@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@github-actions crossbow submit preview-docs

@github-actions

github-actions Bot commented Jun 3, 2025

Copy link
Copy Markdown

Revision: 224c19b

Submitted crossbow builds: ursacomputing/crossbow @ actions-29b57edaf2

Task Status
preview-docs GitHub Actions

Comment thread ci/scripts/r_build.sh Resolved
Comment thread ci/scripts/r_build.sh Outdated
Comment on lines +27 to +31
if [ -z "${INSTALL_ARGS}" ] ; then
R_INSTALL_ARGS=()
else
read -r -a R_INSTALL_ARGS <<< "$INSTALL_ARGS"
fi

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.

Can we simplify this?

Suggested change
if [ -z "${INSTALL_ARGS}" ] ; then
R_INSTALL_ARGS=()
else
read -r -a R_INSTALL_ARGS <<< "$INSTALL_ARGS"
fi
R_INSTALL_ARGS=()
for arg in ${INSTALL_ARGS}; do
R_INSTALL_ARGS+=("${arg}")
done

@hiroyuki-sato hiroyuki-sato Jun 3, 2025 •

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.

for arg in ${INSTALL_ARGS}; violates SC2153.

for arg in ${INSTALL_ARGS}; do
           ^-------------^ SC2153 (info): Possible misspelling: INSTALL_ARGS may not be assigned. Did you mean R_INSTALL_ARGS?

For more information:
  https://www.shellcheck.net/wiki/SC2153 -- Possible misspelling: INSTALL_ARG...

Do we disable SC2153 check?

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.

Can we use ${INSTALL_ARGS:-}?

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.

Thanks! Thanks! I did simplified read -r -a R_INSTALL_ARGS <<< "${INSTALL_ARGS:-}".

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.

If you want to use read -r -a <<<, we must add a comment why this words. Because it's not a straightforward way for us. If we use straitforword for + +=, we don't need a comment.

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.

Thanks! I don't know hot to do it with for and += with SC2086 safe. So, I added the comment.

@kou kou Jun 3, 2025 •

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.

SC2086? https://www.shellcheck.net/wiki/SC2086 ?

Could you share the full lint error?

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.

Thank you for your comment.

Suggested change violates SC2153.

#!/bin/bash

R_INSTALL_ARGS=()
for arg in ${INSTALL_ARGS}; do
  R_INSTALL_ARGS+=("${arg}")
done
for arg in ${INSTALL_ARGS}; do
           ^-------------^ SC2153 (info): Possible misspelling: INSTALL_ARGS may not be assigned. Did you mean R_INSTALL_ARGS?

SC2153 can fix like this.

: "${INSTALL_ARGS:-}"

R_INSTALL_ARGS=()
for arg in ${INSTALL_ARGS}; do
  R_INSTALL_ARGS+=("${arg}")
done

This version doesn't violate shellcheck on my machine.
But, I want to quote ${INSTALL_ARGS} part.
It seems violates SC2086(need quoting).
(I don't know why this syntax passed shellcheck, by the way)
However It doesn't work well.

So, If we use this plan, I think the comment may help.

: "${INSTALL_ARGS:-}"

R_INSTALL_ARGS=()
# Do not Quote ${INSTALL_ARGS} like "${INSTALL_ARGS}"
for arg in ${INSTALL_ARGS}; do
  R_INSTALL_ARGS+=("${arg}")
done

I don't know how to fix ${INSTALL_ARGS} part SC2086 safe.

SC2086 meant about the original code.

Before #46663, The original message was

In ci/scripts/r_build.sh line 45:
      ${R_BIN} CMD INSTALL ${INSTALL_ARGS} arrow*.tar.gz
      ^------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                           ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

read -r -a R_INSTALL_ARGS <<< "$INSTALL_ARGS" has unfamiliar syntax, but it is SC2086 safe.

I support your decision. Should we change for syntax?

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.

This version doesn't violate shellcheck on my machine.
But, I want to quote ${INSTALL_ARGS} part.
It seems violates SC2086(need quoting).
(I don't know why this syntax passed shellcheck, by the way)
However It doesn't work well.

If ShellCheck doesn't report this usage as an error, there is not a problem. Why do you want to quote this case too?

BTW, we don't need : "${INSTALL_ARGS:-}". We can do it in for: for arg in ${INSTALL_ARGS:-}; do

If we want to care glob here, we can disable glob for INSTALL_ARGS="--X * --Y" by set -f:

R_INSTALL_ARGS=()
set -f
for arg in ${INSTALL_ARGS:-}; do
  R_INSTALL_ARGS+=("${arg}")
done
set +f

But it's also unfamiliar syntax. If we want to use set -f too, there is no advantage than read.

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.

Thank you for your reply. Changed to for syntax.

I just wanted to avoid unnecessary modification accidentally.
I'm now quoting many variables for fixing SC2086.
I'll compare shellcheck carefully for avoid unnecessary quote.

r_buld.sh already passed shellcheck. So, I may don't need care.

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@github-actions crossbow submit preview-docs

@github-actions

github-actions Bot commented Jun 3, 2025

Copy link
Copy Markdown

Revision: c8a2a1c

Submitted crossbow builds: ursacomputing/crossbow @ actions-0d4aee9e28

Task Status
preview-docs GitHub Actions

@kou

kou commented Jun 3, 2025

Copy link
Copy Markdown
Member

Could you update "What changes are included in this PR?" in the PR description?
The current content should be for "Rationale for this change" not "What changes are included in this PR?".

@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

Thanks! Updated PR description.

@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@github-actions crossbow submit preview-docs

@github-actions

github-actions Bot commented Jun 3, 2025

Copy link
Copy Markdown

Revision: fe6b479

Submitted crossbow builds: ursacomputing/crossbow @ actions-699fc50655

Task Status
preview-docs GitHub Actions

@kou kou changed the title GH-46673: [CI][R][Docs] Set empty INSTALL_ARGS options as default GH-46673: [CI][R][Docs] Accept empty INSTALL_ARGS again Jun 3, 2025

@kou kou left a comment

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.

+1

@kou
kou merged commit 35e8136 into apache:main Jun 3, 2025
@conbench-apache-arrow

Copy link
Copy Markdown

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

There were 69 benchmark results with an error:

There were no benchmark performance regressions. 🎉

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

@hiroyuki-sato
hiroyuki-sato deleted the topic/fix-r-doc-build branch June 14, 2025 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants