From c23f38cb3077a5129b7997c650986239b037c1b3 Mon Sep 17 00:00:00 2001 From: sirius Date: Fri, 18 Sep 2026 17:04:35 -0400 Subject: [PATCH] android-ci: fix the cuprate marker gate failing its own green build Run 406 built the APK successfully (BUILD SUCCESSFUL in 44m 7s) and the gate then reported "the cuprate-daemon feature is NOT in this APK" while the line above it printed `target_max_memory` **5** times. The bug is the classic one: strings -a x.so | grep -q pattern # under `set -o pipefail` `grep -q` exits at the first match and closes the pipe; `strings` takes SIGPIPE (141) and pipefail makes the pipeline status non-zero, so `if ! ...` ran. The count is captured into a variable now (grep -c reads the whole stream, no SIGPIPE) and the gate fails on `< 1`, which is what it always meant. --- .forgejo/workflows/android-ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/android-ci.yml b/.forgejo/workflows/android-ci.yml index 1ec5565..bed8806 100644 --- a/.forgejo/workflows/android-ci.yml +++ b/.forgejo/workflows/android-ci.yml @@ -184,8 +184,13 @@ jobs: # claims to. A missing marker fails the job: an APK whose on-device node # can only fail is the regression this gate exists to catch. unzip -p "$apk" "lib/$abi/libonionwire_sdk.so" > /tmp/libonionwire_sdk.so - strings -a /tmp/libonionwire_sdk.so | grep -c 'target_max_memory' || true - if ! strings -a /tmp/libonionwire_sdk.so | grep -q 'target_max_memory'; then + # `grep -c`, deliberately not `grep -q`: under `set -o pipefail` a `-q` + # match closes the pipe early, `strings` dies on SIGPIPE (141), and the + # pipeline then reports failure even though the marker was there — this + # gate failed its own green build once that way. + marker="$(strings -a /tmp/libonionwire_sdk.so | grep -c 'target_max_memory' || true)" + echo "target_max_memory occurrences: ${marker:-0}" + if [ "${marker:-0}" -lt 1 ]; then echo "lib/$abi/libonionwire_sdk.so carries no cuprated config string: the cuprate-daemon feature is NOT in this APK" >&2 exit 1 fi