Open jimav opened 1 month ago
The following patch seems to fix the problem, but the code kind of scares me (and it really needs tests):
diff --git ext/File-Find/lib/File/Find.pm ext/File-Find/lib/File/Find.pm
index af84fbf116..fb4facf356 100644
--- ext/File-Find/lib/File/Find.pm
+++ ext/File-Find/lib/File/Find.pm
@@ -32,12 +32,12 @@ sub contract_name {
$cdir = substr($cdir,0,rindex($cdir,'/')+1);
- $fn =~ s|^\./||;
+ $fn =~ s|^(?:\./+)+||;
my $abs_name= $cdir . $fn;
if (substr($fn,0,3) eq '../') {
- 1 while $abs_name =~ s!/[^/]*/\.\./+!/!;
+ 1 while $abs_name =~ s!/[^/]+/+\.\./+!/!;
}
return $abs_name;
Module: File::Find 1.43 (in Perl v5.37.10)
Description With
follow => 1
if a symlink to a directory contains a trailing slash, and that directory contains a relative symlink to a file, then file descriptor '_' is not defined when visiting the linked-to file.The script below creates the following structure:
When
File::Find::find
is called with a starting path of/tmp/tdir/testlink2
, then "wanted" is called with $_ set toFile_Link
(and File::Find::name is/tmp/tdir/testlink2/File_link
) but with filehandle '_' undefined.Everything works as expected when starting at
/tmp/tdir/testlink1
.Steps to Reproduce
Expected behavior I think the trailing slash should mean nothing (on Linux).
Actual Results
Perl configuration perl_dashV.txt