In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/6de85bb45a5ea25528026a26cac854ee4dcdcd45?hp=e06f856f7209ef9f86a20d46b2c039a3c7852762>
- Log ----------------------------------------------------------------- commit 6de85bb45a5ea25528026a26cac854ee4dcdcd45 Author: Nicholas Clark <[email protected]> Date: Wed Jul 3 11:11:06 2013 +0200 Move File::Find from lib/ to ext/ M MANIFEST M Porting/Maintainers.pl A ext/File-Find/lib/File/Find.pm A ext/File-Find/t/find.t A ext/File-Find/t/taint.t D lib/File/Find.pm D lib/File/Find/t/find.t D lib/File/Find/t/taint.t M t/porting/known_pod_issues.dat M write_buildcustomize.pl commit e12eeff833d221009aa2e2a6d745f2c1812f2f77 Author: Nicholas Clark <[email protected]> Date: Wed Jul 3 10:57:28 2013 +0200 Change File::Find's tests to look for taint.t instead of commonsense.t This passes whether the tests are in lib/ (and hence run with the CWD as t/) or in ext/File-Find (and hence run with that as the CWD) because they find t/op/taint.t or ext/File-Find/t/taint.t respectively. Change taint.t to count the number of times it finds a file named taint.t, and fail if the count isn't 1. find.t was already testing a count. M lib/File/Find/t/find.t M lib/File/Find/t/taint.t commit 05bc6e4e004001cec69ec60de3c2ccd2c84c6484 Author: Nicholas Clark <[email protected]> Date: Wed Jul 3 10:41:29 2013 +0200 Improve the BEGIN-time setup code for File::Find's tests. In find.t merge the two BEGIN blocks and eliminate the redundant C<use File::Spec;> In both, don't attempt to change directory to t/ (which will be unhelpful once File::Find is moved to ext/) Only make paths in @INC absolute if $ENV{PERL_CORE} is set (which will ease making File::Find dual-life, if we want to this.) M lib/File/Find/t/find.t M lib/File/Find/t/taint.t ----------------------------------------------------------------------- Summary of changes: MANIFEST | 6 ++-- Porting/Maintainers.pl | 2 +- {lib => ext/File-Find/lib}/File/Find.pm | 0 {lib/File/Find => ext/File-Find}/t/find.t | 51 ++++++++++++++---------------- {lib/File/Find => ext/File-Find}/t/taint.t | 17 +++++----- t/porting/known_pod_issues.dat | 2 +- write_buildcustomize.pl | 1 + 7 files changed, 37 insertions(+), 42 deletions(-) rename {lib => ext/File-Find/lib}/File/Find.pm (100%) rename {lib/File/Find => ext/File-Find}/t/find.t (97%) rename {lib/File/Find => ext/File-Find}/t/taint.t (96%) diff --git a/MANIFEST b/MANIFEST index 63c88e4..7369af2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3585,6 +3585,9 @@ ext/FileCache/t/07noimport.t See if FileCache works without importing ext/File-DosGlob/DosGlob.xs Win32 DOS-globbing module ext/File-DosGlob/lib/File/DosGlob.pm Win32 DOS-globbing module ext/File-DosGlob/t/DosGlob.t See if File::DosGlob works +ext/File-Find/lib/File/Find.pm Routines to do a find +ext/File-Find/t/find.t See if File::Find works +ext/File-Find/t/taint.t See if File::Find works with taint ext/File-Glob/bsd_glob.c File::Glob extension run time code ext/File-Glob/bsd_glob.h File::Glob extension header file ext/File-Glob/Changes File::Glob extension changelog @@ -4115,9 +4118,6 @@ lib/File/Compare.pm Emulation of cmp command lib/File/Compare.t See if File::Compare works lib/File/Copy.pm Emulation of cp command lib/File/Copy.t See if File::Copy works -lib/File/Find.pm Routines to do a find -lib/File/Find/t/find.t See if File::Find works -lib/File/Find/t/taint.t See if File::Find works with taint lib/FileHandle.pm Backward-compatible front end to IO extension lib/FileHandle.t See if FileHandle works lib/File/stat-7896.t A test for ID 20011110.104 diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 6fa0720..65d643f 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -766,7 +766,7 @@ use File::Glob qw(:case); 'File::Find' => { 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/File/Find.pm lib/File/Find], + 'FILES' => q[ext/File-Find], 'UPSTREAM' => 'blead', }, diff --git a/lib/File/Find.pm b/ext/File-Find/lib/File/Find.pm similarity index 100% rename from lib/File/Find.pm rename to ext/File-Find/lib/File/Find.pm diff --git a/lib/File/Find/t/find.t b/ext/File-Find/t/find.t similarity index 97% rename from lib/File/Find/t/find.t rename to ext/File-Find/t/find.t index 96a1000..62ec81e 100644 --- a/lib/File/Find/t/find.t +++ b/ext/File-Find/t/find.t @@ -11,11 +11,21 @@ my ($warn_msg, @files, $file); BEGIN { require File::Spec; - chdir 't' if -d 't'; - # May be doing dynamic loading while @INC is all relative - unshift @INC => File::Spec->rel2abs('../lib'); - - $SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; } + if ($ENV{PERL_CORE}) { + # May be doing dynamic loading while @INC is all relative + @INC = map { $_ = File::Spec->rel2abs($_); /(.*)/; $1 } @INC; + } + $SIG{'__WARN__'} = sub { $warn_msg = $_[0]; warn "# $_[0]"; }; + + if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'VMS') { + # This is a hack - at present File::Find does not produce native names + # on Win32 or VMS, so force File::Spec to use Unix names. + # must be set *before* importing File::Find + require File::Spec::Unix; + @File::Spec::ISA = 'File::Spec::Unix'; + } + require File::Find; + import File::Find; } my $test_count = 98; @@ -45,39 +55,24 @@ my $orig_dir = cwd(); # }; # } - -BEGIN { - use File::Spec; - if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'VMS') - { - # This is a hack - at present File::Find does not produce native names on - # Win32 or VMS, so force File::Spec to use Unix names. - # must be set *before* importing File::Find - require File::Spec::Unix; - @File::Spec::ISA = 'File::Spec::Unix'; - } - require File::Find; - import File::Find; -} - cleanup(); -$::count_commonsense = 0; -find({wanted => sub { ++$::count_commonsense if $_ eq 'commonsense.t'; } }, +$::count_taint = 0; +find({wanted => sub { ++$::count_taint if $_ eq 'taint.t'; } }, File::Spec->curdir); -if ($::count_commonsense == 1) { +if ($::count_taint == 1) { print "ok 1\n"; } else { - print "not ok 1 # found $::count_commonsense files named 'commonsense.t'\n"; + print "not ok 1 # found $::count_taint files named 'taint.t'\n"; } -$::count_commonsense = 0; -finddepth({wanted => sub { ++$::count_commonsense if $_ eq 'commonsense.t'; } }, +$::count_taint = 0; +finddepth({wanted => sub { ++$::count_taint if $_ eq 'taint.t'; } }, File::Spec->curdir); -if ($::count_commonsense == 1) { +if ($::count_taint == 1) { print "ok 2\n"; } else { - print "not ok 2 # found $::count_commonsense files named 'commonsense.t'\n"; + print "not ok 2 # found $::count_taint files named 'taint.t'\n"; } my $case = 2; diff --git a/lib/File/Find/t/taint.t b/ext/File-Find/t/taint.t similarity index 96% rename from lib/File/Find/t/taint.t rename to ext/File-Find/t/taint.t index 954c678..9d78ae0 100644 --- a/lib/File/Find/t/taint.t +++ b/ext/File-Find/t/taint.t @@ -16,11 +16,10 @@ my ($cwd, $cwd_untainted); BEGIN { require File::Spec; - chdir 't' if -d 't'; - # May be doing dynamic loading while @INC is all relative - my $lib = File::Spec->rel2abs('../lib'); - $lib = $1 if $lib =~ m/(.*)/; - unshift @INC => $lib; + if ($ENV{PERL_CORE}) { + # May be doing dynamic loading while @INC is all relative + @INC = map { $_ = File::Spec->rel2abs($_); /(.*)/; $1 } @INC; + } } use Config; @@ -61,16 +60,16 @@ my $orig_dir = cwd(); cleanup(); my $found; -find({wanted => sub { $found = 1 if ($_ eq 'commonsense.t') }, +find({wanted => sub { ++$found if $_ eq 'taint.t' }, untaint => 1, untaint_pattern => qr|^(.+)$|}, File::Spec->curdir); -ok($found, 'commonsense.t found'); +is($found, 1, 'taint.t found once'); $found = 0; -finddepth({wanted => sub { $found = 1 if $_ eq 'commonsense.t'; }, +finddepth({wanted => sub { ++$found if $_ eq 'taint.t'; }, untaint => 1, untaint_pattern => qr|^(.+)$|}, File::Spec->curdir); -ok($found, 'commonsense.t found again'); +is($found, 1, 'taint.t found once again'); my $case = 2; my $FastFileTests_OK = 0; diff --git a/t/porting/known_pod_issues.dat b/t/porting/known_pod_issues.dat index 1d0a625..06ff301 100644 --- a/t/porting/known_pod_issues.dat +++ b/t/porting/known_pod_issues.dat @@ -202,6 +202,7 @@ dist/threads/lib/threads.pm Verbatim line length including indents exceeds 79 by dist/tie-file/lib/tie/file.pm Verbatim line length including indents exceeds 79 by 3 ext/devel-peek/peek.pm ? Should you be using L<...> instead of 2 ext/dynaloader/dynaloader.pm Verbatim line length including indents exceeds 79 by 1 +ext/file-find/lib/file/find.pm Verbatim line length including indents exceeds 79 by 1 ext/file-glob/glob.pm Verbatim line length including indents exceeds 79 by 15 ext/pod-html/testdir/perlpodspec-copy.pod Verbatim line length including indents exceeds 79 by 8 ext/pod-html/testdir/perlvar-copy.pod ? Should you be using L<...> instead of 3 @@ -272,7 +273,6 @@ utils/c2ph Verbatim line length including indents exceeds 79 by 44 lib/benchmark.pm Verbatim line length including indents exceeds 79 by 2 lib/config.pod ? Should you be using L<...> instead of -1 lib/extutils/embed.pm Verbatim line length including indents exceeds 79 by 2 -lib/file/find.pm Verbatim line length including indents exceeds 79 by 1 lib/perl5db.pl ? Should you be using L<...> instead of 1 lib/pod/text/overstrike.pm Verbatim line length including indents exceeds 79 by 1 lib/version/internals.pod Verbatim line length including indents exceeds 79 by 1 diff --git a/write_buildcustomize.pl b/write_buildcustomize.pl index 4916945..02c78f8 100644 --- a/write_buildcustomize.pl +++ b/write_buildcustomize.pl @@ -29,6 +29,7 @@ my @toolchain = qw(cpan/AutoLoader/lib ext/re dist/Term-ReadLine/lib dist/Exporter/lib + ext/File-Find/lib ); # Used only in ExtUtils::Liblist::Kid::_win32_ext() -- Perl5 Master Repository
