In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/f0c21bde1c98ce77283b21b9b2bb49f11f2cb75c?hp=939e7f268559d7c80860c4e1a519e0c25d84f793>
- Log ----------------------------------------------------------------- commit f0c21bde1c98ce77283b21b9b2bb49f11f2cb75c Author: Dagfinn Ilmari MannsÃ¥ker <ilm...@ilmari.org> Date: Sat Mar 25 09:40:06 2017 +0000 Include 'sh' in Configure invocations in INSTALL Most invocation examples included it, but some were missing. Add them for consistency. M INSTALL commit da28cbf61127b2e475dbeb9efad731c8d8fbf7fa Author: Dagfinn Ilmari MannsÃ¥ker <ilm...@ilmari.org> Date: Sat Mar 25 09:37:56 2017 +0000 Use -Udefault_inc_excludes_dot in Configure example While equivalent to to the -Dâ¦=n form, the -U form is more common. M INSTALL commit 600b7fa4b9717754d5b1ec739f7bde62427684e4 Merge: 939e7f2685 c12592fc45 Author: Dagfinn Ilmari MannsÃ¥ker <ilm...@ilmari.org> Date: Sat Mar 25 09:35:25 2017 +0000 [MERGE] Test and document PERL_USE_UNSAFE_INC Also remove it from the test environment in case it's set by the user. commit c12592fc45a5ef2d4d69860abbc8e9a1d80880e1 Author: Dagfinn Ilmari MannsÃ¥ker <ilm...@ilmari.org> Date: Tue Mar 21 17:12:04 2017 +0000 Document PERL_USE_UNSAFE_INC in perlrun.pod M pod/perlrun.pod commit 8c07e7b839a945e1b3e14c4c037553c41508185c Author: Dagfinn Ilmari MannsÃ¥ker <ilm...@ilmari.org> Date: Tue Mar 21 15:54:08 2017 +0000 Test PERL_USE_UNSAFE_INC M t/run/runenv.t commit 3e63457f336add47ed493b21a884e49d157f440c Author: Dagfinn Ilmari MannsÃ¥ker <ilm...@ilmari.org> Date: Tue Mar 21 15:53:32 2017 +0000 Delete PERL_USE_UNSAFE_INC from test environment It intereferes with tests of @INC contents, and all core tests must work without it. M t/TEST M t/harness M t/run/runenv.t ----------------------------------------------------------------------- Summary of changes: INSTALL | 8 ++++---- pod/perlrun.pod | 9 +++++++++ t/TEST | 1 + t/harness | 3 +++ t/run/runenv.t | 15 +++++++++++++-- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/INSTALL b/INSTALL index 6ff0ebe676..d2b5784fe3 100644 --- a/INSTALL +++ b/INSTALL @@ -361,7 +361,7 @@ disabling them via environment variables. You can override various aspects of this feature by defining various symbols during configure. An example might be: - Configure -Accflags=-DPERL_HASH_FUNC_SIPHASH + sh Configure -Accflags=-DPERL_HASH_FUNC_SIPHASH B<Unless stated otherwise these options are considered experimental or insecure and are not recommended for production use.> @@ -721,7 +721,7 @@ version-specific subdirectories) for add-on modules and extensions. For example, if you have a bundle of perl libraries from a previous installation, perhaps in a strange place: - Configure -Dotherlibdirs=/usr/lib/perl5/site_perl/5.8.1 + sh Configure -Dotherlibdirs=/usr/lib/perl5/site_perl/5.8.1 =item APPLLIB_EXP @@ -745,7 +745,7 @@ run-time methods: $PERLLIB, $PERL5LIB, -I, use lib, etc. Since version 5.26.0, default perl builds no longer includes C<'.'> as the last element of @INC. The old behaviour can restored using - Configure -Ddefault_inc_excludes_dot=n + sh Configure -Udefault_inc_excludes_dot Note that this is likely to make programs run under such a perl interpreter less secure. @@ -1694,7 +1694,7 @@ error, as the header file is broken. There are two ways to deal with this 1. Disable the use of ODBM_FILE - Configure ... -Dnoextensions=ODBM_File + sh Configure ... -Dnoextensions=ODBM_File 2. Fix the header file, somewhat like this: diff --git a/pod/perlrun.pod b/pod/perlrun.pod index 357b8b44e6..dff9f71cdd 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -1379,6 +1379,15 @@ a boolean variable. Setting this to C<"1"> is not the right way to your shell before starting Perl). See the description of the B<-C> switch for more information. +=item PERL_USE_UNSAFE_INC +X<PERL_USE_UNSAFE_INC> + +If perl has been configured to not have the current directory in +L<C<@INC>|perlvar/@INC> by default, this variable can be set to C<"1"> +to reinstate it. It's primarily intended for use while building and +testing modules that have not been updated to deal with "." not being in +C<@INC> and should not be set in the environment for day-to-day use. + =item SYS$LOGIN (specific to the VMS port) X<SYS$LOGIN> diff --git a/t/TEST b/t/TEST index fc37118770..6d842d0859 100755 --- a/t/TEST +++ b/t/TEST @@ -82,6 +82,7 @@ my %temp_no_core = my @bad_env_vars = qw( PERL5LIB PERLLIB PERL5OPT PERL_YAML_BACKEND PERL_JSON_BACKEND + PERL_USE_UNSAFE_INC ); for my $envname (@bad_env_vars) { diff --git a/t/harness b/t/harness index b46582ddd9..e06c3f8009 100644 --- a/t/harness +++ b/t/harness @@ -34,6 +34,9 @@ if ($ARGV[0] && $ARGV[0] eq '-torture') { # which live dual lives on CPAN. $ENV{PERL_CORE} = 1; +# All our tests should work without . in @INC +delete $ENV{PERL_USE_UNSAFE_INC}; + my (@tests, $re); # [.VMS]TEST.COM calls harness with empty arguments, so clean-up @ARGV diff --git a/t/run/runenv.t b/t/run/runenv.t index fe0d9cd1b6..c1e1b825da 100644 --- a/t/run/runenv.t +++ b/t/run/runenv.t @@ -12,7 +12,7 @@ BEGIN { skip_all_without_config('d_fork'); } -plan tests => 104; +plan tests => 106; my $STDOUT = tempfile(); my $STDERR = tempfile(); @@ -22,6 +22,7 @@ my $FAILURE_CODE = 119; delete $ENV{PERLLIB}; delete $ENV{PERL5LIB}; delete $ENV{PERL5OPT}; +delete $ENV{PERL_USE_UNSAFE_INC}; # Run perl with specified environment and arguments, return (STDOUT, STDERR) @@ -33,6 +34,7 @@ sub runperl_and_capture { delete $ENV{PERLLIB}; delete $ENV{PERL5LIB}; delete $ENV{PERL5OPT}; + delete $ENV{PERL_USE_UNSAFE_INC}; my $pid = fork; return (0, "Couldn't fork: $!") unless defined $pid; # failure if ($pid) { # parent @@ -299,12 +301,21 @@ is ($err, '', 'No errors when determining @INC'); my @default_inc = split /\n/, $out; SKIP: { - skip_if_miniperl("under miniperl", 1); + skip_if_miniperl("under miniperl", 3); if ($Config{default_inc_excludes_dot}) { ok !(grep { $_ eq '.' } @default_inc), '. is not in @INC'; + ($out, $err) = runperl_and_capture({ PERL_USE_UNSAFE_INC => 1 }, [@dump_inc]); + + is ($err, '', 'No errors when determining unsafe @INC'); + + my @unsafe_inc = split /\n/, $out; + + ok (eq_array([@unsafe_inc], [@default_inc, '.']), '. last in unsafe @INC') + or diag 'Unsafe @INC is: ', @unsafe_inc; } else { is ($default_inc[-1], '.', '. is last in @INC'); + skip('Not testing unsafe @INC when it includes . by default', 2); } } -- Perl5 Master Repository