Skip to content

GH-50917: [C++] Fix shellcheck errors in cpp/build-support/*-flatbuffers.sh - #50918

Merged
kou merged 2 commits into
apache:mainfrom
hiroyuki-sato:topic/shellcheck-cpp-build-flatbuffers
Aug 20, 2026
Merged

GH-50917: [C++] Fix shellcheck errors in cpp/build-support/*-flatbuffers.sh#50918
kou merged 2 commits into
apache:mainfrom
hiroyuki-sato:topic/shellcheck-cpp-build-flatbuffers

Conversation

@hiroyuki-sato

@hiroyuki-sato hiroyuki-sato commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Rationale for this change

This is the sub issue #44748.

  • SC2034: foo appears unused. Verify it or export it.
  • SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting).
  • SC2086: Double quote to prevent globbing and word splitting.
shellcheck cpp/build-support/*flatbuffer*.sh

In cpp/build-support/update-flatbuffers.sh line 27:
PYTHON_SOURCE_DIR="$CWD/../../python"
^---------------^ SC2034 (warning): PYTHON_SOURCE_DIR appears unused. Verify use (or export if used externally).


In cpp/build-support/update-flatbuffers.sh line 29:
TOP="$FORMAT_DIR/.."
^-^ SC2034 (warning): TOP appears unused. Verify use (or export if used externally).


In cpp/build-support/update-flatbuffers.sh line 33:
FILES=($(find $FORMAT_DIR -name '*.fbs'))
       ^-- SC2207 (warning): Prefer mapfile or read -a to split command output (or quote to avoid splitting).
              ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
FILES=($(find "$FORMAT_DIR" -name '*.fbs'))


In cpp/build-support/vendor-flatbuffers.sh line 28:
mkdir -p $VENDOR_LOCATION
         ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
mkdir -p "$VENDOR_LOCATION"


In cpp/build-support/vendor-flatbuffers.sh line 29:
cp -f $FLATBUFFERS_HOME/include/flatbuffers/base.h $VENDOR_LOCATION
      ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                   ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp -f "$FLATBUFFERS_HOME"/include/flatbuffers/base.h "$VENDOR_LOCATION"


In cpp/build-support/vendor-flatbuffers.sh line 30:
cp -f $FLATBUFFERS_HOME/include/flatbuffers/flatbuffers.h $VENDOR_LOCATION
      ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                          ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp -f "$FLATBUFFERS_HOME"/include/flatbuffers/flatbuffers.h "$VENDOR_LOCATION"


In cpp/build-support/vendor-flatbuffers.sh line 31:
cp -f $FLATBUFFERS_HOME/include/flatbuffers/stl_emulation.h $VENDOR_LOCATION
      ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting.
                                                            ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cp -f "$FLATBUFFERS_HOME"/include/flatbuffers/stl_emulation.h "$VENDOR_LOCATION"

For more information:
  https://www.shellcheck.net/wiki/SC2034 -- PYTHON_SOURCE_DIR appears unused....
  https://www.shellcheck.net/wiki/SC2207 -- Prefer mapfile or read -a to spli...
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...

What changes are included in this PR?

  • SC2034: Comment out unused variables
  • SC2207: Populate arrays without command substitution
  • SC2086: Quote variables

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@hiroyuki-sato
hiroyuki-sato requested a review from raulcd as a code owner August 20, 2026 05:03
@github-actions

Copy link
Copy Markdown

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

@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

@kou As I mentioned before, these files are not referenced anywhere in this project. Could you tell me how to test it?

@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.

See:

# Run this from cpp/ directory. flatc is expected to be in your path

# Run this from cpp/ directory with $FLATBUFFERS_HOME set to location of your
# Flatbuffers installation

Comment thread cpp/build-support/update-flatbuffers.sh Outdated
@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Aug 20, 2026
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Aug 20, 2026
@hiroyuki-sato

Copy link
Copy Markdown
Collaborator Author

Thanks.

I confirmed this change by running the following commands in the cpp directoy.

./build-support/update-flatbuffers.sh
FLATBUFFERS_HOME=/opt/homebrew/Cellar/flatbuffers/25.12.19/ ./build-support/vendor-flatbuffers.sh

@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 2c35b59 into apache:main Aug 20, 2026
55 of 57 checks passed
@kou kou removed the awaiting change review Awaiting change review label Aug 20, 2026
@github-actions github-actions Bot added the awaiting merge Awaiting merge label Aug 20, 2026
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 2c35b59.

There were no benchmark performance regressions. 🎉

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

@hiroyuki-sato
hiroyuki-sato deleted the topic/shellcheck-cpp-build-flatbuffers branch August 21, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants