hiroyuki-sato commented on code in PR #51091:
URL: https://github.com/apache/arrow/pull/51091#discussion_r3945880844
##########
cpp/build-support/fuzzing/generate_corpuses.sh:
##########
@@ -39,51 +39,59 @@ 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}"
+
+IPC_INTEGRATION_DIR="${ARROW_ROOT}/testing/data/arrow-ipc-stream/integration"
+
# 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
+# 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}"
Review Comment:
Thank you for your review. Change to use `while` .. `read` instead of glob
like the following
```bash
# 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
)
# 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}"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]