Skip Menu |

This queue is for tickets about the PathTools CPAN distribution.

Report information
The Basics
Id: 80077
Status: new
Priority: 0/
Queue: PathTools

People
Owner: Nobody in particular
Requestors: eric.roode+cpan [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 3.33
  • 3.39_01
Fixed in: (no value)



Subject: chdir() fails for UNC paths under cygwin
Microsoft systems specify network locations with UNC, with paths of the form: \\ServerName\path\path\path\ Cygwin represents such paths with forward-slashes. When running under cygwin, Cwd::cwd() will return something like "//server-foo/bar/dir". File::Spec->canonpath() accepts this format (and returns it unchanged). File::Spec->rel2abs('.') will return a string of this format. *** But Cwd::chdir('//server-foo/bar/dir') does not work! The problem seems to be the second line of the function chdir() in Cwd.pm: $newdir =~ s|///*|/|g unless $^O eq 'MSWin32'; That removes all double forward-slashies, including the necessary pair at the start of the string. Then chdir() calls CORE::chdir on '/server-foo/bar/dir', which fails with "No such file or directory". I suggest replacing that line with the following code: if ($^O eq 'cygwin') { # remove multiple slashes except at beginning $newdir =~ s|([^/])/{2,}|$1/|g; } elsif ($^O ne 'MSWin32') { $newdir =~ s|/{2,}|/|g; } That first substitution would probably be better written as: $newdir =~ s|(?<!\A)/{2,}|/|g; but you may not want to use that since it would break on really old perls.