Commit e474095b authored by Todd Rinaldo's avatar Todd Rinaldo Committed by Niko Tyni

Patch unit tests to explicitly insert "." into @INC when needed.

Backported to perl 5.22 by Dominic Hargreaves and forward
to 5.24 by Niko Tyni

Bug: https://rt.perl.org/Public/Bug/Display.html?id=127810
Patch-Name: debian/CVE-2016-1238/test-suite-without-dot.diff
parent 3da0af31
......@@ -342,7 +342,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
......
......@@ -32,7 +32,7 @@ if (ord("A") == 193) {
# plan9 => 'plan9/mkfile',
);
require 'Porting/pod_lib.pl';
require './Porting/pod_lib.pl';
sub my_die;
# process command-line switches
......
......@@ -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 '$_'";
......
#!./perl
chdir 't' if -d 't';
@INC = '../lib';
@INC = ( '.', '../lib' );
our $local_tests = 6;
require "../t/lib/common.pl";
......
#!./perl
chdir 't' if -d 't';
@INC = '../lib';
@INC = ( '.', '../lib' );
our $UTF8 = (${^OPEN} || "") =~ /:utf8/;
require "../t/lib/common.pl";
......@@ -70,7 +70,7 @@ BEGIN {
}
use constant PLATFORM => $ARGS{PLATFORM};
require "$ARGS{TARG_DIR}regen/embed_lib.pl";
require "./$ARGS{TARG_DIR}regen/embed_lib.pl";
# Is the following guard strictly necessary? Added during refactoring
# to keep the same behaviour when merging other code into here.
......
......@@ -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: $?"
......
use v5.16.0;
use strict;
use warnings;
BEGIN { unshift @INC, '.' }
require 'regen/regen_lib.pl';
require 'regen/charset_translations.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) = @_;
......
......@@ -20,7 +20,7 @@ require 5.004;
BEGIN {
# Get function prototypes
require 'regen/regen_lib.pl';
require './regen/regen_lib.pl';
}
my %mg =
......
#!./perl
BEGIN { unshift @INC, '.' }
chdir 't' if -d 't';
sub ok {
......
......@@ -1435,6 +1435,7 @@ END { print "in end\n"; }
print "in mainline\n";
1;
--FILE--
BEGIN { unshift @INC, '.' }
require abc;
do "abc.pm";
EXPECT
......
......@@ -280,7 +280,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";
......
......@@ -86,7 +86,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: $?";
}
......@@ -1663,7 +1663,7 @@ EOP
# NOTE - Do not put quotes in the code!
# NOTE - We have to triple escape the backref in the pattern below.
my $code='
BEGIN{require q(test.pl);}
BEGIN{require q(./test.pl);}
watchdog(3);
for my $len (1 .. 20) {
my $eights= q(8) x $len;
......@@ -1679,7 +1679,7 @@ EOP
# #123562]
my $code='
BEGIN{require q(test.pl);}
BEGIN{require q(./test.pl);}
use Encode qw(_utf8_on);
# \x80 and \x41 are continuation bytes in their respective
# character sets
......
......@@ -194,17 +194,17 @@ 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' );
$r = runperl(
switches => [ "-m$package" ],
switches => [ "-I.", "-m$package" ],
prog => '1',
);
......
......@@ -646,7 +646,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;
......@@ -1235,6 +1235,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: $!;";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment