Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 14905
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: m [...] perlmeister.com
Cc:
AdminCc:

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



Subject: ttree goes into infinite loop on directories named "0"
Hey guys, just saw ttree run into a problem while traversing the "src" directory. Reason: One of the directories had the somewhat unusual, but valid name "0" which caused ttree to enter an infinite loop. Patch attached. -- Mike Mike Schilli m@perlmeister.com
diff -Naur Template-Toolkit-2.14/bin/ttree Template-Toolkit-2.14.patched/bin/ttree --- Template-Toolkit-2.14/bin/ttree 2004-10-04 03:27:39.000000000 -0700 +++ Template-Toolkit-2.14.patched/bin/ttree 2005-10-03 18:20:17.850390952 -0700 @@ -229,14 +229,15 @@ my $target; local *DIR; - my $absdir = join('/', $srcdir ? $srcdir : (), $dir ? $dir : ()); + my $absdir = join('/', $srcdir ? $srcdir : (), + defined $dir ? $dir : ()); $absdir ||= '.'; opendir(DIR, $absdir) || do { warn "$absdir: $!\n"; return undef; }; FILE: while (defined ($file = readdir(DIR))) { next if $file eq '.' || $file eq '..'; - $path = $dir ? "$dir/$file" : $file; + $path = defined $dir ? "$dir/$file" : $file; $abspath = "$absdir/$file"; next unless -e $abspath;