diff options
author | H.Merijn Brand <perl5@tux.freedom.nl> | 2020-08-21 15:53:11 +0200 |
---|---|---|
committer | H.Merijn Brand <perl5@tux.freedom.nl> | 2020-08-21 15:53:30 +0200 |
commit | e04d927f2ca4d75153dd8737e2022c37fe5fa2d0 (patch) | |
tree | 8f2c78c473106bc53affc4d7ecc129fcf13a4b09 /Configure | |
parent | 768677ca81f5435a52c71938fa0353d7e2d0e1cf (diff) | |
download | perl-e04d927f2ca4d75153dd8737e2022c37fe5fa2d0.tar.gz |
Make getverlist inside Configure strict/warnings safe and correctly sorted
Diffstat (limited to 'Configure')
-rwxr-xr-x | Configure | 38 |
1 files changed, 20 insertions, 18 deletions
@@ -7555,37 +7555,39 @@ sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"` : Determine list of previous versions to include in @INC $cat > getverlist <<EOPL -#!$perl5 -w +#!$perl5 +use strict; +use warnings; use File::Basename; -\$api_versionstring = "$api_versionstring"; -\$version = "$version"; -\$stem = "$sitelib_stem"; -\$archname = "$archname"; +my \$api_versionstring = "$api_versionstring"; +my \$version = "$version"; +my \$stem = "$sitelib_stem"; +my \$archname = "$archname"; EOPL $cat >> getverlist <<'EOPL' -# The list found is store twice for each entry: the original name, and -# the binary broken down version as pack "sss", so sorting is easy and -# unambiguous. This will work for all versions that have a maximum of -# three digit groups, separate by '.'s or '_'s. Names are extended with -# ".0.0" to ensure at least three elements for the pack. -# -- H.Merijn Brand (m)'06 23-10-2006 - -# Can't have leading @ because metaconfig interprets it as a command! -;@inc_version_list=(); +# The list found is stored twice for each entry: the original name, and +# the binary broken down version into pack "s>s>s>", so sorting is easy +# and unambiguous. This will work for all versions that have a maximum +# of three digit per group separate by '.'s or '_'s. Names are extended +# with ".0.0" to ensure at least three elements for the pack. +# -- H.Merijn Brand (m)'06 23-10-2006 + +my @inc_version_list; +my @candidates; # XXX Redo to do opendir/readdir? if (-d $stem) { chdir($stem); ;@candidates = map { - [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*"); + [ $_, pack "s>s>s>", split m/[._]/, "$_.0.0" ] } glob("5.*"); ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates; } else { ;@candidates = (); } -($pversion, $aversion, $vsn5005) = map { - pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005"; -foreach $d (@candidates) { +my ($pversion, $aversion, $vsn5005) = map { + pack "s>s>s>", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005"; +foreach my $d (@candidates) { if ($d->[1] lt $pversion) { if ($d->[1] ge $aversion) { unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]); |