Skip to content

Commit

Permalink
Configure,test/recipes: "pin" glob to File::Glob::glob.
Browse files Browse the repository at this point in the history
As it turns out default glob's behaviour for quoted argument varies
from version to version, making it impossible to Configure or run
tests in some cases. The reason for quoting globs was to accommodate
source path with spaces in its name, which was treated by default glob
as multiple paths. File::Glob::glob on the other hand doesn't consider
spaces as delimiters and therefore works with unquoted patterns.

[Unfortunaltely File::Glob::glob, being too csh-ly, doesn't work
on VMS, hence the "pinning" is conditional.]

Reviewed-by: Richard Levitte <[email protected]>
  • Loading branch information
Andy Polyakov committed May 29, 2016
1 parent f59f23c commit 9785555
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
7 changes: 5 additions & 2 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ use strict;
use File::Basename;
use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
use File::Path qw/mkpath/;
if ($^O ne "VMS") {
use File::Glob qw/glob/;
}

# see INSTALL for instructions.

Expand Down Expand Up @@ -210,7 +213,7 @@ die "erroneous version information in opensslv.h: ",
# Collect target configurations

my $pattern = catfile(dirname($0), "Configurations", "*.conf");
foreach (sort glob("\"$pattern\"") ) {
foreach (sort glob($pattern)) {
&read_config($_);
}

Expand All @@ -223,7 +226,7 @@ if (defined $ENV{$local_config_envname}) {
$pattern = catfile($ENV{$local_config_envname}, '*.conf');
}

foreach (sort glob($pattern) ) {
foreach (sort glob($pattern)) {
&read_config($_);
}
}
Expand Down
9 changes: 6 additions & 3 deletions test/recipes/40-test_rehash.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use warnings;
use File::Spec::Functions;
use File::Copy;
use File::Basename;
if ($^O ne "VMS") {
use File::Glob qw/glob/;
}
use OpenSSL::Test qw/:DEFAULT bldtop_file/;

setup("test_rehash");
Expand Down Expand Up @@ -59,9 +62,9 @@ indir "rehash.$$" => sub {
sub prepare {
my @sourcefiles =
sort map { glob(bldtop_file('certs', 'demo', "*.$_")) } ('pem',
'crt',
'cer',
'crl');
'crt',
'cer',
'crl');
my @destfiles = ();
foreach (@sourcefiles) {
copy($_, curdir());
Expand Down
5 changes: 4 additions & 1 deletion test/recipes/80-test_ssl_new.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ use warnings;

use File::Basename;
use File::Compare qw/compare_text/;
if ($^O ne "VMS") {
use File::Glob qw/glob/;
}

use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file/;
use OpenSSL::Test::Utils qw/disabled alldisabled available_protocols/;
Expand All @@ -20,7 +23,7 @@ setup("test_ssl_new");

$ENV{TEST_CERTS_DIR} = srctop_dir("test", "certs");

my @conf_srcs = glob('"'.srctop_file("test", "ssl-tests", "*.conf.in").'"');
my @conf_srcs = glob(srctop_file("test", "ssl-tests", "*.conf.in"));
map { s/;.*// } @conf_srcs if $^O eq "VMS";
my @conf_files = map { basename($_) } @conf_srcs;
map { s/\.in// } @conf_files;
Expand Down
7 changes: 5 additions & 2 deletions test/run_tests.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ BEGIN

use File::Spec::Functions qw/catdir catfile curdir abs2rel rel2abs/;
use File::Basename;
if ($^O ne "VMS") {
use File::Glob qw/glob/;
}
use Test::Harness qw/runtests $switches/;

my $srctop = $ENV{SRCTOP} || $ENV{TOP};
Expand All @@ -42,13 +45,13 @@ BEGIN
if (grep /^(alltests|list)$/, @tests) {
@tests = grep {
basename($_) =~ /^[0-9][0-9]-[^\.]*\.t$/
} glob('"'.catfile($recipesdir,"*.t").'"');
} glob(catfile($recipesdir,"*.t"));
} else {
my @t = ();
foreach (@tests) {
push @t, grep {
basename($_) =~ /^[0-9][0-9]-[^\.]*\.t$/
} glob('"'.catfile($recipesdir,"*-$_.t").'"');
} glob(catfile($recipesdir,"*-$_.t"));
}
@tests = @t;
}
Expand Down
5 changes: 4 additions & 1 deletion util/process_docs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use File::Basename;
use File::Copy;
use File::Path;
if ($^O ne "VMS") {
use File::Glob qw/glob/;
}
use Getopt::Long;
use Pod::Usage;

Expand Down Expand Up @@ -72,7 +75,7 @@
foreach my $subdir (keys %{$options{subdir}}) {
my $section = $options{subdir}->{$subdir};
my $podsourcedir = catfile($options{sourcedir}, $subdir);
my $podglob = '"'.catfile($podsourcedir, "*.pod").'"';
my $podglob = catfile($podsourcedir, "*.pod");

foreach my $podfile (glob $podglob) {
my $podname = basename($podfile, ".pod");
Expand Down

0 comments on commit 9785555

Please sign in to comment.