From af8db02078175e02abffaa4664d3aee0f0cc400d Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Mon, 31 Aug 2026 10:45:50 +0900 Subject: [PATCH 01/13] GH-51090: [CI][C++] Fix shellcheck errors in cpp/build-support/fuzzing/generate_corpuses.sh --- .pre-commit-config.yaml | 8 +--- .../fuzzing/generate_corpuses.sh | 48 +++++++++---------- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9ddf332c57ca..eec8492f8264 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -288,13 +288,7 @@ repos: ( ?^c_glib/.*\.sh$| ?^ci/.*\.sh$| - ?^cpp/build-support/build-lz4-lib\.sh$| - ?^cpp/build-support/build-zstd-lib\.sh$| - ?^cpp/build-support/get-upstream-commit\.sh$| - ?^cpp/build-support/run-test\.sh$| - ?^cpp/build-support/update-flatbuffers\.sh$| - ?^cpp/build-support/update-thrift\.sh$| - ?^cpp/build-support/vendor-flatbuffers\.sh$| + ?^cpp/build-support/.*\.sh$| ?^cpp/examples/minimal_build/run\.sh$| ?^cpp/examples/tutorial_examples/run\.sh$| ?^cpp/src/arrow/flight/sql/odbc/install/mac/postinstall$| diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 07afa793dc6b..81e4b9827b81 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -29,7 +29,7 @@ set -ex CORPUS_DIR=/tmp/corpus PANDAS_DIR=/tmp/pandas -ARROW_ROOT=$(cd $(dirname "$BASH_SOURCE")/../../..; pwd) +ARROW_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd) ARROW_CPP=$ARROW_ROOT/cpp OUT=$1 @@ -42,48 +42,48 @@ OUT=$1 rm -rf ${CORPUS_DIR} ${OUT}/arrow-ipc-generate-fuzz-corpus -stream ${CORPUS_DIR} # Add "golden" IPC integration files -IPC_INTEGRATION_FILES=$(find ${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration -name "*.stream") +IPC_INTEGRATION_FILES=$(find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" -name "*.stream") [ -z "${IPC_INTEGRATION_FILES}" ] && exit 1 # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. -cp --backup=numbered ${IPC_INTEGRATION_FILES} ${CORPUS_DIR} -${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/arrow-ipc-stream-fuzz_seed_corpus.zip +cp --backup=numbered "${IPC_INTEGRATION_FILES}" ${CORPUS_DIR} +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" ${CORPUS_DIR} "${OUT}"/arrow-ipc-stream-fuzz_seed_corpus.zip rm -rf ${CORPUS_DIR} -${OUT}/arrow-ipc-generate-fuzz-corpus -file ${CORPUS_DIR} -IPC_INTEGRATION_FILES=$(find ${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration -name "*.arrow_file") +"${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" +IPC_INTEGRATION_FILES=$(find "${ARROW_ROOT}"/testing/data/arrow-ipc-stream/integration -name "*.arrow_file") [ -z "${IPC_INTEGRATION_FILES}" ] && exit 1 -cp --backup=numbered ${IPC_INTEGRATION_FILES} ${CORPUS_DIR} -${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/arrow-ipc-file-fuzz_seed_corpus.zip +cp --backup=numbered "${IPC_INTEGRATION_FILES}" "${CORPUS_DIR}" +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-file-fuzz_seed_corpus.zip -rm -rf ${CORPUS_DIR} -${OUT}/arrow-ipc-generate-tensor-fuzz-corpus -stream ${CORPUS_DIR} -${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/arrow-ipc-tensor-stream-fuzz_seed_corpus.zip +rm -rf "${CORPUS_DIR}" +"${OUT}/arrow-ipc-generate-tensor-fuzz-corpus -stream" "${CORPUS_DIR}" +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-tensor-stream-fuzz_seed_corpus.zip" # Parquet file-level fuzzer rm -rf ${CORPUS_DIR} -${OUT}/parquet-arrow-generate-fuzz-corpus ${CORPUS_DIR} +"${OUT}/parquet-arrow-generate-fuzz-corpus" "${CORPUS_DIR}" # Add Parquet testing examples -cp ${ARROW_CPP}/submodules/parquet-testing/data/*.parquet ${CORPUS_DIR} -cp ${ARROW_CPP}/submodules/parquet-testing/bad_data/*.parquet ${CORPUS_DIR} -${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/parquet-arrow-fuzz_seed_corpus.zip +cp "${ARROW_CPP}/submodules/parquet-testing/data/*.parquet" "${CORPUS_DIR}" +cp "${ARROW_CPP}/submodules/parquet-testing/bad_data/*.parquet" "${CORPUS_DIR}" +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/parquet-arrow-fuzz_seed_corpus.zip" # Parquet encoding fuzzer rm -rf ${CORPUS_DIR} -${OUT}/parquet-generate-encoding-fuzz-corpus ${CORPUS_DIR} -${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/parquet-encoding-fuzz_seed_corpus.zip +"${OUT}/parquet-generate-encoding-fuzz-corpus" "${CORPUS_DIR}" +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/parquet-encoding-fuzz_seed_corpus.zip" # CSV -rm -rf ${PANDAS_DIR} -git clone --depth=1 https://github.com/pandas-dev/pandas ${PANDAS_DIR} +rm -rf "${PANDAS_DIR}" +git clone --depth=1 https://github.com/pandas-dev/pandas "${PANDAS_DIR}" -rm -rf ${CORPUS_DIR} -${OUT}/arrow-csv-generate-fuzz-corpus ${CORPUS_DIR} +rm -rf "${CORPUS_DIR}" +"${OUT}/arrow-csv-generate-fuzz-corpus" "${CORPUS_DIR}" # Add examples from arrow-testing repo -cp ${ARROW_ROOT}/testing/data/csv/*.csv ${CORPUS_DIR} +cp "${ARROW_ROOT}"/testing/data/csv/*.csv "${CORPUS_DIR}" # Add examples from Pandas test suite -find ${PANDAS_DIR}/ -name "*.csv" -exec cp --backup=numbered '{}' ${CORPUS_DIR} \; -${ARROW_CPP}/build-support/fuzzing/pack_corpus.py ${CORPUS_DIR} ${OUT}/arrow-csv-fuzz_seed_corpus.zip +find "${PANDAS_DIR}/" -name "*.csv" -exec cp --backup=numbered '{}' "${CORPUS_DIR}" \; +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-csv-fuzz_seed_corpus.zip" From 5de572f69a403facc95792d62f3cf58885bfa459 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Mon, 31 Aug 2026 10:57:53 +0900 Subject: [PATCH 02/13] GH-51090: [CI][C++] Fix shellcheck errors in cpp/build-support/fuzzing/generate_corpuses.sh --- cpp/build-support/fuzzing/generate_corpuses.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 81e4b9827b81..9fe28f3912ad 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -39,17 +39,17 @@ OUT=$1 # Arrow IPC -rm -rf ${CORPUS_DIR} -${OUT}/arrow-ipc-generate-fuzz-corpus -stream ${CORPUS_DIR} +rm -rf "${CORPUS_DIR}" +"${OUT}/arrow-ipc-generate-fuzz-corpus" -stream "${CORPUS_DIR}" # Add "golden" IPC integration files IPC_INTEGRATION_FILES=$(find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" -name "*.stream") [ -z "${IPC_INTEGRATION_FILES}" ] && exit 1 # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. -cp --backup=numbered "${IPC_INTEGRATION_FILES}" ${CORPUS_DIR} -"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" ${CORPUS_DIR} "${OUT}"/arrow-ipc-stream-fuzz_seed_corpus.zip +cp --backup=numbered "${IPC_INTEGRATION_FILES}" "${CORPUS_DIR}" +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-stream-fuzz_seed_corpus.zip -rm -rf ${CORPUS_DIR} +rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" IPC_INTEGRATION_FILES=$(find "${ARROW_ROOT}"/testing/data/arrow-ipc-stream/integration -name "*.arrow_file") [ -z "${IPC_INTEGRATION_FILES}" ] && exit 1 @@ -62,11 +62,11 @@ rm -rf "${CORPUS_DIR}" # Parquet file-level fuzzer -rm -rf ${CORPUS_DIR} +rm -rf "${CORPUS_DIR}" "${OUT}/parquet-arrow-generate-fuzz-corpus" "${CORPUS_DIR}" # Add Parquet testing examples -cp "${ARROW_CPP}/submodules/parquet-testing/data/*.parquet" "${CORPUS_DIR}" -cp "${ARROW_CPP}/submodules/parquet-testing/bad_data/*.parquet" "${CORPUS_DIR}" +cp "${ARROW_CPP}"/submodules/parquet-testing/data/*.parquet "${CORPUS_DIR}" +cp "${ARROW_CPP}"/submodules/parquet-testing/bad_data/*.parquet "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/parquet-arrow-fuzz_seed_corpus.zip" # Parquet encoding fuzzer From f6caadac6eaa599c3fef53fd828ed3ccce89a210 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Tue, 1 Sep 2026 14:02:01 +0900 Subject: [PATCH 03/13] Use array --- cpp/build-support/fuzzing/generate_corpuses.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 9fe28f3912ad..d6d1db1d8e83 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -42,18 +42,24 @@ OUT=$1 rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -stream "${CORPUS_DIR}" # Add "golden" IPC integration files -IPC_INTEGRATION_FILES=$(find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" -name "*.stream") -[ -z "${IPC_INTEGRATION_FILES}" ] && exit 1 +mapfile -d '' IPC_INTEGRATION_FILES < <( + find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ + -name "*.stream" -print0 +) +[ -z "${IPC_INTEGRATION_FILES[@]}" ] && exit 1 # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. -cp --backup=numbered "${IPC_INTEGRATION_FILES}" "${CORPUS_DIR}" +cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-stream-fuzz_seed_corpus.zip rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" -IPC_INTEGRATION_FILES=$(find "${ARROW_ROOT}"/testing/data/arrow-ipc-stream/integration -name "*.arrow_file") -[ -z "${IPC_INTEGRATION_FILES}" ] && exit 1 -cp --backup=numbered "${IPC_INTEGRATION_FILES}" "${CORPUS_DIR}" +mapfile -d '' IPC_INTEGRATION_FILES < <( + find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ + -name "*.arrow_file" -print0 +) +[ -z "${IPC_INTEGRATION_FILES[@]}" ] && exit 1 +cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-file-fuzz_seed_corpus.zip rm -rf "${CORPUS_DIR}" From b3f458c0bdc6d5ff5d04ed01738b4e5236807180 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Tue, 1 Sep 2026 14:16:55 +0900 Subject: [PATCH 04/13] Fix SC2198 --- cpp/build-support/fuzzing/generate_corpuses.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index d6d1db1d8e83..1d7a79d402d5 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -46,7 +46,7 @@ mapfile -d '' IPC_INTEGRATION_FILES < <( find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ -name "*.stream" -print0 ) -[ -z "${IPC_INTEGRATION_FILES[@]}" ] && exit 1 +[ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" @@ -58,7 +58,7 @@ mapfile -d '' IPC_INTEGRATION_FILES < <( find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ -name "*.arrow_file" -print0 ) -[ -z "${IPC_INTEGRATION_FILES[@]}" ] && exit 1 +[ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-file-fuzz_seed_corpus.zip From a9f358f06cf89edf392623f8c9040f2cfe91ab13 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Tue, 1 Sep 2026 14:40:29 +0900 Subject: [PATCH 05/13] fix invalid quote --- cpp/build-support/fuzzing/generate_corpuses.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 1d7a79d402d5..e18443051257 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -63,7 +63,7 @@ cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-file-fuzz_seed_corpus.zip rm -rf "${CORPUS_DIR}" -"${OUT}/arrow-ipc-generate-tensor-fuzz-corpus -stream" "${CORPUS_DIR}" +"${OUT}/arrow-ipc-generate-tensor-fuzz-corpus" -stream "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-tensor-stream-fuzz_seed_corpus.zip" # Parquet file-level fuzzer From 47b45b59bfe0c2467a272b48539800929d907049 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Tue, 1 Sep 2026 15:32:52 +0900 Subject: [PATCH 06/13] Add comment --- cpp/build-support/fuzzing/generate_corpuses.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index e18443051257..2bc1f74626e4 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -42,10 +42,12 @@ OUT=$1 rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -stream "${CORPUS_DIR}" # Add "golden" IPC integration files +# Store the files found by the find command in an array. mapfile -d '' IPC_INTEGRATION_FILES < <( find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ -name "*.stream" -print0 ) +# Exit with an error if find returns no files. [ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. @@ -54,10 +56,12 @@ cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" +# Store the files found by the find command in an array. mapfile -d '' IPC_INTEGRATION_FILES < <( find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ -name "*.arrow_file" -print0 ) +# Exit with an error if find returns no files. [ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-file-fuzz_seed_corpus.zip From c22d5464f8e26bc316e519205bc517c703fede27 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Tue, 1 Sep 2026 16:08:06 +0900 Subject: [PATCH 07/13] fix quote --- cpp/build-support/fuzzing/generate_corpuses.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 2bc1f74626e4..38f40a713dfc 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -52,7 +52,7 @@ mapfile -d '' IPC_INTEGRATION_FILES < <( # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" -"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-stream-fuzz_seed_corpus.zip +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-stream-fuzz_seed_corpus.zip" rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" @@ -64,7 +64,7 @@ mapfile -d '' IPC_INTEGRATION_FILES < <( # Exit with an error if find returns no files. [ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" -"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}"/arrow-ipc-file-fuzz_seed_corpus.zip +"${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-file-fuzz_seed_corpus.zip" rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-tensor-fuzz-corpus" -stream "${CORPUS_DIR}" From 3a17d27cfc87ff4da9df91c5cbf2fa669e2f317e Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Sun, 6 Sep 2026 21:58:43 +0900 Subject: [PATCH 08/13] Use shell glob instead of find command --- .../fuzzing/generate_corpuses.sh | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 38f40a713dfc..2f14f8af964c 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -41,29 +41,27 @@ OUT=$1 rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -stream "${CORPUS_DIR}" + +IPC_INTEGRATION_DIR="${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" + # Add "golden" IPC integration files -# Store the files found by the find command in an array. -mapfile -d '' IPC_INTEGRATION_FILES < <( - find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ - -name "*.stream" -print0 -) -# Exit with an error if find returns no files. -[ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. -cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" +# Use shell globbing to keep this ShellCheck-safe and compatible with Bash 3.2 on macOS. +# IPC integration files are expected to be directly under each subdirectory. +cp --backup=numbered \ + "${IPC_INTEGRATION_DIR}"/*/*.stream \ + "${CORPUS_DIR}" + "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-stream-fuzz_seed_corpus.zip" rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" -# Store the files found by the find command in an array. -mapfile -d '' IPC_INTEGRATION_FILES < <( - find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ - -name "*.arrow_file" -print0 -) -# Exit with an error if find returns no files. -[ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 -cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" + +cp --backup=numbered \ + "${IPC_INTEGRATION_DIR}"/*/*.arrow_file \ + "${CORPUS_DIR}" + "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-file-fuzz_seed_corpus.zip" rm -rf "${CORPUS_DIR}" From 7cec9c64b3e584d0fa755c0ff6eb012aebab0cba Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Mon, 7 Sep 2026 09:20:29 +0900 Subject: [PATCH 09/13] Revert "Use shell glob instead of find command" This reverts commit 3a17d27cfc87ff4da9df91c5cbf2fa669e2f317e. --- .../fuzzing/generate_corpuses.sh | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 2f14f8af964c..38f40a713dfc 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -41,27 +41,29 @@ OUT=$1 rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -stream "${CORPUS_DIR}" - -IPC_INTEGRATION_DIR="${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" - # Add "golden" IPC integration files +# Store the files found by the find command in an array. +mapfile -d '' IPC_INTEGRATION_FILES < <( + find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ + -name "*.stream" -print0 +) +# Exit with an error if find returns no files. +[ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. -# Use shell globbing to keep this ShellCheck-safe and compatible with Bash 3.2 on macOS. -# IPC integration files are expected to be directly under each subdirectory. -cp --backup=numbered \ - "${IPC_INTEGRATION_DIR}"/*/*.stream \ - "${CORPUS_DIR}" - +cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-stream-fuzz_seed_corpus.zip" rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" - -cp --backup=numbered \ - "${IPC_INTEGRATION_DIR}"/*/*.arrow_file \ - "${CORPUS_DIR}" - +# Store the files found by the find command in an array. +mapfile -d '' IPC_INTEGRATION_FILES < <( + find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ + -name "*.arrow_file" -print0 +) +# Exit with an error if find returns no files. +[ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 +cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-file-fuzz_seed_corpus.zip" rm -rf "${CORPUS_DIR}" From baf318541beae63a7c24fdac4c9d3054cc5536b2 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Mon, 7 Sep 2026 09:27:05 +0900 Subject: [PATCH 10/13] Use while .. read --- cpp/build-support/fuzzing/generate_corpuses.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 38f40a713dfc..23da9fedeede 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -42,9 +42,12 @@ OUT=$1 rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -stream "${CORPUS_DIR}" # Add "golden" IPC integration files -# Store the files found by the find command in an array. -mapfile -d '' IPC_INTEGRATION_FILES < <( - find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ +# Use read instead of mapfile to keep this compatible with Bash 3.2 on macOS. +IPC_INTEGRATION_FILES=() +while IFS= read -r -d '' IPC_INTEGRATION_FILE; do + IPC_INTEGRATION_FILES+=("${IPC_INTEGRATION_FILE}") +done < <( + find "${IPC_INTEGRATION_DIR}" \ -name "*.stream" -print0 ) # Exit with an error if find returns no files. @@ -56,9 +59,12 @@ cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" -# Store the files found by the find command in an array. -mapfile -d '' IPC_INTEGRATION_FILES < <( - find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ + +IPC_INTEGRATION_FILES=() +while IFS= read -r -d '' IPC_INTEGRATION_FILE; do + IPC_INTEGRATION_FILES+=("${IPC_INTEGRATION_FILE}") +done < <( + find "${IPC_INTEGRATION_DIR}" \ -name "*.arrow_file" -print0 ) # Exit with an error if find returns no files. From ddb09076d1bb121ef1111692bcaf4b33004633de Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Mon, 7 Sep 2026 09:32:12 +0900 Subject: [PATCH 11/13] Fix missing variable --- cpp/build-support/fuzzing/generate_corpuses.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 23da9fedeede..844f12fdaf8e 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -47,7 +47,7 @@ IPC_INTEGRATION_FILES=() while IFS= read -r -d '' IPC_INTEGRATION_FILE; do IPC_INTEGRATION_FILES+=("${IPC_INTEGRATION_FILE}") done < <( - find "${IPC_INTEGRATION_DIR}" \ + find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ -name "*.stream" -print0 ) # Exit with an error if find returns no files. @@ -64,7 +64,7 @@ IPC_INTEGRATION_FILES=() while IFS= read -r -d '' IPC_INTEGRATION_FILE; do IPC_INTEGRATION_FILES+=("${IPC_INTEGRATION_FILE}") done < <( - find "${IPC_INTEGRATION_DIR}" \ + find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ -name "*.arrow_file" -print0 ) # Exit with an error if find returns no files. From 354d28a886c5d04ce08ad62e370e276ee142c449 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Mon, 7 Sep 2026 10:46:06 +0900 Subject: [PATCH 12/13] Remove find result check --- cpp/build-support/fuzzing/generate_corpuses.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index 844f12fdaf8e..fdcfbdacc894 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -50,8 +50,6 @@ done < <( find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ -name "*.stream" -print0 ) -# Exit with an error if find returns no files. -[ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" @@ -67,8 +65,6 @@ done < <( find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ -name "*.arrow_file" -print0 ) -# Exit with an error if find returns no files. -[ "${#IPC_INTEGRATION_FILES[@]}" -eq 0 ] && exit 1 cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-file-fuzz_seed_corpus.zip" From 700bf788d9a917aecc6ec2af4079197ec772929d Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Mon, 7 Sep 2026 13:35:58 +0900 Subject: [PATCH 13/13] Remove while..read --- .../fuzzing/generate_corpuses.sh | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/cpp/build-support/fuzzing/generate_corpuses.sh b/cpp/build-support/fuzzing/generate_corpuses.sh index fdcfbdacc894..2d95e110b516 100755 --- a/cpp/build-support/fuzzing/generate_corpuses.sh +++ b/cpp/build-support/fuzzing/generate_corpuses.sh @@ -42,30 +42,21 @@ OUT=$1 rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -stream "${CORPUS_DIR}" # Add "golden" IPC integration files -# Use read instead of mapfile to keep this compatible with Bash 3.2 on macOS. -IPC_INTEGRATION_FILES=() -while IFS= read -r -d '' IPC_INTEGRATION_FILE; do - IPC_INTEGRATION_FILES+=("${IPC_INTEGRATION_FILE}") -done < <( - find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ - -name "*.stream" -print0 -) # Several IPC integration files can have the same name, make sure # they all appear in the corpus by numbering the duplicates. -cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" +find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ + -name "*.stream" \ + -exec cp --backup=numbered '{}' "${CORPUS_DIR}" \; + "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-stream-fuzz_seed_corpus.zip" rm -rf "${CORPUS_DIR}" "${OUT}/arrow-ipc-generate-fuzz-corpus" -file "${CORPUS_DIR}" -IPC_INTEGRATION_FILES=() -while IFS= read -r -d '' IPC_INTEGRATION_FILE; do - IPC_INTEGRATION_FILES+=("${IPC_INTEGRATION_FILE}") -done < <( - find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ - -name "*.arrow_file" -print0 -) -cp --backup=numbered "${IPC_INTEGRATION_FILES[@]}" "${CORPUS_DIR}" +find "${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration" \ + -name "*.arrow_file" \ + -exec cp --backup=numbered '{}' "${CORPUS_DIR}" \; + "${ARROW_CPP}/build-support/fuzzing/pack_corpus.py" "${CORPUS_DIR}" "${OUT}/arrow-ipc-file-fuzz_seed_corpus.zip" rm -rf "${CORPUS_DIR}"