Skip to content

fix(ci): detect FFI without a grep -q pipe that races under pipefail (#236) - #239

Merged
s2x merged 1 commit into
mainfrom
fix/236-macos-ffi-pipefail
Sep 29, 2026
Merged

s2x merged 1 commit into
mainfrom
fix/236-macos-ffi-pipefail

Conversation

@s2x

@s2x s2x commented Sep 29, 2026

Copy link
Copy Markdown
Member

Root cause

The issue suspected a broken Homebrew php.ini. The real cause is in .github/scripts/run-tests.sh:

set -euo pipefail
elif ! php -n -m | grep -qx FFI; then
    ARGS="$ARGS -d extension=ffi"

grep -q exits on the first match (FFI is line 12 of 71). If php is still writing, it gets SIGPIPE, and pipefail makes the pipeline fail. The script concludes "FFI missing" and adds -d extension=ffi. Homebrew PHP has FFI built in (no ffi.so), so every PHP process prints Unable to load dynamic library 'ffi' (tried: .../ffi.so). That warning lands in every test's output, so 0/191 pass. It is timing-dependent, hence ~50%.

Evidence (macOS, Homebrew PHP 8.5.10)

  • Old check: 169/200 false "FFI missing".
  • php -n -d extension=ffi prints exactly the warning seen in CI.
  • New check (extension_loaded("FFI"), no pipe): 0/200.
  • .github/scripts/run-tests.sh locally: 187 passed, 0 failed, 2 skipped, no warning.

Closes #236

…236)

grep -q exits on the first match; php then gets SIGPIPE and pipefail
reports the pipeline as failed. run-tests.sh took that as "FFI missing"
and added -d extension=ffi, so every PHP process on Homebrew (FFI built
in, no ffi.so) printed a startup warning and every test failed.
Reproduced locally: 169/200 false negatives with the old check, 0/200
with extension_loaded().

Closes #236
@s2x
s2x merged commit 98d3130 into main Sep 29, 2026
6 checks passed
@s2x
s2x deleted the fix/236-macos-ffi-pipefail branch September 29, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): darwin-aarch64 job fails ~50% of runs — every FFI test fails on a broken Homebrew php.ini

1 participant