Skip to content

Commit a4c3ee8

Browse files
committed
Sort find output in build-web-db.sh so the bake is byte-reproducible across CI runs
1 parent 15eb0cc commit a4c3ee8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/build-web-db.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ export TEMP_FILE
9595
BASE_DIR=$(cd "$BASE_DIR" && pwd)
9696
echo "Using base directory: $BASE_DIR"
9797

98-
# Find all files recursively (excluding the lib/ build directory) and process them
99-
find "$BASE_DIR" -type f -not -path "*/lib/*" -exec bash -c 'process_file "$0"' {} \;
98+
# Find all files recursively (excluding the lib/ build directory) and process them.
99+
# Sort for reproducible byte-identical output across runs (find traversal order is filesystem-dependent).
100+
find "$BASE_DIR" -type f -not -path "*/lib/*" | LC_ALL=C sort | while read -r f; do process_file "$f"; done
100101

101102
# Remove temporary file
102103
rm -f "$TEMP_FILE"
@@ -107,8 +108,8 @@ cat >> "$OUTPUT_FILE" << 'EOF'
107108
void initialize() {
108109
EOF
109110

110-
# Add each file to the map
111-
find "$BASE_DIR" -type f -not -path "*/lib/*" | while read -r file; do
111+
# Add each file to the map (sorted for reproducible output)
112+
find "$BASE_DIR" -type f -not -path "*/lib/*" | LC_ALL=C sort | while read -r file; do
112113
relative_path="${file#$BASE_DIR/}"
113114
# Skip files outside BASE_DIR
114115
if [ "$relative_path" = "$file" ]; then

0 commit comments

Comments
 (0)