Skip Menu |

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

Report information
The Basics
Id: 19528
Status: open
Priority: 0/
Queue: File-Find-Rule

People
Owner: Nobody in particular
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.29
Fixed in: (no value)



Subject: problem with trailing slashes and './'
Hi, the in() method in File::Find::Rule functions wrong when $File::Find::name is the current directory with several trailing slashes. Examples are './/' and './//'. The former doesn't match anything at all, while the latter converts to (wrong) absolute paths. A sample program follows: use File::Find::Rule; $rule=File::Find::Rule->new->start($ARGV[0]); while ($f = $rule->match ) { print "$f\n"; } When run with args './', './/' and './//', it gives different results. I have verified this on Debian GNU/Linux (i386), Perl 5.8.8 and File::Find::Rule 0.28 and 0.29. I'm attaching a patch that seems to fix this. Please consider including it. For reference, this bug was originally reported as Debian bug #329377, http://bugs.debian.org/329377 , by Gabor Kiss. Cheers, -- Niko Tyni (on behalf of the Debian Perl Group) ntyni@iki.fi
Subject: rule.patch
--- File-Find-Rule-0.29/lib/File/Find/Rule.pm 2006-05-16 17:27:00.000000000 +0300 +++ File-Find-Rule-0.29-fixed/lib/File/Find/Rule.pm 2006-05-27 20:19:55.220933683 +0300 @@ -540,7 +540,7 @@ my $topdir; my $code = 'sub { - (my $path = $File::Find::name) =~ s#^\./##; + (my $path = $File::Find::name) =~ s#^\./+([^/]+)#$1#; my @args = ($_, $File::Find::dir, $path); my $maxdepth = $self->{maxdepth}; my $mindepth = $self->{mindepth};
From: Gunnar Wolf
Hi, I verified on Niko Tyni's report, and it is still present in 0.30 - And applying the regular expression he suggests in his patch, the sample code works correctly. Greetings,
On Tue Jul 11 18:21:42 2006, GWOLF wrote: Show quoted text
> Hi, > I verified on Niko Tyni's report, and it is still present in 0.30 - And > applying the regular expression he suggests in his patch, the sample > code works correctly. > Greetings,
0.30 added the following to the test suite. is_deeply( [ sort $rule->in( './t' ) ], [ 't', @tests, 't/foobar', 't/lib' ], "maxdepth == 1, ./t" ); is_deeply( [ sort $rule->in( './././///./t' ) ], [ 't', @tests, 't/foobar', 't/lib' ], "maxdepth == 1, ./././///./t" ); And then changes were made to the code to make those tests pass. I just now added these tests to my svn version: is_deeply( [ sort $rule->in( './/t' ) ], [ 't', @tests, 't/foobar', 't/lib' ], "maxdepth == 1, .//t" ); is_deeply( [ sort $rule->in( './//t' ) ], [ 't', @tests, 't/foobar', 't/lib' ], "maxdepth == 1, .///t" ); Which still pass. I must be misunderstanding the bug report - please submit a failing testcase to me so that I can fix it. -- Richard Clamp <richardc@unixbeard.net>
Subject: Re: [rt.cpan.org #19528] problem with trailing slashes and './'
Date: Wed, 12 Jul 2006 21:43:41 +0300
To: via RT <bug-File-Find-Rule [...] rt.cpan.org>
From: Niko Tyni <ntyni [...] iki.fi>
On Tue, Jul 11, 2006 at 06:34:16PM -0400, via RT wrote: Show quoted text
> I must be misunderstanding the bug report - please submit a failing > testcase to me so that I can fix it.
I'm attaching a crude patch to the test script that contains four new testcases. The first two of these pass, the last two fail for me with 0.30. I'm also attaching a simple patch for 0.30 that makes them all pass. Cheers, -- Niko Tyni ntyni@iki.fi

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.