]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix trailing whitespace mismatch error when running 02-test_errstr.
authorShane Lontis <shane.lontis@oracle.com>
Wed, 15 Jul 2020 01:49:57 +0000 (11:49 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Fri, 17 Jul 2020 03:51:15 +0000 (13:51 +1000)
Fixes #12449

On a aix7_ppc32 machine the error was of the form
match 'Previous owner died ' (2147483743) with one of ( 'Previous owner died', 'reason(95)' )
Stripping the trailing whitespace from the system error will address this issue.

Suggested fix by @pauldale.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12451)

test/recipes/02-test_errstr.t

index a63812f3970e7c84fb29fc931847a0dfa269ee06..7c382b41240dc1ef84380ac61f9f4ebcc9df72b5 100644 (file)
@@ -49,7 +49,7 @@ use constant ERR_LIB_NONE => 1;
 plan tests => scalar @Errno::EXPORT_OK
     +1                          # Checking that error 128 gives 'reason(128)'
     +1                          # Checking that error 0 gives the library name
-    ;
+    +1;                         # Check trailing whitespace is removed.
 
 # Test::More:ok() has a sub prototype, which means we need to use the '&ok'
 # syntax to force it to accept a list as a series of arguments.
@@ -66,6 +66,7 @@ foreach my $errname (@Errno::EXPORT_OK) {
 # Reason code 0 of any library gives the library name as reason
 &ok(match_opensslerr_reason(ERR_LIB_NONE << ERR_LIB_OFFSET |   0,
                             "unknown library"));
+&ok(match_any("Trailing whitespace  \n\t", "?", ( "Trailing whitespace" )));
 
 exit 0;
 
@@ -93,6 +94,9 @@ sub match_any {
     my $desc = shift;
     my @strings = @_;
 
+    # ignore trailing whitespace
+    $first =~ s/\s+$//;
+
     if (scalar @strings > 1) {
         $desc = "match '$first' ($desc) with one of ( '"
             . join("', '", @strings) . "' )";