Commit 28016ea513 for openssl.org
commit 28016ea51360b0540efacb5dab6086869162430f
Author: Matt Caswell <matt@openssl.foundation>
Date: Thu Sep 10 16:43:49 2026 +0100
wrap.pl: exec the command so signals reach the right pid
A test recipe that starts a command with open3() is handed wrap.pl's
pid, not the command's, because wrap.pl ran the command as a subprocess.
A signal sent to shut that command down therefore never reached it, and
wrap.pl could not act on the signal either while blocked waiting for
that very subprocess.
70-test_stime.t is the clearest case: its s_server has no -naccept, so
it runs until signalled. The recipe leaked one s_server on every run,
and in a loaded parallel run hung in waitpid() until something killed
the server. The other open3() recipes pass -naccept 1, so their servers
exit by themselves and the ineffective signal only strands one when the
client never connects.
exec() keeps the pid, and makes the exit code and signal handling below
unnecessary where it is used. MSWin32 keeps the subprocess because
exec() there does not give back the exit code, and VMS because its exit
code needs translating.
Assisted-by: Claude Code:claude-opus-5[1m]
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Merge-date: Wed Sep 16 14:20:31 2026
Merged-from: https://github.com/openssl/openssl/pull/32784
diff --git a/util/wrap.pl.in b/util/wrap.pl.in
index 4bb13189d3..c26500ee8b 100644
--- a/util/wrap.pl.in
+++ b/util/wrap.pl.in
@@ -118,8 +118,16 @@ if ($^O eq 'VMS') {
@cmd = ( @ARGV );
}
-# The exec() statement on MSWin32 doesn't seem to give back the exit code
-# from the call, so we resort to using system() instead.
+# exec() keeps this script's pid, which matters to callers that signal the
+# command they started: a test recipe using open3() is handed this pid, not
+# the command's, so with a subprocess the signal never reaches the command.
+# MSWin32 can't use exec() because it doesn't give back the exit code, and
+# VMS needs the exit code translated below, so both keep the subprocess.
+if ($^O ne 'MSWin32' && $^O ne 'VMS') {
+ exec @cmd
+ or die "wrap.pl: Failed to execute '", join(' ', @cmd), "': $!\n";
+}
+
my $waitcode;
if ($^O eq 'MSWin32') {
$waitcode = system(quote_cmd_win32(@cmd));