fuzz: fold fuzz-util.sh into generate-bins.sh
What changed, and why it matters
This commit is a simple housekeeping change for the project's fuzz-testing scripts. It removes a small helper file (fuzz-util.sh) and copies its functions directly into another script (generate-bins.sh). There is no change to the actual Bitcoin library code, no change to how the software handles data, and no security fix or vulnerability introduced.
No security action needed. Treat as routine repository maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff deletes fuzz/fuzz-util.sh and inlines its three shell functions (listTargetFiles, targetFileToName, plus the LC_ALL=C export) into fuzz/generate-bins.sh. Two other functions from fuzz-util.sh (checkWindowsFiles and checkReport) are dropped entirely. The script still sources generate-encoding-roundtrip.sh and continues generating fuzz target Cargo.toml entries exactly as before. No Rust source, build artifacts, or cryptographic/serialization logic is modified.
Changed components
fuzz/generate-bins.shfuzz/fuzz-util.shInspect captured patch +21 / −48
diff --git a/fuzz/fuzz-util.sh b/fuzz/fuzz-util.sh
deleted file mode 100755
index 5b63de9c..00000000
--- a/fuzz/fuzz-util.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env bash
-
-# Sort order is affected by locale. See `man sort`.
-# > Set LC_ALL=C to get the traditional sort order that uses native byte values.
-export LC_ALL=C
-
-REPO_DIR=$(git rev-parse --show-toplevel)
-
-listTargetFiles() {
- pushd "$REPO_DIR/fuzz" > /dev/null || exit 1
- find fuzz_targets/ -type f -name "*.rs" | sort
- popd > /dev/null || exit 1
-}
-
-targetFileToName() {
- echo "$1" \
- | sed 's/^fuzz_targets\///' \
- | sed 's/\.rs$//' \
- | sed 's/\//_/g' \
- | sed 's/^_//g'
-}
-
-# Utility function to avoid CI failures on Windows
-checkWindowsFiles() {
- incorrectFilenames=$(find . -type f -name "*,*" -o -name "*:*" -o -name "*<*" -o -name "*>*" -o -name "*|*" -o -name "*\?*" -o -name "*\**" -o -name "*\"*" | wc -l)
- if [ "$incorrectFilenames" -gt 0 ]; then
- echo "Bailing early because there is a Windows-incompatible filename in the tree."
- exit 2
- fi
-}
-
-# Checks whether a fuzz case has artifacts, and dumps them in hex
-checkReport() {
- artifactDir="fuzz/artifacts/$1"
- if [ -d "$artifactDir" ] && [ -n "$(ls -A "$artifactDir" 2>/dev/null)" ]; then
- echo "Artifacts found for target: $1"
- for artifact in "$artifactDir"/*; do
- if [ -f "$artifact" ]; then
- echo "Artifact: $(basename "$artifact")"
- xxd -p -c10000 < "$artifact"
- fi
- done
- exit 1
- fi
-}
diff --git a/fuzz/generate-bins.sh b/fuzz/generate-bins.sh
index 96210345..3bb95f2f 100755
--- a/fuzz/generate-bins.sh
+++ b/fuzz/generate-bins.sh
@@ -7,9 +7,27 @@ set -euo pipefail
REPO_DIR=$(git rev-parse --show-toplevel)
-# can't find the file because of the ENV var
-# shellcheck source=/dev/null
-source "$REPO_DIR/fuzz/fuzz-util.sh"
+# Sort order is affected by locale. See `man sort`.
+# > Set LC_ALL=C to get the traditional sort order that uses native byte values.
+export LC_ALL=C
+
+# List all fuzz target files.
+listTargetFiles() {
+ pushd "$REPO_DIR/fuzz" > /dev/null || exit 1
+ find fuzz_targets/ -type f -name "*.rs" | sort
+ popd > /dev/null || exit 1
+}
+
+# Convert fuzz target file path to target name
+# Example: fuzz_targets/bitcoin/deserialize_block.rs -> bitcoin_deserialize_block
+targetFileToName() {
+ echo "$1" \
+ | sed 's/^fuzz_targets\///' \
+ | sed 's/\.rs$//' \
+ | sed 's/\//_/g' \
+ | sed 's/^_//g'
+}
+
source "$REPO_DIR/fuzz/generate-encoding-roundtrip.sh"
CARGO_TOML="$REPO_DIR/fuzz/Cargo.toml"
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.