I think I nailed down the problem's cause. A simpler test case is
perl -e 'use Cwd; print getcwd'
At some point this issues the following Cygwin calls
168 4607616 main perl 9268 mount_info::conv_to_win32_path: src_path //Cwd.dll, dst \\Cwd.dll, flags 0x2, rc 0
170 4607786 main perl 9268 build_fh_pc: fh 0x61276450, dev 000000C2
937 4608723 WNetOpenEnum perl 9268 cygthread::stub: thread 'WNetOpenEnum', id 0x1A58, stack_ptr 0x109AD40
--- Process 9268, exception 000006ba at 767DC41F
2273000 6881723 main perl 9268 __set_errno: int stat_worker(path_conv&, stat*):1880 setting errno 2
Note that //Cwd.dll is interpreted as a network path on Windows and that WNetOpenEnum takes two seconds to execute, before failing with an exception.
Tracing the code gives
$ perl -d:Trace -e 'use Cwd; print getcwd'
>> -e:1: use Cwd; print getcwd
>> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/Cwd.pm:406: *cwd = sub { &$orig_cwd() }
and this seems to be related to the following code.
if ($^O eq 'cygwin') {
# We need to make sure cwd() is called with no args, because it's
# got an arg-less prototype and will die if args are present.
local $^W = 0;
my $orig_cwd = \&cwd;
*cwd = sub { &$orig_cwd() }
}
|