develooper Front page | perl.perl5.porters | Postings from September 2005

[perl #37223] [PATCH] File::Find::find fails on Win32 with follow => 1

From:
Steve Peters via RT
Date:
September 25, 2005 14:41
Subject:
[perl #37223] [PATCH] File::Find::find fails on Win32 with follow => 1
Message ID:
rt-3.0.11-37223-121392.15.8703994486314@perl.org
> [stmpeters - Wed Sep 21 08:45:33 2005]:
> 
> On Wed, Sep 21, 2005 at 10:29:25AM -0500, Steve Peters wrote:
> > On Wed, Sep 21, 2005 at 04:57:31PM +0200, Rafael Garcia-Suarez
> wrote:
> > > Steve Hay (via RT) wrote:
> > > > The File::Find::find() function fails on Win32 if the "follow =>
> 1"
> > > > option is
> > > > specified.
> > >
> > > > Presumably "follow" (and "follow_fast"?) should be no-ops on
> Win32 since
> > > > symbolic links are not supported on that OS.
> > >
> > > Seems quite sensible.
> > > Is this a new problem ? I can't believe nobody noticed it until
> now...
> >
> > If its new, then I'm probably the one who broke it.  Can you see
> which versions
> > that it is now broken on?  Or did it just hit another bug
> previously.
> >
> > Steve Peters
> > steve@fisharerojo.org
> 
> OK, it looks like there might be a problem with change #23510.  I'll
> take a
> look at it when I have a little more time this evening.

Hmmm...I backed out that above change to test and the errors were still
there.  So, at least I didn't break anything, but I'm not sure what did.  

Anyways, since symbolic links aren't available on Win32, below is a
patch to default Win32 to not follow, regardless of what is passed in. 
The scary part is that this change allowed all the tests to continue to
pass on Win32.


--- lib/File/Find.pm.old        Thu Jun 23 11:18:09 2005
+++ lib/File/Find.pm    Sun Sep 25 16:38:47 2005
@@ -603,8 +603,9 @@
     $pre_process       = $wanted->{preprocess};
     $post_process      = $wanted->{postprocess};
     $no_chdir          = $wanted->{no_chdir};
-    $full_check        = $wanted->{follow};
-    $follow            = $full_check || $wanted->{follow_fast};
+    $full_check        = $^O eq 'MSWin32' ? 0 : $wanted->{follow};
+    $follow            = $full_check || $^O eq 'MSWin32' ? 0 : 
+                             $wanted->{follow_fast};
     $follow_skip       = $wanted->{follow_skip};
     $untaint           = $wanted->{untaint};
     $untaint_pat       = $wanted->{untaint_pattern};

  




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About