diff options
author | Richard Levitte <levitte@openssl.org> | 2021-06-16 06:48:12 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2021-06-17 08:24:13 +0100 |
commit | a515c8256e22eb8427a43ea4f709794ce2c36414 (patch) | |
tree | 85bbef245f8486ef720428e0ef5366c475da0fd3 /util | |
parent | fd6d0c5ac4bc685b4021824fa56fcec245f08884 (diff) |
Fix exit code for VMS in util/wrap.pl and test/run_tests.pl
The exit code for VMS is a bit tricky, and while perl translates the
VMS status code from a typical C program to posix terms, it doesn't
automatically translate its exit code into the typical C program VMS
status code. Perl scripts are recommended to do so explicitly.
Therefore, we make util/wrap.pl and test/run_tests.pl simulate the
typical C program VMS status code for all non-zero exit codes, except
we give them all the error severity (according to the VMS C library
reference manual, exit codes 2 and above are treated as success...).
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15787)
Diffstat (limited to 'util')
-rwxr-xr-x | util/wrap.pl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/util/wrap.pl b/util/wrap.pl index 69be06d302..1ca09bfdf4 100755 --- a/util/wrap.pl +++ b/util/wrap.pl @@ -46,4 +46,18 @@ die "wrap.pl: Failed to execute '", join(' ', @cmd), "': $!\n" exit(($? & 255) | 128) if ($? & 255) != 0; # When not a signal, just shift down the subprocess exit code and use that. -exit($? >> 8); +my $exitcode = $? >> 8; + +# For VMS, perl recommendations is to emulate what the C library exit() does +# for all non-zero exit codes, except we set the error severity rather than +# success. +# Ref: https://perldoc.perl.org/perlport#exit +# https://perldoc.perl.org/perlvms#$? +if ($^O eq 'VMS' && $exitcode != 0) { + $exitcode = + 0x35a000 # C facility code + + ($exitcode * 8) # shift up to make space for the 3 severity bits + + 2 # Severity: E(rror) + + 0x10000000; # bit 28 set => the shell stays silent +} +exit($exitcode); |