Commit fe4bac7089 for openssl.org

commit fe4bac708936f17c74aa2aa60279ed0d8f76dab9
Author: slontis <shane.lontis@oracle.com>
Date:   Thu Nov 19 12:21:57 2026 +1100

    test/recipes/82-test_ech_client_server.t: fix intermittent failure

    There was a race condition in the test: when s_client rejects invalid
    command-line parameters, such as "-ech_grease_suite thisisnotagoodone",
    it can exit before the recipe writes "Q" to its stdin.  Writing
    to the closed pipe, or flushing it during close(), can terminate
    the Perl process with SIGPIPE.

    Ignore SIGPIPE locally around the write and close.  The existing
    client output checks still validate the expected result.

    Reproduced locally by adding a diagnostic 0.5-second delay
    before the stdin write in the bad-GREASE-suite case.  Without the fix,
    all three runs terminated with SIGPIPE after 8 of 26 tests, matching
    a FreeBSD CI failure.  With the fix and the same delay, all three
    runs passed all 26 tests . The delay is not part of this change.

    Resolves: https://github.com/openssl/openssl/issues/31824
    Fixes: a2e5848d9d11 "s_client and s_server options for ECH"
    References: https://github.com/openssl/project/issues/2072
    Assisted-by: Codex:gpt-6.1-sol
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
    Merge-date: Sat Nov 21 05:51:17 2026
    Merged-from: https://github.com/openssl/openssl/pull/33834

diff --git a/test/recipes/82-test_ech_client_server.t b/test/recipes/82-test_ech_client_server.t
index b988d8de71..2b0610713c 100644
--- a/test/recipes/82-test_ech_client_server.t
+++ b/test/recipes/82-test_ech_client_server.t
@@ -265,8 +265,17 @@ sub start_ech_client_server
         my $s_client_pid = open3(*sc_input, my $s_client_o,
                                  my $s_client_e,
                                  $shlib_wrap, $apps_openssl, @s_client_cmd);
-        print sc_input "Q\n";
-        close(sc_input);
+        {
+            # There is a race condition when s_client rejects invalid
+            # command-line parameters, e.g. "-ech_grease_suite thisisnotagoodone",
+            # and exits before we send "Q". Writing to its closed stdin pipe
+            # can kill this test with SIGPIPE. Ignore the signal during both print()
+            # and close(), which can flush buffered output. The client output
+            # is checked below.
+            local $SIG{PIPE} = 'IGNORE';
+            print sc_input "Q\n";
+            close(sc_input);
+        }
         waitpid($s_client_pid, 0);
         my $stillthere = kill 0, $s_server_pid;
         if ($stillthere) {