]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix OpenSSL::fallback for VMS
authorRichard Levitte <levitte@openssl.org>
Mon, 17 May 2021 13:04:42 +0000 (15:04 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 19 May 2021 10:31:17 +0000 (12:31 +0200)
VMS unpackers will typically convert any period ('.') in directory
names to underscores, since the period is a path separator on VMS,
just like '/' is a path separator on Unix.  Our fallback mechanism
needs to account for that.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15317)

util/perl/OpenSSL/fallback.pm

index 8f45971bd99ffd27d321198f7f4fc245c5afdd16..041fb30ba3e12aad4046627ad8f1e05699b8d272 100644 (file)
@@ -89,9 +89,24 @@ sub import {
             while (my $l = <$fh>) {
                 $l =~ s|\R$||;        # Better chomp
                 my $d = "$dir/$l";
+                my $checked = $d;
+
+                if ($^O eq 'VMS') {
+                    # Some VMS unpackers replace periods with underscores
+                    # We must be real careful not to convert the directories
+                    # '.' and '..', though.
+                    $checked =
+                        join('/',
+                             map { my $x = $_;
+                                   $x =~ s|\.|_|g
+                                       if ($x ne '..' && $x ne '.');
+                                   $x }
+                             split(m|/|, $checked))
+                        unless -e $checked && -d $checked;
+                }
                 croak "All lines in $path must be a directory, not a file: $l"
-                    unless -e $d && -d $d;
-                push @INC, $d;
+                    unless -e $checked && -d $checked;
+                push @INC, $checked;
             }
         } else {                # It's a directory
             push @INC, $path;