New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File::Find not performing as documented #7913
Comments
From jms@mathras.comcast.netCreated by jms@mathras.comcast.netThis is a bug report for perl from jms@mathras.comcast.net, ----------------------------------------------------------------- The use of lstat() is not guaranteed in File::Find, contrary
Not in all cases. lstat() does not always occur in directories linux% cd ~/bin # Do not run test with . = dir-with-too-many-files linux% diff -u Find.pm.orig Find.pm Inline Patch--- Find.pm.orig 2004-02-27 08:31:34.000000000 -0800
+++ Find.pm 2005-05-17 02:39:04.000000000 -0700
@@ -120,8 +120,11 @@
=item *
-It is guaranteed that an I<lstat> has been called before the user's
-C<wanted()> function is called. This enables fast file checks involving S< _>.
+Previous versions of File::Find were guaranteed to call an I<lstat>
+before the user's C<wanted()> function was called, but this is no
+longer the case. Since this depends on File::Find::done_use_nlink, $^O,
+and other factors, fast file checks involving S< _> are not recommended
+unless C<wanted()> calls I<lstat> first.
=item *
Perl Info
|
From @schwern[jms@mathras.comcast.net - Tue May 17 03:40:07 2005]:
I am unable to replicate this problem with either 5.8.1, 5.8.6 or |
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Fri, Jul 08, 2005 at 10:10:56AM -0000, Michael G Schwern via RT wrote:
I can: #!/usr/bin/perl which gives: $ ./perl -Ilib /tmp/p1 0 Its a problem as far back as 5.003_22 at least. Basically, when it does the 'nlink check' shortcut on a directory to So we either fix the docs, as suggested, or fix the code to stat *every* -- |
From @schwernI still can't reproduce this on OS X. On Sun, Jul 10, 2005 at 07:31:02PM +0100, Dave Mitchell wrote:
I'd be interested to see, given how much work File::Find does anyway, -- |
From @iabynOn Mon, Jul 11, 2005 at 12:35:36AM -0700, Michael G Schwern wrote:
I guess the filesystem you have doesn't have the nlinks > 2 property
It makes a huge difference on my laptop (slow disk): use File::Find; my $count=0; running this the first time with arg0 = 0 took about 3 minutes; rerunning Susequently running with arg0 = 1 (bearing in mind that the directories CPU usage is almost zero; the code is completely IO bound. Perhaps the best approrach would be to document that an lstat is no longer -- |
From @schwernOn Sun, Jul 17, 2005 at 06:42:40PM +0100, Dave Mitchell wrote:
Sounds good to me. Seems like a waste to guarantee it if you're not going -- |
From @rgsjms@mathras.comcast.net (via RT) wrote:
Thanks, doc patch applied as change #26076 to bleadperl. |
@rgs - Status changed from 'open' to 'resolved' |
From @rgsRafael Garcia-Suarez wrote:
As this documentation appears on a section about follow and follow_fast, Change 26128 by rgs@bloom on 2005/11/14 15:40:08 A better fix for [perl #35847] File::Find not performing as documented, Affected files ... ... //depot/perl/lib/File/Find.pm#83 edit Differences ... ==== //depot/perl/lib/File/Find.pm#83 (text) ==== @@ -120,11 +120,10 @@ =item * -Previous versions of File::Find were guaranteed to call an I<lstat> =item * ==== //depot/perl/pod/perlfaq3.pod#89 (text) ==== @@ -85,10 +85,12 @@ - find sub { push @files, - print join "\n", @files; If you simply need to quickly check to see if a module is |
Migrated from rt.perl.org#35847 (status was 'resolved')
Searchable as RT35847$
The text was updated successfully, but these errors were encountered: