From 11ef1715abdf10ea610dd86368955d7ecd17efdd Mon Sep 17 00:00:00 2001 From: Marc Villain Date: Thu, 15 Oct 2026 08:03:53 +0200 Subject: [PATCH] build: count files without a failing arithmetic command Under set -e, ((n++)) with n at 0 evaluates to 0 and exits the script. Bash 3.2 on macOS ignores that case, so local builds passed while the release runner's bash 5 stopped silently on the first file. --- tools/build.sh | 2 +- tools/test.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/build.sh b/tools/build.sh index 0cdee00..3f33b62 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -51,7 +51,7 @@ for filename in "${BUILD_FILES[@]}"; do if [ -f "$filepath" ]; then cat "$filepath" >> "$OUTPUT" echo "" >> "$OUTPUT" - ((file_count++)) + file_count=$((file_count + 1)) else echo "Warning: $filename not found, skipping" >&2 fi diff --git a/tools/test.sh b/tools/test.sh index 889dbd5..b368bfb 100755 --- a/tools/test.sh +++ b/tools/test.sh @@ -45,7 +45,7 @@ for test_file in "$TEST_DIR"/[0-9][0-9]_*.sql; do [ -f "$test_file" ] || continue test_name=$(basename "$test_file" .sql) - ((total_files++)) + total_files=$((total_files + 1)) output=$(psql -U "$PG_USER" -d "$DB" -f "$test_file" 2>&1) exit_code=$? @@ -59,7 +59,7 @@ for test_file in "$TEST_DIR"/[0-9][0-9]_*.sql; do total_fail=$((total_fail + file_fail)) if [ $exit_code -ne 0 ] || [ "$file_fail" -gt 0 ] || [ "$file_errors" -gt 0 ]; then - ((failed_files++)) + failed_files=$((failed_files + 1)) echo " [FAIL] $test_name — ${file_pass} passed, ${file_fail} failed, ${file_errors} SQL error(s)" # Print only failing lines for a focused view if [ "$file_errors" -gt 0 ]; then @@ -69,7 +69,7 @@ for test_file in "$TEST_DIR"/[0-9][0-9]_*.sql; do echo "$output" | grep "CHECK FAIL:" | sed 's/^/ /' fi else - ((passed_files++)) + passed_files=$((passed_files + 1)) echo " [PASS] $test_name — ${file_pass} assertion(s) passed" fi done