From 61342acd677eaf69b582fd9549c558ea96e26435 Mon Sep 17 00:00:00 2001 From: Tomas Rutkauskas Date: Mon, 9 Nov 2026 17:37:21 +0200 Subject: [PATCH] ci: write ConvertApi.class to a file before od reads its version od -N1 stops reading after byte 8, so `unzip -p ... | od` under pipefail has the shape of the tar | grep -q check that failed at random in convertapi-library-js's build on 2026-11-09. It cannot fail on GitHub's runners today: unzip writes the 16 KB class in one write(), and with SIGPIPE ignored, as on the runner, unzip -p ignores EPIPE and exits 0. With a class over 64 KB and the default SIGPIPE disposition it could, so the check now reads a file and depends on neither. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ac874d..a267f79 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,8 +114,11 @@ jobs: for f in "convertapi-$VERSION.jar" "convertapi-$VERSION-sources.jar" "convertapi-$VERSION-javadoc.jar"; do test -f "target/$f" || { echo "::error::target/$f was not built"; exit 1; } done - # Class file major version 52 = Java 8, which the library still supports. - MAJOR=$(unzip -p "target/convertapi-$VERSION.jar" com/convertapi/client/ConvertApi.class | od -An -j7 -N1 -tu1 | tr -d ' ') + # Class file major version 52 = Java 8, which the library still supports. The class goes to a + # file first: od stops reading after byte 8, so unzip piped into it could still be writing (it + # writes 64 KB at a time), get SIGPIPE and fail the step under pipefail. + unzip -p "target/convertapi-$VERSION.jar" com/convertapi/client/ConvertApi.class > "$RUNNER_TEMP/ConvertApi.class" + MAJOR=$(od -An -j7 -N1 -tu1 "$RUNNER_TEMP/ConvertApi.class" | tr -d ' ') [ "$MAJOR" = 52 ] || { echo "::error::The classes are compiled for class file version $MAJOR, not 52 (Java 8)"; exit 1; } echo "version=$VERSION" >> "$GITHUB_OUTPUT"