summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJos I. Boumans <kane@dwim.org>2003-01-16 15:04:48 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-01-16 21:28:42 +0000
commit17ab9c147afa44f9f620bca432b3948e42711043 (patch)
tree4c88aface4b2276b746b0d2f937d5c5a70b9a166 /lib
parentd80ecdf83d5183a6fb7318bbb104963c17b122a5 (diff)
downloadperl-17ab9c147afa44f9f620bca432b3948e42711043.tar.gz
Re: [perl #19977] unlocalized $_ in File::Find clobbers upstream $_
From: "Jos I. Boumans" <kane@dwim.org> Message-ID: <3E26ADF0.6010605@dwim.org> (with test tweaks) p4raw-id: //depot/perl@18501
Diffstat (limited to 'lib')
-rw-r--r--lib/File/Find.pm2
-rw-r--r--lib/File/Find/t/find.t19
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/File/Find.pm b/lib/File/Find.pm
index 72fd195c9b..8953e97d0a 100644
--- a/lib/File/Find.pm
+++ b/lib/File/Find.pm
@@ -568,7 +568,7 @@ sub _find_opt {
local ($wanted_callback, $avoid_nlink, $bydepth, $no_chdir, $follow,
$follow_skip, $full_check, $untaint, $untaint_skip, $untaint_pat,
$pre_process, $post_process, $dangling_symlinks);
- local($dir, $name, $fullname, $prune);
+ local($dir, $name, $fullname, $prune, $_);
my $cwd = $wanted->{bydepth} ? Cwd::fastcwd() : Cwd::getcwd();
my $cwd_untainted = $cwd;
diff --git a/lib/File/Find/t/find.t b/lib/File/Find/t/find.t
index 4e5a217caa..c55b4a9aac 100644
--- a/lib/File/Find/t/find.t
+++ b/lib/File/Find/t/find.t
@@ -15,8 +15,8 @@ BEGIN {
$SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; }
}
-if ( $symlink_exists ) { print "1..188\n"; }
-else { print "1..78\n"; }
+if ( $symlink_exists ) { print "1..189\n"; }
+else { print "1..79\n"; }
# Uncomment this to see where File::Find is chdir'ing to. Helpful for
# debugging its little jaunts around the filesystem.
@@ -484,6 +484,18 @@ File::Find::find( {wanted => \&noop_wanted,
Check( scalar(keys %Expect_Dir) == 0 );
+{
+ print "# checking argument localization\n";
+
+ ### this checks the fix of perlbug [19977] ###
+ my @foo = qw( a b c d e f );
+ my %pre = map { $_ => } @foo;
+
+ File::Find::find( sub { } , 'fa' ) for @foo;
+ delete $pre{$_} for @foo;
+
+ Check( scalar( keys %pre ) == 0 );
+}
if ( $symlink_exists ) {
print "# --- symbolic link tests --- \n";
@@ -761,5 +773,4 @@ if ( $symlink_exists ) {
Check( scalar(keys %Expect_File) == 0 );
unlink file_path('fa', 'faa_sl');
-}
-
+}