Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Bugs in File::Find on Windows

by jdporter (Paladin)
on Feb 19, 2007 at 14:48 UTC ( [id://600860]=note: print w/replies, xml ) Need Help??


in reply to Re: Bugs in File::Find on Windows
in thread Bugs in File::Find on Windows

You haven't reproduced my failure scenario, which requires that the target directory be a drive letter with no other path info. Try this:

cd /d e:\windows cd /d c:\ find({ no_chdir => 1, wanted => sub { print if -d } }, 'E:' );

But I've discovered more about this bug. Try this:

cd /d c:\ mkdir test\windows\foo cd test cd /d e:\ perl -MFile::Find -e "$\=$/; find( sub { print if -d }, 'c:' );"
Output is just as you'd expect:
. windows foo
But if you run
perl -MFile::Find -e "$\=$/; find({ no_chdir => 1, wanted => sub { pri +nt if -d } }, 'c:' );"
you get unexpected (erroneous) output:
. . . c:/windows/$hf_mig$/KB898461/update c:/windows/$MSI31Uninstall_KB893803$ c:/windows/$MSI31Uninstall_KB893803$/spuninst c:/windows/$NtServicePackUninstall$ c:/windows/$NtServicePackUninstall$/spuninst c:/windows/$NtUninstallKB816486$ . . . c:/windows/ADDINS c:/windows/AppPatch c:/windows/assembly c:/windows/assembly/GAC_32 c:/windows/assembly/GAC_32/CustomMarshalers c:/windows/assembly/GAC_32/CustomMarshalers/2.0.0.0__b03f5f7f11d50a3a . . .

In other words, if it finds a subdirectory of the target directory named X, it searches under C:\X, even if the target directory is not C:\. It's definitely a bug.

A word spoken in Mind will reach its own level, in the objective world, by its own weight

Replies are listed 'Best First'.
Re^3: Bugs in File::Find on Windows
by pKai (Priest) on Feb 19, 2007 at 19:30 UTC

    I see now.

    I took your "...broken on Windows too! It fails to recurse at all." as an absolute verdict on no_chdir, rather than as an outcome in your special situation, depending on the current directories on both drives and even the top-level directories of C:.

    Tricky stuff.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://600860]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-24 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found