From 968bb74c93d4e3029f01ec5b572ae300cbf73612 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 3 Nov 2017 21:22:17 +0100 Subject: [PATCH] Perl: Use our own globbing wrapper rather than File::Glob::glob 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) --- Configure | 11 +++++++---- test/build.info | 2 +- test/recipes/40-test_rehash.t | 2 +- test/recipes/80-test_ssl_new.t | 3 +-- test/run_tests.pl | 4 +++- util/OpenSSL/Glob.pm | 21 +++++++++++++++++++++ util/mkdef.pl | 4 ++++ util/process_docs.pl | 4 +++- 8 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 util/OpenSSL/Glob.pm diff --git a/Configure b/Configure index d6449636f33ae..5b235fe39e0db 100755 --- a/Configure +++ b/Configure @@ -11,10 +11,12 @@ 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, diff --git a/test/build.info b/test/build.info index ef968e646a093..0b52994a15ecd 100644 --- a/test/build.info +++ b/test/build.info @@ -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", diff --git a/test/recipes/40-test_rehash.t b/test/recipes/40-test_rehash.t index f902c238c0bd7..1204f1f77fe65 100644 --- a/test/recipes/40-test_rehash.t +++ b/test/recipes/40-test_rehash.t @@ -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"); diff --git a/test/recipes/80-test_ssl_new.t b/test/recipes/80-test_ssl_new.t index dbd6aeb57aaea..6f22a5aa35c30 100644 --- a/test/recipes/80-test_ssl_new.t +++ b/test/recipes/80-test_ssl_new.t @@ -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/; diff --git a/test/run_tests.pl b/test/run_tests.pl index e5bc927e67fba..1859e605b4496 100644 --- a/test/run_tests.pl +++ b/test/run_tests.pl @@ -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 index 0000000000000..ec87da4aea9c0 --- /dev/null +++ b/util/OpenSSL/Glob.pm @@ -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__ diff --git a/util/mkdef.pl b/util/mkdef.pl index 5fb2f855d255f..ce969db283e3f 100755 --- a/util/mkdef.pl +++ b/util/mkdef.pl @@ -48,6 +48,10 @@ use lib "."; use configdata; use File::Spec::Functions; +use File::Basename; +use FindBin; +use lib "$FindBin::Bin"; +use OpenSSL::Glob; my $debug=0; diff --git a/util/process_docs.pl b/util/process_docs.pl index 073a3b7031531..38c2f3f219721 100755 --- a/util/process_docs.pl +++ b/util/process_docs.pl @@ -13,7 +13,9 @@ 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;