1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
|
From 8cbf26c9fdc4e6d7dc617e34ce203b8adbf540a8 Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Thu, 31 Mar 2016 17:04:29 -0500
Subject: Patch unit tests to explicitly insert "." into @INC when needed.
(Backported to Debian 5.20 by Niko Tyni <ntyni@debian.org>)
Bug: https://rt.perl.org/Public/Bug/Display.html?id=127810
Patch-Name: debian/CVE-2016-1238/test-suite-without-dot.diff
---
Makefile.SH | 2 +-
Porting/pod_rules.pl | 2 +-
TestInit.pm | 2 +-
lib/strict.t | 2 +-
lib/warnings.t | 2 +-
makedef.pl | 2 +-
regen.pl | 2 +-
regen/genpacksizetables.pl | 2 +-
regen/mg_vtable.pl | 2 +-
t/comp/line_debug.t | 2 ++
t/lib/warnings/op | 1 +
t/op/goto.t | 2 +-
t/porting/regen.t | 2 +-
t/re/pat.t | 2 +-
t/run/switches.t | 6 +++---
t/test.pl | 3 ++-
16 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/Makefile.SH b/Makefile.SH
index dbff8122bf..01c1dca8f3 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -324,7 +324,7 @@ RUN_PERL = \$(LDLIBPTH) \$(RUN) $perl\$(EXE_EXT)
$spitshell >>$Makefile <<!GROK!THIS!
# Macros to invoke a copy of our fully operational perl during the build.
PERL_EXE = perl\$(EXE_EXT)
-RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$(EXE_EXT) -Ilib
+RUN_PERL = \$(LDLIBPTH) \$(RUN) ./perl\$(EXE_EXT) -Ilib -I.
!GROK!THIS!
;;
esac
diff --git a/Porting/pod_rules.pl b/Porting/pod_rules.pl
index 18abe878d2..775311faf0 100644
--- a/Porting/pod_rules.pl
+++ b/Porting/pod_rules.pl
@@ -26,7 +26,7 @@ use Getopt::Long;
# plan9 => 'plan9/mkfile',
);
-require 'Porting/pod_lib.pl';
+require './Porting/pod_lib.pl';
sub my_die;
# process command-line switches
diff --git a/TestInit.pm b/TestInit.pm
index 16eb318cc3..b00e59f37c 100644
--- a/TestInit.pm
+++ b/TestInit.pm
@@ -47,7 +47,7 @@ sub import {
} elsif ($_ eq 'T') {
$chdir = '..'
unless -f 't/TEST' && -f 'MANIFEST' && -d 'lib' && -d 'ext';
- @INC = 'lib';
+ @INC = qw/ lib . /;
$setopt = 1;
} else {
die "Unknown option '$_'";
diff --git a/lib/strict.t b/lib/strict.t
index e067793b82..d252c8da94 100644
--- a/lib/strict.t
+++ b/lib/strict.t
@@ -1,7 +1,7 @@
#!./perl
chdir 't' if -d 't';
-@INC = '../lib';
+@INC = ( '.', '../lib' );
our $local_tests = 4;
require "../t/lib/common.pl";
diff --git a/lib/warnings.t b/lib/warnings.t
index ee696fe2a1..7c24f3af2a 100644
--- a/lib/warnings.t
+++ b/lib/warnings.t
@@ -1,7 +1,7 @@
#!./perl
chdir 't' if -d 't';
-@INC = '../lib';
+@INC = ( '.', '../lib' );
our $UTF8 = (${^OPEN} || "") =~ /:utf8/;
require "../t/lib/common.pl";
diff --git a/makedef.pl b/makedef.pl
index a44c014e26..a21e20872a 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -59,7 +59,7 @@ while (@ARGV) {
}
}
-require "$ARGS{TARG_DIR}regen/embed_lib.pl";
+require "./$ARGS{TARG_DIR}regen/embed_lib.pl";
{
my @PLATFORM = qw(aix win32 wince os2 netware vms test);
diff --git a/regen.pl b/regen.pl
index 878866835e..71a6eda60a 100644
--- a/regen.pl
+++ b/regen.pl
@@ -15,7 +15,7 @@ use strict;
my $tap = $ARGV[0] && $ARGV[0] eq '--tap' ? '# ' : '';
foreach my $pl (map {chomp; "regen/$_"} <DATA>) {
- my @command = ($^X, $pl, @ARGV);
+ my @command = ($^X, '-I.', $pl, @ARGV);
print "$tap@command\n";
system @command
and die "@command failed: $?"
diff --git a/regen/genpacksizetables.pl b/regen/genpacksizetables.pl
index 742eb6fb3d..2e3bec580d 100644
--- a/regen/genpacksizetables.pl
+++ b/regen/genpacksizetables.pl
@@ -3,7 +3,7 @@
# it will generate EBCDIC too. (TODO)
use strict;
use Encode;
-require 'regen/regen_lib.pl';
+require './regen/regen_lib.pl';
sub make_text {
my ($chrmap, $letter, $unpredictable, $nocsum, $size, $condition) = @_;
diff --git a/regen/mg_vtable.pl b/regen/mg_vtable.pl
index 0bbfbfdf6d..df9adb6400 100644
--- a/regen/mg_vtable.pl
+++ b/regen/mg_vtable.pl
@@ -20,7 +20,7 @@ require 5.004;
BEGIN {
# Get function prototypes
- require 'regen/regen_lib.pl';
+ require './regen/regen_lib.pl';
}
my %mg =
diff --git a/t/comp/line_debug.t b/t/comp/line_debug.t
index 8361194bbf..71626bbf35 100644
--- a/t/comp/line_debug.t
+++ b/t/comp/line_debug.t
@@ -1,5 +1,7 @@
#!./perl
+BEGIN { unshift @INC, '.' }
+
chdir 't' if -d 't';
sub ok {
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index bca28186a2..5a01b9958f 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -1472,6 +1472,7 @@ END { print "in end\n"; }
print "in mainline\n";
1;
--FILE--
+BEGIN { unshift @INC, '.' }
require abc;
do "abc.pm";
EXPECT
diff --git a/t/op/goto.t b/t/op/goto.t
index 13e6b042ab..32684bfb93 100644
--- a/t/op/goto.t
+++ b/t/op/goto.t
@@ -240,7 +240,7 @@ YYY: print "OK\n";
EOT
close $f;
-$r = runperl(prog => 'use Op_goto01; print qq[DONE\n]');
+$r = runperl(prog => 'BEGIN { unshift @INC, q[.] } use Op_goto01; print qq[DONE\n]');
is($r, "OK\nDONE\n", "goto within use-d file");
unlink_all "Op_goto01.pm";
diff --git a/t/porting/regen.t b/t/porting/regen.t
index 048a0c0e7d..93ac58b768 100644
--- a/t/porting/regen.t
+++ b/t/porting/regen.t
@@ -78,7 +78,7 @@ OUTER: foreach my $file (@files) {
}
foreach (@progs) {
- my $command = "$^X $_ --tap";
+ my $command = "$^X -I. $_ --tap";
system $command
and die "Failed to run $command: $?";
}
diff --git a/t/re/pat.t b/t/re/pat.t
index 6e694d7436..0442ca9ce4 100644
--- a/t/re/pat.t
+++ b/t/re/pat.t
@@ -1607,7 +1607,7 @@ EOP
# #123562]
my $code='
- BEGIN{require q(test.pl);}
+ BEGIN{require q(./test.pl);}
use Encode qw(_utf8_on);
my $malformed = "a\x80\n";
_utf8_on($malformed);
diff --git a/t/run/switches.t b/t/run/switches.t
index a2e4bad47c..2d88c23cb8 100644
--- a/t/run/switches.t
+++ b/t/run/switches.t
@@ -193,12 +193,12 @@ sub import { print map "<\$_>", \@_ }
SWTESTPM
close $f or die "Could not close: $!";
$r = runperl(
- switches => [ "-M$package" ],
+ switches => [ "-I.", "-M$package" ],
prog => '1',
);
is( $r, "<$package>", '-M' );
$r = runperl(
- switches => [ "-M$package=foo" ],
+ switches => [ "-I.", "-M$package=foo" ],
prog => '1',
);
is( $r, "<$package><foo>", '-M with import parameter' );
@@ -212,7 +212,7 @@ SWTESTPM
is( $r, '', '-m' );
}
$r = runperl(
- switches => [ "-m$package=foo,bar" ],
+ switches => [ "-I.", "-m$package=foo,bar" ],
prog => '1',
);
is( $r, "<$package><foo><bar>", '-m with import parameters' );
diff --git a/t/test.pl b/t/test.pl
index 0fdc4f42ae..f9e4166a44 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -597,7 +597,7 @@ sub _create_runperl { # Create the string to qx in runperl().
$runperl = "$ENV{PERL_RUNPERL_DEBUG} $runperl";
}
unless ($args{nolib}) {
- $runperl = $runperl . ' "-I../lib"'; # doublequotes because of VMS
+ $runperl = $runperl . ' "-I../lib" "-I." '; # doublequotes because of VMS
}
if ($args{switches}) {
local $Level = 2;
@@ -1185,6 +1185,7 @@ sub run_multiple_progs {
open my $fh, '>', $tmpfile or die "Cannot open >$tmpfile: $!";
print $fh q{
BEGIN {
+ push @INC, '.';
open STDERR, '>&', STDOUT
or die "Can't dup STDOUT->STDERR: $!;";
}
|