Perl: Use our own globbing wrapper rather than File::Glob::glob
authorRichard Levitte <levitte@openssl.org>
Fri, 3 Nov 2017 20:22:17 +0000 (21:22 +0100)
committerRichard Levitte <levitte@openssl.org>
Sun, 5 Nov 2017 21:57:06 +0000 (22:57 +0100)
File::Glob::glob is deprecated, it's use generates this kind of
message:

    File::Glob::glob() will disappear in perl 5.30. Use File::Glob::bsd_glob() instead. at ../master/Configure line 277.

The first idea was to use a construction that makes the caller glob()
use File::Glob::bsd_glob().  That turned out not to work well
everywhere, so instead, we make our own wrapper, OpenSSL::Glob and use
that.

Fixes #4636

(this is an adaptation of #4040 and part of #4069, for 1.1.0)

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4666)

Configure
test/build.info
test/recipes/40-test_rehash.t
test/recipes/80-test_ssl_new.t
test/run_tests.pl
util/OpenSSL/Glob.pm [new file with mode: 0644]
util/mkdef.pl
util/process_docs.pl

index d6449636f33ae390bf75463529529de76a394a12..5b235fe39e0db23580b08759e84715e00aa215d7 100755 (executable)
--- a/Configure
+++ b/Configure
 
 use 5.10.0;
 use strict;
+use FindBin;
+use lib "$FindBin::Bin/util";
 use File::Basename;
 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
 use File::Path qw/mkpath/;
-use if $^O ne "VMS", 'File::Glob' => qw/glob/;
+use OpenSSL::Glob;
 
 # see INSTALL for instructions.
 
@@ -1353,7 +1355,6 @@ my %unified_info = ();
 
 my $buildinfo_debug = defined($ENV{CONFIGURE_DEBUG_BUILDINFO});
 if ($builder eq "unified") {
-    use lib catdir(dirname(__FILE__),"util");
     use with_fallback qw(Text::Template);
 
     sub cleandir {
@@ -1477,8 +1478,10 @@ if ($builder eq "unified") {
         my %generate = ();
 
         push @{$config{build_infos}}, catfile(abs2rel($sourced, $blddir), $f);
-        my $template = Text::Template->new(TYPE => 'FILE',
-                                           SOURCE => catfile($sourced, $f));
+        my $template =
+            Text::Template->new(TYPE => 'FILE',
+                                SOURCE => catfile($sourced, $f),
+                                PREPEND => qq{use lib "$FindBin::Bin/util";});
         die "Something went wrong with $sourced/$f: $!\n" unless $template;
         my @text =
             split /^/m,
index ef968e646a093f0a99d9883aa799667f57c7adb7..0b52994a15ecd37e7388beb50dfe6394afa5c4e7 100644 (file)
@@ -293,7 +293,7 @@ ENDIF
 {-
    use File::Spec::Functions;
    use File::Basename;
-   use if $^O ne "VMS", 'File::Glob' => qw/glob/;
+   use OpenSSL::Glob;
 
    my @nogo_headers = ( "asn1_mac.h",
                         "__decc_include_prologue.h",
index f902c238c0bd72a9919e3b14a264cd11b180795f..1204f1f77fe651768ebcf6d3ecf355240333b1bd 100644 (file)
@@ -13,7 +13,7 @@ use warnings;
 use File::Spec::Functions;
 use File::Copy;
 use File::Basename;
-use if $^O ne "VMS", 'File::Glob' => qw/glob/;
+use OpenSSL::Glob;
 use OpenSSL::Test qw/:DEFAULT srctop_file/;
 
 setup("test_rehash");
index dbd6aeb57aaeacb077c155f8366a3526eef74526..6f22a5aa35c30178ac6012f54706453aaff80f4f 100644 (file)
@@ -12,8 +12,7 @@ use warnings;
 
 use File::Basename;
 use File::Compare qw/compare_text/;
-use if $^O ne "VMS", 'File::Glob' => qw/glob/;
-
+use OpenSSL::Glob;
 use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file/;
 use OpenSSL::Test::Utils qw/disabled alldisabled available_protocols/;
 
index e5bc927e67fba9f5f7e1843b764e838709e60141..1859e605b44965ed15151c4d65e84fd8462be131 100644 (file)
@@ -16,7 +16,9 @@ BEGIN {
 
 use File::Spec::Functions qw/catdir catfile curdir abs2rel rel2abs/;
 use File::Basename;
-use if $^O ne "VMS", 'File::Glob' => qw/glob/;
+use FindBin;
+use lib "$FindBin::Bin/../util";
+use OpenSSL::Glob;
 use Module::Load::Conditional qw(can_load);
 
 my $TAP_Harness = can_load(modules => { 'TAP::Harness' => undef }) 
diff --git a/util/OpenSSL/Glob.pm b/util/OpenSSL/Glob.pm
new file mode 100644 (file)
index 0000000..ec87da4
--- /dev/null
@@ -0,0 +1,21 @@
+package OpenSSL::Glob;
+
+use strict;
+use warnings;
+
+use File::Glob;
+
+use Exporter;
+use vars qw($VERSION @ISA @EXPORT);
+
+$VERSION = '0.1';
+@ISA = qw(Exporter);
+@EXPORT = qw(glob);
+
+sub glob {
+    goto &File::Glob::bsd_glob if $^O ne "VMS";
+    goto &CORE::glob;
+}
+
+1;
+__END__
index 5fb2f855d255ffb90ed4b1743cb32d6bc5f0d5de..ce969db283e3f411ef54223885c54472b83e12c0 100755 (executable)
 use lib ".";
 use configdata;
 use File::Spec::Functions;
+use File::Basename;
+use FindBin;
+use lib "$FindBin::Bin";
+use OpenSSL::Glob;
 
 my $debug=0;
 
index 073a3b70315314903b41106b59c955e2bb062b06..38c2f3f21972138a3aa7e09e35d32cb3ff3bbfaf 100755 (executable)
@@ -13,7 +13,9 @@ use File::Spec::Functions;
 use File::Basename;
 use File::Copy;
 use File::Path;
-use if $^O ne "VMS", 'File::Glob' => qw/glob/;
+use FindBin;
+use lib "$FindBin::Bin";
+use OpenSSL::Glob;
 use Getopt::Long;
 use Pod::Usage;