Change 11904 by pudge@pudge-mobile on 2001/09/06 00:28:01 Integrate File::Find changes from bleadperl Affected files ... ... //depot/maint-5.6/macperl/lib/File/Find.pm#4 edit ... //depot/maint-5.6/macperl/t/lib/filefind-taint.t#3 edit Differences ... ==== //depot/maint-5.6/macperl/lib/File/Find.pm#4 (text) ==== Index: perl/lib/File/Find.pm --- perl/lib/File/Find.pm.~1~ Wed Sep 5 18:45:05 2001 +++ perl/lib/File/Find.pm Wed Sep 5 18:45:05 2001 @@ -135,7 +135,7 @@ See above. This should be set using the C<qr> quoting operator. The default is set to C<qr|^([-+@\w./]+)$|>. -Note that the parantheses are vital. +Note that the parentheses are vital. =item C<untaint_skip> @@ -176,13 +176,16 @@ ($File::Find::prune = 1); } +Notice the C<_> in the above C<int(-M _)>: the C<_> is a magical +filehandle that caches the information from the preceding +stat(), lstat(), or filetest. + Set the variable C<$File::Find::dont_use_nlink> if you're using AFS, since AFS cheats. +Here's another interesting wanted function. It will find all symbolic +links that don't resolve: -Here's another interesting wanted function. It will find all symlinks -that don't resolve: - sub wanted { -l && !-e && print "bogus link: $File::Find::name\n"; } @@ -244,7 +247,7 @@ use Mac::Files; # invisible() -- returns 1 if file/directory is invisible, - # 0 if it's visible or undef if an error occured + # 0 if it's visible or undef if an error occurred sub invisible($) { my $file = shift; @@ -472,7 +475,7 @@ $pre_process, $post_process, $dangling_symlinks); local($dir, $name, $fullname, $prune); - my $cwd = $wanted->{bydepth} ? Cwd::fastcwd() : Cwd::cwd(); + my $cwd = $wanted->{bydepth} ? Cwd::fastcwd() : Cwd::getcwd(); my $cwd_untainted = $cwd; my $check_t_cwd = 1; $wanted_callback = $wanted->{wanted}; @@ -488,7 +491,7 @@ $untaint_skip = $wanted->{untaint_skip}; $dangling_symlinks = $wanted->{dangling_symlinks}; - # for compatability reasons (find.pl, find2perl) + # for compatibility reasons (find.pl, find2perl) local our ($topdir, $topdev, $topino, $topmode, $topnlink); # a symbolic link to a directory doesn't increase the link count ==== //depot/maint-5.6/macperl/t/lib/filefind-taint.t#3 (text) ==== Index: perl/t/lib/filefind-taint.t --- perl/t/lib/filefind-taint.t.~1~ Wed Sep 5 18:45:05 2001 +++ perl/t/lib/filefind-taint.t Wed Sep 5 18:45:05 2001 @@ -8,12 +8,12 @@ my $cwd; my $cwd_untainted; +use Config; + BEGIN { chdir 't' if -d 't'; unshift @INC => '../lib'; - require Config; - for (keys %ENV) { # untaint ENV ($ENV{$_}) = $ENV{$_} =~ /(.*)/; } @@ -44,8 +44,6 @@ use Cwd; -my $NonTaintedCwd = $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'os2'; - cleanup(); find({wanted => sub { print "ok 1\n" if $_ eq 'if.t'; }, @@ -333,12 +331,8 @@ print "# $@" if $@; #$^D = 8; -if ($NonTaintedCwd) { - Skip("$^O does not taint cwd"); - } -else { - Check( $@ =~ m|insecure cwd| ); -} +Check( $@ =~ m|insecure cwd| ); + chdir($cwd_untainted); @@ -406,12 +400,8 @@ eval {File::Find::find( {wanted => \&simple_wanted, untaint => 1, untaint_skip => 1, untaint_pattern => qr|^(NO_MATCH)$|}, topdir('fa') );}; - if ($NonTaintedCwd) { - Skip("$^O does not taint cwd"); - } - else { - Check( $@ =~ m|insecure cwd| ); - } + Check( $@ =~ m|insecure cwd| ); + chdir($cwd_untainted); } End of Patch.