Skip Menu |

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

Report information
The Basics
Id: 96677
Status: new
Priority: 0/
Queue: File-Find-Iterator

People
Owner: Nobody in particular
Requestors: liam.gretton [...] leicester.ac.uk
Cc:
AdminCc:

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



Subject: Avoiding symlinks
Date: Tue, 24 Jun 2014 11:04:19 +0100
To: bug-File-Find-Iterator [...] rt.cpan.org
From: Liam Gretton <liam.gretton [...] leicester.ac.uk>
I've found that the iterator will follow some symlinks endlessly, especially in the (slightly pathological) case of a symlink that links to its own directory, e.g.: link -> . It would be good to have an option to the create() method to stipulate that symlinks shouldn't be followed. I've hacked around this at the moment with the following patch to Iterator.pm. --- Iterator.pm +++ Iterator.pm @@ -32,10 +32,12 @@ sub walktree { return unless @TODO; my $item = pop @TODO; $item =~ s%/+$%%; + if (-d $item ) { my $d = IO::Dir->new($item); while (defined($_ = $d->read)) { next if ($_ eq '.' || $_ eq '..'); + next if (-l "$item/$_"); push @TODO, "$item/$_"; } } -- Liam Gretton liam.gretton@le.ac.uk Systems Specialist http://www.le.ac.uk/its/ IT Services Tel: +44 (0)116 2522254 University Of Leicester, University Road Leicestershire LE1 7RH, United Kingdom