In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b4929cb48878718cd9a8f54a834db6353f8115ec?hp=b6d5ddf72d1067c498a7ed65623df9f2f8f8d749>
- Log ----------------------------------------------------------------- commit b4929cb48878718cd9a8f54a834db6353f8115ec Author: Tony Cook <[email protected]> Date: Wed Jun 17 11:10:18 2015 +1000 [perl #125305] chdir("") no longer behaves like chdir() ----------------------------------------------------------------------- Summary of changes: pod/perldiag.pod | 10 ---------- pp_sys.c | 5 +---- t/op/chdir.t | 30 ++++++------------------------ 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 47c23eb..0adabf5 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -6658,16 +6658,6 @@ one. This doesn't make sense. Perl will continue, assuming a Unicode happens to be ISO-8859-1 (Latin1) where this message is spurious and can be ignored. -=item Use of chdir('') or chdir(undef) as chdir() deprecated - -(D deprecated) chdir() with no arguments is documented to change to -$ENV{HOME} or $ENV{LOGDIR}. chdir(undef) and chdir('') share this -behavior, but that has been deprecated. In future versions they -will simply fail. - -Be careful to check that what you pass to chdir() is defined and not -blank, else you might find yourself in your home directory. - =item Use of /c modifier is meaningless in s/// (W regexp) You used the /c modifier in a substitution. The /c diff --git a/pp_sys.c b/pp_sys.c index beca14a..1c2ef9c 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3591,8 +3591,7 @@ PP(pp_chdir) else if (!(gv = MAYBE_DEREF_GV(sv))) tmps = SvPV_nomg_const_nolen(sv); } - - if( !gv && (!tmps || !*tmps) ) { + else { HV * const table = GvHVn(PL_envgv); SV **svp; @@ -3603,8 +3602,6 @@ PP(pp_chdir) #endif ) { - if( MAXARG == 1 ) - deprecate("chdir('') or chdir(undef) as chdir()"); tmps = SvPV_nolen_const(*svp); } else { diff --git a/t/op/chdir.t b/t/op/chdir.t index 813b0ed..84159fe 100644 --- a/t/op/chdir.t +++ b/t/op/chdir.t @@ -10,10 +10,11 @@ BEGIN { # possibilities into @INC. unshift @INC, qw(t . lib ../lib); require "./test.pl"; - plan(tests => 48); + plan(tests => 42); } use Config; +use Errno qw(ENOENT); my $IsVMS = $^O eq 'VMS'; @@ -150,29 +151,10 @@ sub check_env { my $warning = ''; local $SIG{__WARN__} = sub { $warning .= join '', @_ }; - - - # Check the deprecated chdir(undef) feature. -#line 64 - ok( chdir(undef), "chdir(undef) w/ only \$ENV{$key} set" ); - is( abs_path, $ENV{$key}, ' abs_path() agrees' ); - is( $warning, <<WARNING, ' got uninit & deprecation warning' ); -Use of uninitialized value in chdir at $0 line 64. -Use of chdir('') or chdir(undef) as chdir() is deprecated at $0 line 64. -WARNING - - chdir($Cwd); - - # Ditto chdir(''). - $warning = ''; -#line 76 - ok( chdir(''), "chdir('') w/ only \$ENV{$key} set" ); - is( abs_path, $ENV{$key}, ' abs_path() agrees' ); - is( $warning, <<WARNING, ' got deprecation warning' ); -Use of chdir('') or chdir(undef) as chdir() is deprecated at $0 line 76. -WARNING - - chdir($Cwd); + $! = 0; + ok(!chdir(''), "chdir('') no longer implied chdir()"); + is($!+0, ENOENT, 'check $! set appropriately'); + is($warning, '', 'should no longer warn about deprecation'); } } -- Perl5 Master Repository
