Commit 38876e7ea1 for openssl.org
commit 38876e7ea14b74364181b7bb4c12053d5c8ebdaa
Author: Richard Levitte <levitte@openssl.foundation>
Date: Wed Aug 19 09:44:10 2026 +0200
test framework: always read child output line by line in run()
If a recipe played with $/ (slurp or paragraph mode), the pipe read
would misbehave and emit a bare "# " prefix, or prefix only the
first line of a multi-line read, risking TAP stream corruption.
Fixes: https://github.com/openssl/openssl/issues/32428
Assisted-by: Pi:moonshotai/kimi-k3
Signed-off-by: Richard Levitte <levitte@openssl.foundation>
Reviewed-by: Mounir Idrassi <mounir.idrassi@idrix.fr>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Thu Aug 27 14:20:36 2026
Merged-from: https://github.com/openssl/openssl/pull/32429
diff --git a/util/perl/OpenSSL/Test.pm b/util/perl/OpenSSL/Test.pm
index 570d3a8631..14d7389461 100644
--- a/util/perl/OpenSSL/Test.pm
+++ b/util/perl/OpenSSL/Test.pm
@@ -510,6 +510,10 @@ sub run {
local $_;
open($pipe, '-|', "$prefix$cmd") or die "Can't start command: $!";
+ # Read line by line, even if a recipe played with $/ (slurp or
+ # paragraph mode). Otherwise, a bare prefix (or only the first
+ # line of a multi-line read) would hit the TAP stream unguarded.
+ local $/ = "\n";
while(<$pipe>) {
my $l = ($opts{prefix} // $default_prefix) . $_;
if ($opts{capture}) {