Skip to content

Commit e29ff91

Browse files
committed
scripts: fix crl-gen-openssl.test false failure with pipefail
The revoked-cert verification check uses `echo "$var" | grep -q` to look for "revoked" or "error 23" in the openssl verify output. With `set -o pipefail`, when grep -q finds the pattern and exits early, echo may fail writing to the closed pipe (SIGPIPE/EPIPE, exit 141 or 1). pipefail reports the pipeline status as that non-zero code from echo, even though grep matched successfully. The `!` negation then treats this as success (pattern not found), causing the test to incorrectly report failure. Replace echo|grep pipelines with bash [[ ]] glob pattern matching, which avoids pipes entirely and is immune to this interaction. Signed-off-by: Sameeh Jubran <sameeh@wolfssl.com>
1 parent 679b0ec commit e29ff91

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/crl-gen-openssl.test

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ check_crl() {
9797
verify_rc=${verify_rc:-0}
9898
# Normalize to avoid case/CR differences and accept common OpenSSL error
9999
# formats (some builds report only an error code).
100-
verify_out_norm=$(printf '%s' "$verify_out" | tr '[:upper:]' '[:lower:]' | \
100+
# Use bash pattern matching instead of echo|grep to avoid broken-pipe
101+
# failures with pipefail when grep -q exits early.
102+
verify_out_norm=$(printf '%s\n' "$verify_out" | tr '[:upper:]' '[:lower:]' | \
101103
tr -d '\r')
102-
if ! echo "$verify_out_norm" | grep -q "revoked" && \
103-
! echo "$verify_out_norm" | grep -q "error 23"; then
104+
if [[ "$verify_out_norm" != *revoked* ]] && \
105+
[[ "$verify_out_norm" != *"error 23"* ]]; then
104106
echo "expected revoked verification failure for $label CRL"
105107
echo "$verify_out"
106108
return 1

0 commit comments

Comments
 (0)