Commit cf206ac07a for openssl.org
commit cf206ac07a6f4d31fadd017b7d2e90af6074acae
Author: Mounir IDRASSI <mounir.idrassi@idrix.fr>
Date: Mon Aug 31 09:28:19 2026 +0900
test: use the portable null device in Perl recipes
The symbol presence recipe hardcodes /dev/null in commands that run
through the shell. On native Windows, cmd.exe treats that as
<drive>:\dev\null. If the parent directory is absent, redirection fails
before nm starts and the test can pass with empty symbol lists.
Use File::Spec's null device for those commands. GNU nm still doesn't
distinguish mergeable COFF definitions and can't read dynamic symbols
from Microsoft DLLs. Skip this developer test under native Windows
Perl instead of treating its output as reliable.
The X.509 recipe has a related negative test. Failure to open /dev/null
can satisfy its assertion before invalid extension handling is tested.
Use File::Spec's null device so the command fails for the intended
reason.
Assisted-by: codex:gpt-5.6-sol
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Fri Sep 4 08:11:49 2026
Merged-from: https://github.com/openssl/openssl/pull/32604
diff --git a/test/recipes/01-test_symbol_presence.t b/test/recipes/01-test_symbol_presence.t
index 6c8de64b0b..11235f7c61 100644
--- a/test/recipes/01-test_symbol_presence.t
+++ b/test/recipes/01-test_symbol_presence.t
@@ -26,6 +26,8 @@ plan skip_all => "Test is disabled on NonStop" if config('target') =~ m|^nonstop
plan skip_all => "Test is disabled on MacOS" if config('target') =~ m|^darwin|;
# AIX reports symbol names differently
plan skip_all => "Test is disabled on AIX" if config('target') =~ m|^aix|;
+plan skip_all => "This is unsupported on native Windows"
+ if $^O eq 'MSWin32';
plan skip_all => "This is unsupported on platforms that don't have 'nm'"
unless IPC::Cmd::can_run('nm');
@@ -65,9 +67,10 @@ plan tests => $testcount;
my %stsymbols; # Static library symbols
my %shsymbols; # Shared library symbols
my %defsymbols; # Symbols taken from ordinals
+my $null_device = devnull();
foreach (sort keys %stlibname) {
- my $stlib_cmd = "nm -Pg $stlibpath{$_} 2> /dev/null";
- my $shlib_cmd = "nm -DPg $shlibpath{$_} 2> /dev/null";
+ my $stlib_cmd = "nm -Pg $stlibpath{$_} 2> $null_device";
+ my $shlib_cmd = "nm -DPg $shlibpath{$_} 2> $null_device";
my @stlib_lines;
my @shlib_lines;
*OSTDERR = *STDERR;
@@ -97,7 +100,7 @@ foreach (sort keys %stlibname) {
indir $bldtop => sub {
my $mkdefpath = srctop_file("util", "mkdef.pl");
my $def_path = srctop_file("util", "lib$_.num");
- my $def_cmd = "$^X $mkdefpath --ordinals $def_path --name $_ --OS linux 2> /dev/null";
+ my $def_cmd = "$^X $mkdefpath --ordinals $def_path --name $_ --OS linux 2> $null_device";
@def_lines = map { s|\R$||; $_ } `$def_cmd`;
if ($? != 0) {
note "running 'cd $bldtop; $def_cmd' => $?";
diff --git a/test/recipes/25-test_x509.t b/test/recipes/25-test_x509.t
index ac90986e44..ce29004782 100644
--- a/test/recipes/25-test_x509.t
+++ b/test/recipes/25-test_x509.t
@@ -595,7 +595,7 @@ my $in_key = srctop_file('test', 'certs', 'x509-check-key.pem');
my $invextfile = srctop_file('test', 'invalid-x509.cnf');
# Test that invalid extensions settings fail
ok(!run(app(["openssl", "x509", "-req", "-in", $in_csr, "-signkey", $in_key,
- "-out", "/dev/null", "-days", "3650" , "-extensions", "ext",
+ "-out", File::Spec->devnull(), "-days", "3650" , "-extensions", "ext",
"-extfile", $invextfile])));
# Tests for issue #16080 (fixed in 1.1.1o)