Skip Menu |

This queue is for tickets about the File-Find-Rule-Perl CPAN distribution.

Report information
The Basics
Id: 47633
Status: resolved
Priority: 0/
Queue: File-Find-Rule-Perl

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.06
Fixed in:
  • 1.07
  • 1.08



Subject: ->no_index continues showing entries that were elected for removal
->no_index({ file => [ '/path/to/bad_file.pl' ]})->perl_file->in('/path/to/') continues to emit '/path/to/bad_file.pl'; Attached test script when run in an empty directory except for the script itself, still reports itself being present.
Subject: t.pl
#!/usr/bin/perl use strict; use warnings; use File::Find::Rule; use File::Find::Rule::Perl; my @allfiles = File::Find::Rule->new()->perl_file->in('/tmp/ffr'); my @files = File::Find::Rule->new()->no_index( { file => ['/tmp/ffr/t.pl'] } )->perl_file->in('/tmp/ffr/'); use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 0; printf( '@allfiles = %s , @files = %s', Dumper( \@allfiles ), Dumper( \@files ) ); __END__ @allfiles = ['/tmp/ffr/t.pl'] , @files = ['/tmp/ffr/t.pl']
Subject: Re: [rt.cpan.org #47633] ->no_index continues showing entries that were elected for removal
Date: Tue, 7 Jul 2009 14:48:09 +1000
To: bug-File-Find-Rule-Perl [...] rt.cpan.org
From: Adam Kennedy <adamkennedybackup [...] gmail.com>
I don't have time to look in detail at this right now, but if you could convert that script into a test it would let me fix it in a fraction of the time. Either copy and modify this script, or add your problem to it. http://svn.ali.as/cpan/trunk/File-Find-Rule-Perl/t/03_no_index.t If you'd like commit to apply these tests, I can arrange that for you. Adam K 2009/7/7 Kent Fredric via RT <bug-File-Find-Rule-Perl@rt.cpan.org>: Show quoted text
> Mon Jul 06 18:29:58 2009: Request 47633 was acted upon. > Transaction: Ticket created by KENTNL >       Queue: File-Find-Rule-Perl >     Subject: ->no_index continues showing entries that were elected for removal >   Broken in: 1.06 >    Severity: Important >       Owner: Nobody >  Requestors: KENTNL@cpan.org >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=47633 > > > > ->no_index({ file => [ '/path/to/bad_file.pl' > ]})->perl_file->in('/path/to/') > > continues to emit  '/path/to/bad_file.pl'; > > > > Attached test script when run in an empty directory except for the > script itself, still reports itself being present. > > >
On Tue Jul 07 00:48:28 2009, adam@ali.as wrote: Show quoted text
> I don't have time to look in detail at this right now, but if you > could convert that script into a test it would let me fix it in a > fraction of the time. > > Either copy and modify this script, or add your problem to it. > > http://svn.ali.as/cpan/trunk/File-Find-Rule-Perl/t/03_no_index.t > > If you'd like commit to apply these tests, I can arrange that for you. > > Adam K
Attached patch for no_index.t that replicates the problem.
Index: t/03_no_index.t =================================================================== --- t/03_no_index.t (revision 7935) +++ t/03_no_index.t (working copy) @@ -6,7 +6,7 @@ $^W = 1; } -use Test::More tests => 20; +use Test::More tests => 24; use File::Spec::Functions ':ALL'; use File::Find::Rule (); use File::Find::Rule::Perl (); @@ -56,10 +56,57 @@ } } +################################################################### +# Several variations of absolute path and relative path , both +# in no_index and in search prefix. +SCOPE: { + my @params = ( + { # PASS + name => 'Relative Path', + path => 'lib/File/Find/Rule/Perl.pm', + dir => curdir(), + check => qr{Rule/Perl\.pm}, + }, + { # FAIL + name => 'Dot-prefix path', + path => './lib/File/Find/Rule/Perl.pm', + dir => curdir(), + check => qr{Rule/Perl\.pm}, + }, + { # FAIL + name => 'Absolute path', + path => rel2abs(curdir()) .'/lib/File/Find/Rule/Perl.pm', + dir => curdir(), + check => qr{Rule/Perl\.pm}, + }, + { # FAIL + name => 'Absolute path, Absolute Dir', + path => rel2abs(curdir()) .'/lib/File/Find/Rule/Perl.pm', + dir => rel2abs(curdir()), + check => qr{Rule/Perl\.pm}, + }, + ); + foreach my $p (@params) { + my $rule = FFR->relative->no_index({ file => [ $p->{path} ] })->file; + my @files = sort grep { $_ !~ m/blib/ && $_ =~ $p->{check}} $rule->in( $p->{dir} ); + if( @files ){ + ok( 0, 'No_index + filename ' . $p->{name} ); + for( @files ){ + diag( "File Found: $_ \n , no_index file was <$p->{path}>"); + } + } else { + ok( 1, 'No_index + filename ' . $p->{name} ); + } + } +} + + + + ##################################################################### # Run a test in a relative subdirectory # Test with and without ->relative, and with and without a relative ->in
On Thu Jul 09 18:24:24 2009, KENTNL wrote: Show quoted text
> On Tue Jul 07 00:48:28 2009, adam@ali.as wrote:
> > I don't have time to look in detail at this right now, but if you > > could convert that script into a test it would let me fix it in a > > fraction of the time. > > > > Either copy and modify this script, or add your problem to it. > > > > http://svn.ali.as/cpan/trunk/File-Find-Rule-Perl/t/03_no_index.t > > > > If you'd like commit to apply these tests, I can arrange that for you. > > > > Adam K
> > Attached patch for no_index.t that replicates the problem. >
I'll take a look at this patch and fixing it tonight.
On Fri Jul 10 07:36:44 2009, ASH wrote: Show quoted text
> On Thu Jul 09 18:24:24 2009, KENTNL wrote:
> > On Tue Jul 07 00:48:28 2009, adam@ali.as wrote:
> > > I don't have time to look in detail at this right now, but if you > > > could convert that script into a test it would let me fix it in a > > > fraction of the time. > > > > > > Either copy and modify this script, or add your problem to it. > > > > > > http://svn.ali.as/cpan/trunk/File-Find-Rule-Perl/t/03_no_index.t > > > > > > If you'd like commit to apply these tests, I can arrange that for you. > > > > > > Adam K
> > > > Attached patch for no_index.t that replicates the problem. > >
> > I'll take a look at this patch and fixing it tonight. >
So I've attached a patch against r7953 - i thought I had commit access (and maybe I do) but i'm getting svn: Commit failed (details follow): svn: OPTIONS request failed on '/cpan/trunk/File-Find-Rule-Perl' svn: OPTIONS of '/cpan/trunk/File-Find-Rule-Perl': 400 Bad request (http://svn.ali.as) Please note that I remove two of the cases that kentl added as they did not pass previously with 1.05 (where the 2 that remain did pass)
Index: t/03_no_index.t =================================================================== --- t/03_no_index.t (revision 7953) +++ t/03_no_index.t (working copy) @@ -6,7 +6,7 @@ $^W = 1; } -use Test::More tests => 20; +use Test::More tests => 22; use File::Spec::Functions ':ALL'; use File::Find::Rule (); use File::Find::Rule::Perl (); @@ -41,6 +41,8 @@ }; my @files = sort grep { ! /\.svn\b/ + and + ! /\.sw[op]\b/ and ! /\bblib\b/ and @@ -56,10 +58,45 @@ } } +################################################################### +# Several variations of absolute path and relative path , both +# in no_index and in search prefix. +SCOPE: { + my @params = ( + { + name => 'Relative Path', + path => 'lib/File/Find/Rule/Perl.pm', + dir => curdir(), + check => qr{Rule/Perl\.pm}, + }, + { + name => 'Absolute path, Absolute Dir', + path => rel2abs(curdir()) .'/lib/File/Find/Rule/Perl.pm', + dir => rel2abs(curdir()), + check => qr{Rule/Perl\.pm}, + }, + ); + foreach my $p (@params) { + my $rule = FFR->relative->no_index({ file => [ $p->{path} ] })->file; + my @files = sort grep { $_ !~ m/\bblib\b/ && $_ =~ $p->{check}} $rule->in( $p->{dir} ); + if( @files ){ + ok( 0, 'No_index + filename ' . $p->{name} ); + for( @files ){ + diag( "File Found: $_ \n , no_index file was <$p->{path}>"); + } + } else { + ok( 1, 'No_index + filename ' . $p->{name} ); + } + } +} + + + + ##################################################################### # Run a test in a relative subdirectory # Test with and without ->relative, and with and without a relative ->in Index: lib/File/Find/Rule/Perl.pm =================================================================== --- lib/File/Find/Rule/Perl.pm (revision 7953) +++ lib/File/Find/Rule/Perl.pm (working copy) @@ -256,10 +256,10 @@ my $relpath = File::Spec->abs2rel($absname, $root); # Attempt to match a META.yml entry - if ( $rule->{directory}->{$relpath} and -d $absname ) { + if ( ($rule->{directory}->{$relpath} or $rule->{directory}->{$absname} ) and -d $absname ) { return 1; } - if ( $rule->{file}->{$relpath} and -f $absname ) { + if ( ( $rule->{file}->{$relpath} or $rule->{file}->{$absname} ) and -f $absname ) { return 1; } return 0; Index: Changes =================================================================== --- Changes (revision 7953) +++ Changes (working copy) @@ -1,5 +1,7 @@ Revision history for Perl extension File-Find-Rule-Perl + - Fix no_index regression with absolute paths + 1.06 Mon 13 Apr 2009 - Upgraded to Module::Install 0.82 (ADAMK) - Additional test (without new) (Alexandr Ciornii)
Works for me. Thanks all.