Skip to content

Commit af1cc5f

Browse files
committed
ci: the overlap check failed on the outcome it was testing for
readelf ... | grep -q ' wl_display_create' && { echo leaked; exit 1; } Under `bash -e` that compound returns non-zero exactly when grep finds NOTHING — which is the passing case — so the step failed whenever the libraries were correctly disjoint. Verified locally: client has wl_display_connect and not wl_display_create, server the reverse, which is what the check exists to prove. Rewritten with explicit `if`, and the symbol match anchored to end-of-line so a longer name cannot satisfy it.
1 parent d265c1c commit af1cc5f

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,25 @@ jobs:
100100
run: |
101101
# Mesa's libEGL_mesa has DT_NEEDED on both; if one carried the other's
102102
# API the process would bind to whichever loaded first.
103+
#
104+
# Written with `if`, not `grep -q … && { exit 1; }`: under `bash -e`
105+
# that compound returns non-zero exactly when grep finds NOTHING —
106+
# which is the outcome we want — and the step fails on success.
103107
c=$(find . -name libwayland-client.so -type f | head -1)
104108
s=$(find . -name libwayland-server.so -type f | head -1)
105-
readelf --dyn-syms -W "$c" | grep -q ' wl_display_connect' || exit 1
106-
readelf --dyn-syms -W "$c" | grep -q ' wl_display_create' && { echo "client leaked the server API"; exit 1; }
107-
readelf --dyn-syms -W "$s" | grep -q ' wl_display_create' || exit 1
108-
readelf --dyn-syms -W "$s" | grep -q ' wl_display_connect' && { echo "server leaked the client API"; exit 1; }
109+
test -n "$c" && test -n "$s" || { echo "::error::a library is missing"; exit 1; }
110+
111+
has() { readelf --dyn-syms -W "$1" | grep -q " $2$"; }
112+
113+
has "$c" wl_display_connect || { echo "::error::client lost wl_display_connect"; exit 1; }
114+
has "$s" wl_display_create || { echo "::error::server lost wl_display_create"; exit 1; }
115+
116+
if has "$c" wl_display_create; then
117+
echo "::error::libwayland-client exports the SERVER api (wl_display_create)"; exit 1
118+
fi
119+
if has "$s" wl_display_connect; then
120+
echo "::error::libwayland-server exports the CLIENT api (wl_display_connect)"; exit 1
121+
fi
109122
echo "client and server APIs are disjoint"
110123
111124
- name: mcpp/generated/ matches what the scanner produces

0 commit comments

Comments
 (0)