From f75dfdbdb9d52b3024db9a0eb27405c2175af144 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Mon, 10 Dec 2018 15:38:54 +1100 Subject: (perl #133673) disable the File::Find nlink optimization by default This will also fix 128894 and 126144. --- ext/File-Find/lib/File/Find.pm | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) (limited to 'ext') diff --git a/ext/File-Find/lib/File/Find.pm b/ext/File-Find/lib/File/Find.pm index 03dac9fbda..c052ceebb3 100644 --- a/ext/File-Find/lib/File/Find.pm +++ b/ext/File-Find/lib/File/Find.pm @@ -3,7 +3,7 @@ use 5.006; use strict; use warnings; use warnings::register; -our $VERSION = '1.34'; +our $VERSION = '1.35'; require Exporter; require Cwd; @@ -770,31 +770,11 @@ sub finddepth { $File::Find::skip_pattern = qr/^\.{1,2}\z/; $File::Find::untaint_pattern = qr|^([-+@\w./]+)$|; -# These are hard-coded for now, but may move to hint files. -if ($^O eq 'VMS') { - $Is_VMS = 1; - $File::Find::dont_use_nlink = 1; -} -elsif ($^O eq 'MSWin32') { - $Is_Win32 = 1; -} - # this _should_ work properly on all platforms # where File::Find can be expected to work $File::Find::current_dir = File::Spec->curdir || '.'; -$File::Find::dont_use_nlink = 1 - if $^O eq 'os2' || $^O eq 'dos' || $^O eq 'amigaos' || $Is_Win32 || - $^O eq 'interix' || $^O eq 'cygwin' || $^O eq 'qnx' || $^O eq 'nto'; - -# Set dont_use_nlink in your hint file if your system's stat doesn't -# report the number of links in a directory as an indication -# of the number of files. -# See e.g. hints/haiku.sh for Haiku. -unless ($File::Find::dont_use_nlink) { - require Config; - $File::Find::dont_use_nlink = 1 if ($Config::Config{'dont_use_nlink'}); -} +$File::Find::dont_use_nlink = 1; # We need a function that checks if a scalar is tainted. Either use the # Scalar::Util module's tainted() function or our (slower) pure Perl @@ -1106,17 +1086,15 @@ warnings. =item $dont_use_nlink -You can set the variable C<$File::Find::dont_use_nlink> to 1 if you want to -force File::Find to always stat directories. This was used for file systems -that do not have an C count matching the number of sub-directories. -Examples are ISO-9660 (CD-ROM), AFS, HPFS (OS/2 file system), FAT (DOS file -system) and a couple of others. +You can set the variable C<$File::Find::dont_use_nlink> to 0 if you +are sure the filesystem you are scanning reflects the number of +subdirectories in the parent directory's C count. -You shouldn't need to set this variable, since File::Find should now detect -such file systems on-the-fly and switch itself to using stat. This works even -for parts of your file system, like a mounted CD-ROM. +If you do set C<$File::Find::dont_use_nlink> to 0, you may notice an +improvement in speed at the risk of not recursing into subdirectories +if a filesystem doesn't populate C as expected. -If you do set C<$File::Find::dont_use_nlink> to 1, you will notice slow-downs. +C<$File::Find::dont_use_nlink> now defaults to 1 on all platforms. =item symlinks -- cgit v1.2.1